/* Google Font: Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* Ensure readable base font size for all browsers */
html {
    font-size: 18px !important;
    zoom: 1 !important;
    -webkit-text-size-adjust: 100%;
}

body {
    font-size: 1rem !important;
    min-height: 100vh;
    zoom: 1 !important;
}

/* style.css */

body {
    font-family: 'Inter', sans-serif;
    background-color: #7ca9d5;
    /* Slightly lighter gray background */
    color: #374151;
    /* Dark gray text */
    line-height: 1.6;
    /* Improve readability */
    margin: 0;
    padding: 0;
}

/* Navigation Link Styling */
.nav-link {
    color: white;
    transition: background-color 300ms ease-in-out;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    margin-left: 1rem;
}

.nav-link:hover {
    background-color: #1d4ed8;
    text-decoration: underline;
}

/* Mega Menu Styling */
.nav-mega-menu {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
}

.nav-link,
.nav-mega-toggle,
.header-nav-link {
    position: relative;
    z-index: 1001;
    pointer-events: auto !important;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: background-color 300ms ease-in-out;
}

.nav-mega-toggle:hover {
    background-color: #1d4ed8;
}

.nav-mega-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    margin-top: 0.5rem;
    /* The original compact panel width. The columns are narrow and the grid
       gaps do the spacing, so the panel does not sprawl across the page. */
    min-width: 700px;
    max-width: calc(100vw - 2rem);
    border-radius: 8px;
    padding: 2rem;
    display: none !important;
    pointer-events: none !important;
}

/* A compact menu holds few links, so a fixed 700px would leave it mostly
   empty. This is opt-in per menu rather than "any single column" - "For
   Schools" is also a single column but keeps the full-width panel. */
.nav-mega-menu.mega-compact .nav-mega-panel {
    min-width: 0;
    width: max-content;
    padding: 1.5rem;
}

.nav-mega-panel.is-open,
.nav-mega-panel.active,
.nav-mega-panel[style*="display: block"],
.nav-mega-panel[style*="display:block"],
.nav-mega-menu:hover .nav-mega-panel,
.nav-mega-menu:focus-within .nav-mega-panel {
    display: block !important;
    pointer-events: auto !important;
}

.mega-menu-grid {
    display: grid;
    /* `max-content` rather than `1fr`: a menu with a single short column would
       otherwise stretch that column across the whole 700px panel and look
       half empty. Each column now takes only the width its links need. */
    grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
    gap: 2.5rem;
    justify-content: start;
}

.mega-menu-column h3 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.mega-menu-column a {
    display: block;
    padding: 0.5rem 0;
    color: #1f2937;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 200ms ease-in-out, padding-left 200ms ease-in-out;
}

.mega-menu-column a:hover {
    color: #2563eb;
    padding-left: 0.5rem;
}

.mega-menu-column a.featured {
    color: #dc2626;
    font-weight: 600;
}

/* The rightmost menu's panel is centred on its toggle, which would push it
   past the viewport edge. Anchor it to the right of the header instead.
   `:last-of-type` rather than `:last-child` because js/nav-search.js appends
   the search box as the nav's last child. */
@media (min-width: 769px) {
    .site-header nav>.nav-mega-menu:last-of-type .nav-mega-panel {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* Section Headings */
.section-heading {
    font-size: 2rem;
    /* text-3xl */
    font-weight: 800;
    /* font-extrabold */
    color: #1e40af;
    /* text-blue-800 */
    margin-bottom: 1.5rem;
    /* mb-6 */
    border-bottom: 2px solid #0071f2;
    /* border-blue-200 */
    padding-bottom: 0.5rem;
    /* pb-2 */
    text-align: center;
    /* Center-align headings */
}

/* Slider Styling */





.slider-container {
    width: 100%;
    max-width: 600px;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #f3f8fd;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.slider-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 1rem;
}

input[type="range"].nice-slider {
    width: 100%;
    max-width: 400px;
    height: 0.5rem;
    background: linear-gradient(90deg, #1e40af 0%, #60a5fa 100%);
    border-radius: 0.5rem;
    outline: none;
    transition: background 0.3s;
    margin-bottom: 1rem;
}

input[type="range"].nice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    background: #10b981;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

input[type="range"].nice-slider:active::-webkit-slider-thumb,
input[type="range"].nice-slider:focus::-webkit-slider-thumb {
    background: #059669;
    transform: scale(1.1);
}

input[type="range"].nice-slider::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    background: #10b981;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

input[type="range"].nice-slider:active::-moz-range-thumb,
input[type="range"].nice-slider:focus::-moz-range-thumb {
    background: #059669;
    transform: scale(1.1);
}

input[type="range"].nice-slider::-ms-thumb {
    width: 1.5rem;
    height: 1.5rem;
    background: #10b981;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

input[type="range"].nice-slider:active::-ms-thumb,
input[type="range"].nice-slider:focus::-ms-thumb {
    background: #059669;
    transform: scale(1.1);
}

input[type="range"].nice-slider::-ms-fill-lower {
    background: #1e40af;
    border-radius: 0.5rem;
}

input[type="range"].nice-slider::-ms-fill-upper {
    background: #60a5fa;
    border-radius: 0.5rem;
}

input[type="range"].nice-slider:focus {
    outline: none;
    box-shadow: 0 0 0 3px #93c5fd;
}

input[type="range"].nice-slider::-webkit-slider-runnable-track {
    height: 0.5rem;
    border-radius: 0.5rem;
}

input[type="range"].nice-slider::-moz-range-track {
    height: 0.5rem;
    border-radius: 0.5rem;
    background: linear-gradient(90deg, #1e40af 0%, #60a5fa 100%);
}

input[type="range"].nice-slider::-ms-fill-lower {
    background: #1e40af;
}

input[type="range"].nice-slider::-ms-fill-upper {
    background: #60a5fa;
}

input[type="range"].nice-slider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2563eb;
    margin-top: 0.5rem;
}

/* Luxury Scrolling Experience - Themed Scrollbar */
html {
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: #2563eb #f3f8fd;
    /* Themed: blue thumb, light track */
}

body {
    overscroll-behavior-y: contain;
}

/* Webkit Themed Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    background: #f3f8fd;
    /* Themed light blue track */
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
    /* Themed blue gradient */
    border-radius: 8px;
    min-height: 40px;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.12);
    border: 3px solid #f3f8fd;
    /* Match track */
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1e40af 0%, #60a5fa 100%);
}

::-webkit-scrollbar-corner {
    background: #f3f8fd;
}

@media (hover: none) and (pointer: coarse) {
    ::-webkit-scrollbar {
        width: 8px;
    }

    ::-webkit-scrollbar-thumb {
        min-height: 28px;
    }
}

/* Sub-Section Headings */
.sub-section-heading {
    font-size: 1.75rem;
    /* text-2xl */
    font-weight: 700;
    /* font-bold */
    color: #2563eb;
    /* text-blue-700 */
    margin-bottom: 1rem;
    /* mb-4 */
    text-align: center;
    /* Center-align sub-headings */
}

/* Content Block Styling */
.content-block {
    background-color: white;
    padding: 2rem;
    /* Increase padding for better spacing */
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.06);
    /* shadow-md */
    margin-bottom: 2rem;
    /* mb-8 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Smooth hover effect */
}

.content-block:hover {
    transform: translateY(-5px);
    /* Slightly lift on hover */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    /* Enhance shadow on hover */
}

/* List Item Styling */
.list-item {
    margin-bottom: 0.75rem;
    /* mb-3 */
    font-size: 1rem;
    /* Increase font size for readability */
}

/* Image Container Styling */
.image-container {
    margin: 2rem 0;
    /* Increase vertical spacing */
    display: flex;
    justify-content: center;
}

.image-container img {
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.06);
    /* shadow-lg */
    max-width: 100%;
    height: auto;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Smooth hover effect */
}

.image-container img:hover {
    transform: scale(1.05);
    /* Slightly enlarge on hover */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    /* Enhance shadow on hover */
}

/* Video Embed Styling */
.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    height: 0;
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.06);
    /* shadow-lg */
    overflow: hidden;
    margin: 2rem 0;
    /* Increase vertical spacing */
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

iframe[src*=".pdf"] {
    width: 100%;
    height: 78vh !important;
    min-height: 760px;
}

embed[type="application/pdf"],
embed[src*=".pdf"] {
    width: 100%;
    height: 78vh !important;
    min-height: 760px;
}

@media (max-width: 768px) {
    iframe[src*=".pdf"] {
        height: 72vh !important;
        min-height: 620px;
    }

    embed[type="application/pdf"],
    embed[src*=".pdf"] {
        height: 72vh !important;
        min-height: 620px;
    }
}

/* Table Container Styling */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
    /* Increase vertical spacing */
    border-radius: 0.5rem;
    /* rounded-lg */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    /* shadow-lg */
    background-color: #ffffff;
    /* White background */
    padding: 1.5rem;
    /* Add padding around the table */
}

.table-container table {
    width: 100%;
    border-collapse: collapse;
    /* Ensure borders are clean */
    border-spacing: 0;
    /* Remove default spacing */
    border-radius: 0.5rem;
    /* rounded-lg */
    overflow: hidden;
    /* Ensure rounded corners clip content */
}

.table-container th,
.table-container td {
    padding: 1rem;
    /* Increase padding for better spacing */
    text-align: left;
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 600;
    /* font-semibold */
    color: #374151;
    /* text-gray-700 */
    border-bottom: 1px solid #e5e7eb;
    /* divide-y divide-gray-200 */
}

.table-container th {
    background-color: #1e40af;
    /* text-blue-800 */
    color: #ffffff;
    /* White text */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* tracking-wider */
}

.table-container tbody tr:nth-child(odd) {
    background-color: #f3f4f6;
    /* bg-gray-100 */
}

.table-container tbody tr:nth-child(even) {
    background-color: #ffffff;
    /* bg-white */
}

.table-container tbody tr:hover {
    background-color: #e0f2fe;
    /* hover:bg-blue-100 */
    cursor: pointer;
    /* Indicate interactivity */
    transform: scale(1.02);
    /* Slightly enlarge row */
    transition: transform 0.2s ease, background-color 0.2s ease;
    /* Smooth transition */
}

/* Embedded Style for Nice Buttons */
.nice-button {
    background-color: #10b981;
    /* bg-green-500 */
    color: white;
    /* White text */
    padding: 0.75rem 1.5rem;
    /* Adjust padding for better spacing */
    border-radius: 0.375rem;
    /* rounded-md */
    font-size: 1rem;
    /* text-base */
    font-weight: 600;
    /* font-semibold */
    text-transform: uppercase;
    /* Uppercase text */
    letter-spacing: 0.05em;
    /* tracking-wide */
    border: none;
    /* Remove border */
    cursor: pointer;
    /* Pointer cursor */
    transition: background-color 0.3s ease, transform 0.2s ease;
    /* Smooth hover effect */
}

.nice-button:hover {
    background-color: #059669;
    /* hover:bg-green-600 */
    transform: scale(1.05);
    /* Slightly enlarge on hover */
}

.nice-button:active {
    background-color: #047857;
    /* active:bg-green-700 */
    transform: scale(0.95);
    /* Slightly shrink on active */
}

/* Header Styling */
.header {
    background-color: #004080;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.site-title {
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.site-title a {
    text-decoration: none;
    color: inherit;
}

/* Main Content Styling */
.main-content {
    padding: 2rem;
    text-align: center;
}

.main-heading {
    font-size: 2.5rem;
    font-weight: bold;
    color: #004080;
}

.intro-text {
    font-size: 1.25rem;
    color: #333;
}

/* Footer Styling */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 1rem;
}

.footer a {
    color: #00bfff;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* General style for draggable boats - should be the desired small size by default */
.draggable.boat {
    min-width: 0 !important;
    width: auto !important;
    font-size: 0.875rem !important;
    /* Equivalent to Tailwind's text-sm */
    padding: 0.25rem 0.75rem !important;
    /* Equivalent to Tailwind's py-1 px-3 */
    box-sizing: border-box !important;
    line-height: 1.2 !important;
    /* Adjusted for smaller font */
    cursor: pointer !important;
    /* Ensure pointer cursor */
}

#available-boats-zone .draggable.boat,
#available-zone .draggable.boat {
    min-width: 0 !important;
    width: auto !important;
    font-size: 0.875rem !important;
    /* text-sm */
    padding: 0.25rem 0.75rem !important;
    /* py-1 px-3 */
    box-sizing: border-box !important;
    line-height: 1.2 !important;
    /* Adjusted for smaller font */
}

#available-zone .flex .draggable.boat {
    min-width: unset !important;
    width: auto !important;
    font-size: 1rem !important;
    padding: 0.5rem 1rem !important;
    box-sizing: border-box !important;
    line-height: 1.25 !important;
    flex: 0 1 auto !important;
    max-width: 180px !important;
}

#available-boats-zone .draggable.boat {
    flex: 0 1 auto !important;
    max-width: 180px !important;
    width: auto !important;
    padding: 0.5rem 1rem !important;
    font-size: 1rem !important;
    line-height: 1.25 !important;
}

#available-boats-zone {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.dropzone {
    display: block;
    /* Ensure stacked layout */
    position: relative;
    /* Allow z-index to work */
}

.draggable {
    position: relative;
    /* Ensure z-index works */
}

.draggable.instructor,
.draggable.assistant {
    z-index: 10;
    /* Ensure instructors and assistants are on top */
    order: -1;
    /* Prioritize instructors and assistants */
}

.draggable.boat,
.draggable.student {
    z-index: 1;
    /* Lower z-index for boats and students */
    order: 0;
    /* Default order */
}

/* ==========================================================================
   DARK THEME
   --------------------------------------------------------------------------
   A partial dark mode. The chrome (page, header, footer, cards, inputs) goes
   dark, but reading surfaces - tables, code, syntax blocks, embeds, images and
   anything marked [data-theme-keep-light] - deliberately STAY LIGHT so text
   inside them never loses contrast. That is the point: not everything goes
   dark, only the surrounding chrome.
   ========================================================================== */

html.dark {
    background-color: #0b1220;
    color: #e2e8f0;
    color-scheme: dark;
}

/* The base page background lives on <body> (see line ~21), so it needs the
   same treatment or the light-blue body paint hides everything on top. */
html.dark body {
    background-color: #0b1220;
    color: #e2e8f0;
}

/* Default link colour: a soft blue that reads on dark, not a harsh cyan. */
html.dark a {
    color: #93c5fd;
}

html.dark a:hover {
    color: #bfdbfe;
}

html.dark header {
    background-color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

html.dark footer {
    background-color: #0f172a;
    color: #cbd5e1;
}

html.dark footer a {
    color: #bfdbfe;
}

html.dark .content-block {
    background-color: #111c30;
    border-color: #24344f;
    color: #e2e8f0;
}

html.dark h1,
html.dark h2,
html.dark h3,
html.dark h4,
html.dark h5,
html.dark h6 {
    color: #f8fafc;
}

/* Form controls need their own dark treatment or they stay bright white. */
html.dark input,
html.dark select,
html.dark textarea {
    background-color: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748b;
}

html.dark .inline-ad-wrap {
    background: #111c30;
    border-color: #24344f;
}

/* Keep the shared header chrome white; the generic link colour must not win. */
html.dark header .nav-link,
html.dark header .nav-mega-toggle {
    color: #ffffff;
}

/* Mega menu dropdowns, which open over the dark page. */
html.dark .nav-mega-panel {
    background-color: #111c30;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

html.dark .mega-menu-column {
    background-color: #111c30;
}

html.dark .mega-menu-column h3 {
    color: #93c5fd;
}

html.dark .mega-menu-column a.featured {
    color: #fca5a5 !important;
}

html.dark .mega-menu-close {
    background-color: #1e293b;
    color: #e2e8f0;
    border-color: #334155;
}

html.dark .mega-menu-close:hover {
    background-color: #334155;
}

/* Auth modal */
html.dark #auth-form {
    background: #111c30;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

/* ---- Reading surfaces that stay light on purpose ----
   NOTE: these rules must come AFTER the utility remaps (search the bottom of
   this file for "Moved keep-light rules"). Equal-specificity !important rules
   are won by whichever appears last, and the remaps are meant to be overridden
   by the keep-light surfaces, not the other way around. */

/* Scrollbars, so the window furniture matches. */
html.dark ::-webkit-scrollbar {
    background: #0b1220;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 6px;
}

/* ---- Dark text utilities become light ----
   Attribute-substring selectors are used because every shade of a family needs
   the same treatment and the site uses dozens of them. These come after the
   base rules so `.text-white` (below) can win where both match. */
html.dark [class*="text-gray-"],
html.dark [class*="text-slate-"] {
    color: #cbd5e1;
}

html.dark [class*="text-blue-"],
html.dark [class*="text-sky-"],
html.dark [class*="text-cyan-"] {
    color: #93c5fd;
}

html.dark [class*="text-indigo-"],
html.dark [class*="text-purple-"] {
    color: #c4b5fd;
}

html.dark [class*="text-green-"],
html.dark [class*="text-emerald-"],
html.dark [class*="text-teal-"] {
    color: #86efac;
}

html.dark [class*="text-amber-"],
html.dark [class*="text-yellow-"],
html.dark [class*="text-orange-"] {
    color: #fcd34d;
}

html.dark [class*="text-red-"],
html.dark [class*="text-rose-"],
html.dark [class*="text-pink-"] {
    color: #fca5a5;
}

/* Saturated yellow CTAs keep their dark text (they are not darkened). */
html.dark .from-yellow-300,
html.dark .bg-yellow-400,
html.dark .bg-yellow-500 {
    color: #1e3a8a !important;
}

/* White text must win over the family rules above, so it comes last. */
html.dark .text-white,
html.dark .text-white\/90 {
    color: #ffffff !important;
}

/* ---- Light Tailwind surfaces become dark panels ----
   The site paints most cards with `bg-white`/`bg-*-50/100`. Without this a
   white card sits next to the dark page with white (invisible) headings. */
html.dark .bg-white {
    background-color: #111c30 !important;
}

html.dark .bg-slate-50,
html.dark .bg-gray-50 {
    background-color: #0f172a !important;
}

html.dark .bg-slate-100,
html.dark .bg-gray-100 {
    background-color: #1e293b !important;
}

html.dark .bg-slate-200,
html.dark .bg-gray-200 {
    background-color: #334155 !important;
}

html.dark .bg-gray-300 {
    background-color: #475569 !important;
}

html.dark .bg-blue-50 {
    background-color: #10233f !important;
}

html.dark .bg-blue-100 {
    background-color: #152f52 !important;
}

html.dark .bg-indigo-50 {
    background-color: #171a3d !important;
}

html.dark .bg-indigo-100 {
    background-color: #1e2150 !important;
}

html.dark .bg-sky-50 {
    background-color: #0c2436 !important;
}

html.dark .bg-sky-100 {
    background-color: #103044 !important;
}

html.dark .bg-cyan-50 {
    background-color: #0d2530 !important;
}

html.dark .bg-cyan-100 {
    background-color: #12303d !important;
}

html.dark .bg-purple-50 {
    background-color: #1f1a3a !important;
}

html.dark .bg-purple-100 {
    background-color: #2a2350 !important;
}

html.dark .bg-teal-50 {
    background-color: #0b2723 !important;
}

html.dark .bg-teal-100 {
    background-color: #10342e !important;
}

html.dark .bg-emerald-50 {
    background-color: #0a2a1f !important;
}

html.dark .bg-emerald-100 {
    background-color: #103a2b !important;
}

html.dark .bg-green-50 {
    background-color: #0c2a16 !important;
}

html.dark .bg-green-100 {
    background-color: #133a1e !important;
}

html.dark .bg-amber-50 {
    background-color: #2a2110 !important;
}

html.dark .bg-amber-100 {
    background-color: #3a2d13 !important;
}

html.dark .bg-yellow-50 {
    background-color: #2a260f !important;
}

html.dark .bg-yellow-100 {
    background-color: #3a3413 !important;
}

html.dark .bg-orange-50 {
    background-color: #2a1c10 !important;
}

html.dark .bg-orange-100 {
    background-color: #3a2613 !important;
}

html.dark .bg-red-50 {
    background-color: #2a1416 !important;
}

html.dark .bg-red-100 {
    background-color: #3a1c1f !important;
}

html.dark .bg-rose-50 {
    background-color: #2a141d !important;
}

html.dark .bg-rose-100 {
    background-color: #3a1c28 !important;
}

html.dark .bg-pink-50 {
    background-color: #2a1620 !important;
}

/* Translucent light surfaces keep some see-through. */
html.dark .bg-blue-50\/50,
html.dark .bg-blue-50\/60,
html.dark .bg-blue-50\/70 {
    background-color: rgba(16, 35, 63, 0.75) !important;
}

html.dark .bg-blue-100\/60,
html.dark .bg-blue-100\/70 {
    background-color: rgba(21, 47, 82, 0.75) !important;
}

html.dark .bg-gray-50\/60,
html.dark .bg-gray-50\/70 {
    background-color: rgba(15, 23, 42, 0.75) !important;
}

html.dark .bg-slate-50\/90 {
    background-color: rgba(15, 23, 42, 0.92) !important;
}

html.dark .bg-amber-50\/80,
html.dark .bg-amber-50\/90 {
    background-color: rgba(42, 33, 16, 0.92) !important;
}

html.dark .bg-emerald-50\/90 {
    background-color: rgba(10, 42, 31, 0.92) !important;
}

html.dark .bg-indigo-50\/60 {
    background-color: rgba(23, 26, 61, 0.75) !important;
}

html.dark .bg-white\/70 {
    background-color: rgba(17, 28, 48, 0.75) !important;
}

html.dark .bg-white\/80 {
    background-color: rgba(17, 28, 48, 0.85) !important;
}

html.dark .bg-white\/90 {
    background-color: rgba(17, 28, 48, 0.92) !important;
}

/* Light gradient panels: drop the gradient so the dark surface shows. */
html.dark .from-blue-50,
html.dark .from-blue-100,
html.dark .from-sky-50,
html.dark .from-sky-100,
html.dark .from-green-50,
html.dark .from-pink-50,
html.dark .from-purple-50,
html.dark .from-indigo-50 {
    background-image: none !important;
    background-color: #111c30 !important;
}

/* Hover states keep responding. */
html.dark .hover\:bg-blue-50:hover,
html.dark .hover\:bg-blue-100:hover {
    background-color: #152f52 !important;
}

html.dark .hover\:bg-blue-200:hover {
    background-color: #1c3a63 !important;
}

html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-gray-100:hover {
    background-color: #1e293b !important;
}

html.dark .hover\:bg-gray-200:hover {
    background-color: #334155 !important;
}

html.dark .hover\:bg-green-50:hover {
    background-color: #0c2a16 !important;
}

html.dark .hover\:bg-green-200:hover {
    background-color: #133a1e !important;
}

html.dark .hover\:bg-indigo-100:hover {
    background-color: #1e2150 !important;
}

html.dark .hover\:bg-indigo-200:hover {
    background-color: #262a63 !important;
}

/* Borders. */
html.dark .border-gray-100,
html.dark .border-slate-100 {
    border-color: #1e293b !important;
}

html.dark .border-gray-200,
html.dark .border-slate-200 {
    border-color: #24344f !important;
}

html.dark .border-gray-300,
html.dark .border-slate-300,
html.dark .border-slate-400 {
    border-color: #334155 !important;
}

html.dark .border-gray-400 {
    border-color: #475569 !important;
}

html.dark .border-blue-100 {
    border-color: #1c2f4f !important;
}

html.dark .border-blue-200 {
    border-color: #24406b !important;
}

html.dark .border-blue-300 {
    border-color: #2f5588 !important;
}

html.dark .border-indigo-200,
html.dark .border-purple-200,
html.dark .border-purple-300 {
    border-color: #3a2f66 !important;
}

html.dark .border-green-200,
html.dark .border-emerald-200,
html.dark .border-emerald-100 {
    border-color: #1e4a30 !important;
}

html.dark .border-amber-200,
html.dark .border-amber-300,
html.dark .border-yellow-200,
html.dark .border-orange-200 {
    border-color: #5a4516 !important;
}

html.dark .border-red-100,
html.dark .border-red-300,
html.dark .border-rose-200 {
    border-color: #5a262a !important;
}

html.dark .border-teal-200,
html.dark .border-cyan-200,
html.dark .border-sky-200 {
    border-color: #20505c !important;
}

html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-blue-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-blue-50 > :not([hidden]) ~ :not([hidden]) {
    border-color: #24344f !important;
}

/* ==========================================================================
   SHARED HEADER TIDY-UP
   --------------------------------------------------------------------------
   Applies to every page that tags its header with .site-header. The old
   markup stacked Tailwind gaps on top of style.css's per-item margin-left,
   which is what made the bar look cluttered; here the flex gap is the only
   spacing and the brand title is pinned to one line.
   ========================================================================== */

.site-header {
    background-color: #2563eb;
    padding: 0.6rem 0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-header h1 {
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.2;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.site-header h1 a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.site-header h1 a:hover {
    text-decoration: underline;
}

.site-header h1 .page-brand-logo,
.site-header h1 img {
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 0.9rem;
}

/* style.css gives every nav item its own margin-left; the flex gap above is
   the only spacing inside the bar, so the extra margin is removed. */
.site-header .nav-link,
.site-header .nav-mega-menu,
.site-header .header-nav-link {
    margin-left: 0;
}

.site-header .nav-link,
.site-header .nav-mega-toggle,
.site-header .header-nav-link {
    padding: 0.4rem 0.7rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.375rem;
    white-space: nowrap;
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.site-header .nav-link:hover,
.site-header .nav-mega-toggle:hover,
.site-header .header-nav-link:hover,
.site-header .header-nav-link.active {
    background-color: rgba(255, 255, 255, 0.18);
    text-decoration: none;
}

.site-header .nav-search-wrap {
    flex: 0 1 220px;
    min-width: 150px;
}

.site-header .nav-search-input {
    max-width: 100%;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

/* Icon-only dark mode toggle, shared by every page. */
.site-header .dark-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.site-header .dark-toggle:hover {
    background-color: rgba(255, 255, 255, 0.24);
}

@media (max-width: 768px) {
    .site-header {
        position: relative;
    }

    .site-header .container {
        flex-direction: column;
        gap: 0.6rem;
    }

    .site-header nav {
        width: 100%;
        justify-content: center;
    }

    .site-header .nav-search-wrap {
        flex: 1 1 auto;
        width: 100%;
    }

    .site-header .dark-toggle {
        position: absolute;
        top: 0.6rem;
        right: 0.75rem;
    }
}

/* Mobile Improvements */
@media (max-width: 640px) {

    header .container,
    footer .container,
    main.container,
    section.container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .shadow-lg,
    .shadow-md,
    .shadow-inner {
        box-shadow: none !important;
    }

    .rounded-lg,
    .rounded-md {
        border-radius: 0.5rem !important;
    }

    .grid-cols-2,
    .grid-cols-3,
    .md\:grid-cols-2,
    .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    .flex-row,
    .md\:flex-row {
        flex-direction: column !important;
    }

    .p-8,
    .p-6,
    .p-4 {
        padding: 1rem !important;
    }

    .py-8,
    .py-4,
    .px-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .mb-4,
    .mb-6,
    .mb-8 {
        margin-bottom: 1rem !important;
    }

    .mt-8,
    .mt-12 {
        margin-top: 1rem !important;
    }

    .w-full,
    .max-w-2xl,
    .max-w-xl {
        max-width: 100% !important;
    }

    .text-4xl {
        font-size: 2rem !important;
    }

    .text-2xl {
        font-size: 1.25rem !important;
    }

    .text-xl {
        font-size: 1.1rem !important;
    }

    .rounded-md,
    .rounded-lg {
        border-radius: 0.5rem !important;
    }

    .dropzone {
        min-height: 80px !important;
    }

    .draggable {
        min-width: 90px !important;
        font-size: 1rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    input[type="number"],
    input[type="password"] {
        font-size: 1rem !important;
        padding: 0.5rem !important;
    }

    button,
    .nav-link,
    a.inline-block {
        font-size: 1rem !important;
        padding: 0.5rem 1rem !important;
    }

    .resource-card {
        margin-bottom: 1rem !important;
    }

    #interactive-map #map-canvas {
        height: 350px !important;
        background-size: cover !important;
    }

    #interactive-map .draggable {
        font-size: 0.95rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

/* Mobile Mega Menu Improvements */
@media (max-width: 768px) {
    .nav-mega-panel {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        overflow-y: auto;
        background-color: #1e40af;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        z-index: 9999;
        padding: 4rem 1rem 1rem 1rem;
        margin: 0;
        border: none;
        display: none !important;
    }

    .nav-mega-panel[style*="display: block"] {
        display: block !important;
    }

    .mega-menu-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem;
        margin: 0;
        grid-template-columns: 1fr !important;
    }

    .mega-menu-column {
        width: 100% !important;
        background-color: white;
        border-radius: 0.5rem;
        padding: 1rem;
        margin-bottom: 0;
        text-align: right;
    }

    .mega-menu-column h3 {
        font-size: 1rem;
        font-weight: 700;
        margin-bottom: 0.75rem;
        color: #1e40af;
        border-bottom: 2px solid #3b82f6;
        padding-bottom: 0.5rem;
        text-align: right;
    }

    .mega-menu-column a {
        display: block;
        padding: 0.75rem 0.5rem;
        font-size: 0.95rem;
        color: #374151;
        border-radius: 0.25rem;
        transition: background-color 0.2s;
        text-align: right;
    }

    .mega-menu-column a:hover {
        background-color: #eff6ff;
        color: #1e40af;
    }

    .nav-mega-toggle {
        cursor: pointer;
        padding: 0.5rem 1rem;
        background-color: rgba(255, 255, 255, 0.2);
        border-radius: 0.375rem;
        display: inline-block;
        font-weight: 600;
        color: white;
    }

    .nav-mega-toggle::after {
        content: ' ▼';
        font-size: 0.75rem;
        margin-left: 0.25rem;
    }

    .nav-mega-menu.active .nav-mega-toggle::after {
        content: ' ▲';
    }

    .mega-menu-close {
        position: fixed;
        top: 1rem;
        right: 1rem;
        background-color: white;
        color: #1e40af;
        border: 2px solid #1e40af;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        font-size: 1.75rem;
        cursor: pointer;
        z-index: 10001;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        padding: 0;
        line-height: 1;
        font-weight: bold;
        touch-action: manipulation;
        -webkit-user-select: none;
        user-select: none;
        pointer-events: auto;
    }

    .mega-menu-close:active,
    .mega-menu-close:focus {
        background-color: #f0f0f0;
        outline: none;
    }

    .mega-menu-close:hover {
        background-color: #eff6ff;
    }

    img {
        max-width: 100% !important;
        height: auto !important;
        display: block;
    }

    iframe {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }

    .my-4 img {
        max-width: 100%;
        height: auto;
    }

    h2 {
        font-size: 1.75rem !important;
    }

    .quiz-container {
        padding: 1rem !important;
        margin-bottom: 1.5rem;
    }

    .quiz-container p {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .quiz-container label {
        padding: 0.5rem 0;
        font-size: 0.9rem;
        display: block;
    }

    .quiz-container input[type="radio"],
    .quiz-container input[type="checkbox"] {
        margin-right: 0.75rem;
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

    .quiz-container input[type="text"] {
        font-size: 1rem !important;
        padding: 0.75rem !important;
        min-height: 44px;
    }

    button {
        min-height: 44px;
        font-size: 1rem;
        padding: 0.75rem 1.5rem !important;
    }

    select {
        font-size: 1rem;
        padding: 0.75rem !important;
        min-height: 44px;
    }

    .content-block {
        padding: 1rem !important;
        margin-bottom: 1.5rem;
    }

    h3 {
        font-size: 1.5rem !important;
    }

    h4 {
        font-size: 1.25rem !important;
    }

    h5 {
        font-size: 1.1rem !important;
    }

    p {
        font-size: 0.95rem;
    }

    ul,
    ol {
        margin-left: 1rem !important;
    }

    li {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .space-y-6>*+* {
        margin-top: 1.25rem;
    }

    .flex.max-w-7xl {
        flex-direction: column;
    }

    .hidden.lg\:block {
        display: none !important;
    }

    /* These three are deliberate overrides for the legacy per-page headers
       (page-specific Tailwind markup). The shared .site-header bar manages
       its own typography and spacing, so it must not inherit them - the
       bare `header` selectors below would otherwise win on source order and
       blow the brand back up to 1.5rem with a full-width row. */
    header:not(.site-header) .flex {
        flex-wrap: wrap;
        gap: 1rem;
    }

    header:not(.site-header) h1 {
        font-size: 1.5rem;
        flex: 0 0 100%;
    }

    header nav {
        font-size: 0.875rem;
    }

    header button {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    h2 {
        font-size: 1.5rem !important;
    }

    .quiz-container {
        padding: 0.75rem !important;
    }

    button {
        width: 100%;
        padding: 0.75rem !important;
    }

    select {
        font-size: 0.95rem;
    }

    .flex.items-center.gap-4 {
        flex-direction: column;
        gap: 1rem;
    }

    img {
        max-width: 100% !important;
    }

    /* Scoped embeds that opt in via .embed-container keep their own height;
       fixed-height 300px squashed the interactive boat diagram to unusable.
       Iframes still default to 300px so nothing else regresses. */
    iframe:not(.embed-container iframe) {
        height: 300px !important;
    }
}

/* Interactive embeds (e.g. the boat diagram iframe).
   The inner document needs ~900px, so give it room rather than the
   300px the global mobile iframe rule used to force. */
.embed-container {
    width: 100%;
}

.embed-container iframe {
    display: block;
    width: 100%;
    height: 900px;
    border: 0;
}

@media (max-width: 768px) {
    .embed-container iframe {
        height: 640px;
    }
}

/* Desktop mega menu - hide close button */
@media (min-width: 769px) {
    .mega-menu-close {
        display: none !important;
    }
}

/* Back to Top Button */
#backToTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#backToTop.show {
    opacity: 1;
    visibility: visible;
}

#backToTop:hover {
    background-color: #1d4ed8;
}

@media (max-width: 768px) {
    #backToTop {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Responsive Images & Iframes - Global */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

iframe {
    max-width: 100%;
    width: 100%;
    height: auto;
}

.my-4 img,
.my-6 img {
    max-width: 100%;
    height: auto;
}

/* Mobile Improvements */
@media (max-width: 640px) {

    header .container,
    footer .container,
    main.container,
    section.container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .shadow-lg,
    .shadow-md,
    .shadow-inner {
        box-shadow: none !important;
    }

    .rounded-lg,
    .rounded-md {
        border-radius: 0.5rem !important;
    }

    .grid-cols-2,
    .grid-cols-3,
    .md\:grid-cols-2,
    .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }

    .flex-row,
    .md\:flex-row {
        flex-direction: column !important;
    }

    .p-8,
    .p-6,
    .p-4 {
        padding: 1rem !important;
    }

    .py-8,
    .py-4,
    .px-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .mb-4,
    .mb-6,
    .mb-8 {
        margin-bottom: 1rem !important;
    }

    .mt-8,
    .mt-12 {
        margin-top: 1rem !important;
    }

    .w-full,
    .max-w-2xl,
    .max-w-xl {
        max-width: 100% !important;
    }

    .text-4xl {
        font-size: 2rem !important;
    }

    .text-2xl {
        font-size: 1.25rem !important;
    }

    .text-xl {
        font-size: 1.1rem !important;
    }

    .rounded-md,
    .rounded-lg {
        border-radius: 0.5rem !important;
    }

    .dropzone {
        min-height: 80px !important;
    }

    .draggable {
        min-width: 90px !important;
        font-size: 1rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    input[type="number"],
    input[type="password"] {
        font-size: 1rem !important;
        padding: 0.5rem !important;
    }

    button,
    .nav-link,
    a.inline-block {
        font-size: 1rem !important;
        padding: 0.5rem 1rem !important;
    }

    .resource-card {
        margin-bottom: 1rem !important;
    }

    #interactive-map #map-canvas {
        height: 350px !important;
        background-size: cover !important;
    }

    #interactive-map .draggable {
        font-size: 0.95rem !important;
        padding: 0.25rem 0.5rem !important;
    }
}

/* Auth Styles */
#auth-container {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

/* Hide header navigation buttons when auth container (login modal) is active/visible */
#auth-container:not(.hidden) ~ header .header-nav-link,
#auth-container:not(.hidden) ~ header .nav-mega-menu,
#auth-container:not(.hidden) ~ header .nav-mega-toggle,
#auth-container:not(.hidden) ~ header .nav-link,
#auth-container:not(.hidden) ~ nav .header-nav-link,
#auth-container:not(.hidden) ~ nav .nav-mega-toggle,
body:has(#auth-container:not(.hidden)) header .header-nav-link,
body:has(#auth-container:not(.hidden)) header .nav-mega-menu,
body:has(#auth-container:not(.hidden)) header .nav-mega-toggle,
body:has(#auth-container:not(.hidden)) header .nav-link,
body:has(#auth-container:not(.hidden)) header nav,
body.auth-modal-open header .header-nav-link,
body.auth-modal-open header .nav-mega-menu,
body.auth-modal-open header .nav-mega-toggle,
body.auth-modal-open header .nav-link,
body.auth-modal-open header nav {
    display: none !important;
}

/* ...but the account controls live inside the nav on the instructor pages,
   and those must stay usable with the login modal open (Logout is one of
   them). The :not(.hidden) guard keeps the JS-controlled show/hide intact,
   so these only override the `header nav { display: none }` above. */
body.auth-modal-open header nav .current-user-display:not(.hidden),
body.auth-modal-open header nav .logout-btn:not(.hidden),
body:has(#auth-container:not(.hidden)) header nav .current-user-display:not(.hidden),
body:has(#auth-container:not(.hidden)) header nav .logout-btn:not(.hidden) {
    display: inline-flex !important;
}

#auth-form {
    background: white;
    box-sizing: border-box;
    width: min(100%, 28rem);
    max-width: 28rem;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 0.875rem;
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.3);
}

#auth-heading {
    margin-bottom: 1.25rem;
}

#auth-form.is-signup #login-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

#auth-form.is-signup #login-form > * + * {
    margin-top: 0 !important;
}

#signup-school-wrapper fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

#signup-school-list label {
    min-height: 2.25rem;
}

#pending-approval {
    box-sizing: border-box;
    padding: 1rem;
    /* Respect notches and the home indicator so the card is never clipped by
       the device chrome. */
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
}

.pending-approval-card {
    box-sizing: border-box;
    width: min(100%, 36rem);
    padding: 1.5rem;
    /* The markup leans on Tailwind's arbitrary-value class max-h-[90vh], which
       this build does not ship, so the card had no height cap. On short/phone
       screens it grew taller than the viewport, the flex centring pushed its
       top (clock icon + "Account Pending Approval" title) off-screen, and there
       was no way to scroll back up to it. Cap it and scroll the card itself. */
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 480px) {
    #auth-form {
        padding: 1.125rem;
    }

    .pending-approval-card {
        padding: 1.25rem;
    }

    /* Tighter vertical rhythm so less scrolling is needed to reach the actions. */
    .pending-approval-card > svg {
        width: 3rem;
        height: 3rem;
        margin-bottom: 0.5rem;
    }

    .pending-approval-card h2 {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    .pending-approval-card > p {
        font-size: 0.95rem;
    }

    /* Every action becomes a full-width, easy-to-tap row. The affiliate link is
       an <a>, so the global "button { width:100% }" rule misses it. */
    #pending-approval .pending-approval-card > a,
    #pending-approval #pending-school-apply-btn,
    #pending-approval #pending-logout-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
}

#auth-form input,
#auth-form button,
#auth-form select,
#auth-form textarea {
    pointer-events: auto !important;
    opacity: 1 !important;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   .site-header — FINAL OVERRIDES
   --------------------------------------------------------------------------
   Kept at the very end of the file on purpose. Much of this project is styled
   with broad legacy selectors (bare `header h1`, `header .flex`, `header nav`)
   that were written for the old two-row, per-page Tailwind headers. Those
   selectors have the same specificity as the .site-header rules but sit
   earlier in the file, so source order would otherwise let them win and undo
   the tidy-up. Re-asserting the bar here keeps it stable regardless of what
   the legacy blocks do.
   ========================================================================== */

/* NOTE UNITS: this project sets `html { font-size: 18px }` (see the base font
   block above), so 1rem = 18px, not 16px. Every size in this bar is written
   in px to mean exactly what it says - do not convert these to rem. */
.site-header h1 {
    font-size: 17px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0;
    /* flex:0 0 100% in the legacy mobile block would push the brand onto its
       own line; keep it a single inline-block that sits beside the nav. */
    flex: 0 0 auto;
    white-space: nowrap;
}

.site-header h1 a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: #fff;
    text-decoration: none;
}

.site-header h1 a:hover {
    text-decoration: underline;
}

.site-header h1 img,
.site-header h1 .page-brand-logo {
    width: 30px !important;
    height: 30px !important;
    border-radius: 6px;
    object-fit: cover;
    flex: 0 0 auto;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
    font-size: 14px;
    flex: 1 1 auto;
    min-width: 0;
}

.site-header .nav-link,
.site-header .header-nav-link,
.site-header .nav-mega-toggle {
    font-size: 14px;
    padding: 6px 10px;
    min-height: 32px;
    border-radius: 6px;
}

/* The active page marker is a quiet tint, not a solid slab - the nav should
   read as one strip rather than a row of competing buttons. */
.site-header .header-nav-link.active,
.site-header .nav-link.active {
    background: rgba(255, 255, 255, 0.22);
    font-weight: 600;
}

.site-header .nav-search-wrap {
    flex: 0 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 260px;
}

.site-header .nav-search-input {
    width: 100%;
    max-width: 100%;
    padding: 5px 9px;
    font-size: 13px;
}

.site-header .current-user-display {
    order: 2;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    padding: 4px 9px;
    border-radius: 5px;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 6px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* The instructor bar carries more controls (account + logout), so its brand
   is trimmed a little further to keep everything on one line. */
.site-header h1 a {
    gap: 8px;
}

/* Logout is a secondary action, not an alert: outlined rather than filled
   red, so it stops shouting over the navigation. */
.site-header .logout-btn {
    order: 3;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    min-height: 30px;
    margin-left: 2px;
    color: #fff;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.45);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-header .logout-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.7);
}

.site-header .logout-btn:active {
    background: rgba(255, 255, 255, 0.26);
}

@media (max-width: 768px) {
    .site-header {
        position: relative;
    }

    .site-header h1 {
        font-size: 16px;
    }

    .site-header nav {
        width: 100%;
        justify-content: center;
    }

    .site-header .nav-search-wrap {
        flex: 1 1 auto;
        width: 100%;
    }

    .site-header .dark-toggle {
        position: absolute;
        top: 0.6rem;
        right: 0.75rem;
    }
}

/* ==========================================================================
   INSTRUCTOR HEADER — TWO-ROW LAYOUT
   --------------------------------------------------------------------------
   The instructor bar carries more controls than the public pages (brand,
   nav, school selector, search, account, logout, dark mode). Cramming them
   onto one line made the bar tall and busy, so it is split:

     row 1  brand ............................. navigation
     row 2  school selector ... search ....... account, logout, dark mode

   Both rows are plain flex containers, so a control can never be pushed onto
   a line of its own the way the JS-injected school selector used to be.
   ========================================================================== */

.site-header .header-row-primary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    /* nowrap is deliberate: the secondary row is a sibling of this one (not a
       child), so this row must never grow to accommodate it. */
    flex-wrap: nowrap;
}

/* Pages that opt into the two-row header need the container to be a normal
   block, not a flex row. As a flex child, the secondary row was being laid
   out beside row 1 instead of below it. `.header-row-primary` is the opt-in
   marker, so scope on that. */
.site-header .container:has(> .header-row-primary) {
    display: block;
}

.site-header .header-row-primary h1 {
    flex: 0 0 auto;
}

.site-header .header-row-primary nav {
    flex: 0 1 auto;
    justify-content: flex-end;
    min-width: 0;
}

/* The secondary row is a SIBLING of .header-row-primary, directly inside
   the container - not nested within it. */
.site-header .container > .header-row-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    /* A short divider separates the two rows so the bar reads as one
       component with two tiers, not two competing bars. */
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.site-header .header-school-slot,
.site-header .header-search-slot {
    display: flex;
    align-items: center;
}

.site-header .header-search-slot {
    flex: 0 1 260px;
    min-width: 140px;
}

.site-header .header-row-secondary-end {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* The school selector is created by js/instructors.js. It used to carry
   Tailwind utility classes, which fought the header styling and rendered as
   a plain white native control that broke the blue bar's rhythm. It now
   inherits the header's own control styling. */
.site-header .school-selector {
    min-width: 150px;
    max-width: 220px;
    height: 30px;
    padding: 0 28px 0 10px;
    font-size: 13px;
    line-height: 28px;
    font-weight: 500;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.14);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M4.5 6.5 8 10l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    text-overflow: ellipsis;
}

.site-header .school-selector:hover {
    background-color: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.45);
}

.site-header .school-selector:focus {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 1px;
}

/* The native dropdown list itself is rendered by the OS, so it needs light
   text on a dark panel regardless of the page theme. */
.site-header .school-selector option {
    background-color: #1e3a8a;
    color: #fff;
}

@media (max-width: 768px) {
    .site-header .header-row-primary {
        flex-wrap: wrap;
        gap: 8px;
    }

    .site-header .container > .header-row-secondary {
        gap: 8px;
        margin-top: 6px;
        padding-top: 6px;
    }

    /* The school selector is the primary control on this page, so it keeps a
       full-width row of its own - but it is capped in height so it reads as a
       control rather than a slab. */
    .site-header .header-school-slot {
        flex: 1 1 100%;
        order: 1;
    }

    /* The search field is secondary on mobile and was pushing the school
       selector off-screen; give it its own row below. */
    .site-header .header-search-slot {
        flex: 1 1 100%;
        max-width: 100%;
        order: 2;
    }

    /* On the instructor workspace - the only page that opts into the two-row
       header - drop the search field entirely on phones. It is the least-used
       control there and the school selector plus account row already fill the
       second tier; removing it takes a whole row off the bar. Scoped with :has
       so the shared single-row header (js/site-chrome.js) keeps its search. */
    .site-header .container:has(> .header-row-primary) .header-search-slot {
        display: none;
    }

    .site-header .school-selector {
        max-width: 100%;
        width: 100%;
        min-width: 0;
        height: 44px;
        font-size: 14px;
        line-height: 42px;
        padding: 0 32px 0 12px;
        background-position: right 10px center;
    }

    /* Account controls share the final row instead of each claiming one:
       the email sits on the left and Logout stays a compact button rather
       than stretching to full width. */
    .site-header .header-row-secondary-end {
        flex: 1 1 100%;
        order: 3;
        margin-left: 0;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 10px;
        min-width: 0;
    }

    .site-header .nav-search-wrap {
        max-width: 100%;
    }
}
/* ==========================================================================
   .site-footer — SHARED FOOTER LAYOUT
   --------------------------------------------------------------------------
   The old footers were a single flex row with the copyright, five links and a
   contribute button all jostling for space, and the links were plain inline
   anchors with no rhythm. This lays it out as a brand column beside three link
   columns, with a quiet bottom bar for the copyright. Kept at the very end so
   it wins against the broad legacy `footer` selectors above.

   NOTE UNITS: `html { font-size: 18px }` (see the base block at the top), so
   1rem = 18px. Sizes here are written in px to mean exactly what they say.
   ========================================================================== */

.site-footer {
    background: linear-gradient(90deg, #1d4ed8, #1e40af 45%, #0f172a);
    color: #e2e8f0;
    margin-top: 4rem;
    /* Extra bottom padding so the fixed contact button (bottom-left) never
       sits on top of the copyright line. */
    padding: 2.5rem 1rem 3.5rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.site-footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(240px, 1.6fr) 2fr;
    gap: 2rem;
}

.site-footer-brand {
    max-width: 340px;
}

.site-footer-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #fff;
}

.site-footer-tagline {
    margin: 0.5rem 0 1rem;
    font-size: 13px;
    line-height: 1.55;
    color: #cbd5e1;
}

.site-footer-contribute {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 9999px;
    background: linear-gradient(90deg, #fde047, #facc15 50%, #eab308);
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

.site-footer-contribute:hover {
    transform: translateY(-1px);
}

.site-footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1fr));
    gap: 1.5rem 2rem;
}

.site-footer-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.site-footer-col h3 {
    margin: 0 0 0.5rem;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #93c5fd;
}

.site-footer-col a {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
    padding: 2px 0;
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer-col a:hover {
    color: #fff;
    text-decoration: underline;
}

.site-footer-bottom {
    max-width: 1120px;
    margin: 2rem auto 0;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    font-size: 12px;
    color: #94a3b8;
}

.site-footer-copy {
    margin: 0;
}

.site-footer-copy a {
    color: #bfdbfe;
    text-decoration: underline;
}

.site-footer-copy a:hover {
    color: #fff;
}

/* The Google review link is injected by js/header-branding.js as a direct
   child of <footer>. Give it its own centred line under the bottom bar so it
   never collides with the copyright. */
.site-footer .site-review-footer-item {
    display: block;
    max-width: 1120px;
    margin: 1rem auto 0;
    text-align: center;
}

.site-footer .site-review-link {
    color: #cbd5e1;
    font-size: 13px;
}

.site-footer .site-review-link:hover {
    color: #fcd34d;
}

.site-footer {
    position: relative;
}

@media (max-width: 768px) {
    .site-footer {
        /* Clear the fixed contact button, which floats at
           `bottom: calc(4.75rem + safe-area)` on small screens. */
        padding-bottom: calc(6.5rem + env(safe-area-inset-bottom));
    }

    .site-footer-inner {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }

    .site-footer-brand {
        max-width: 100%;
    }

    .site-footer-links {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }

    .site-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .site-footer-links {
        grid-template-columns: 1fr;
    }
}

/* Dark mode: the footer is already dark; just deepen it to match the page. */
html.dark .site-footer {
    background: linear-gradient(135deg, #0f1b30, #111c30);
}

/* ==========================================================================
   Moved keep-light rules. These intentionally sit at the very END of the file:
   they share specificity with the utility remaps above and use !important, so
   source order decides. Reading surfaces (tables, quizzes, code) must stay
   light even when they also carry a remapped utility class such as .bg-white.
   ========================================================================== */
html.dark pre,
html.dark pre[class],
html.dark code,
html.dark .quiz-container,
html.dark .quiz-container[class],
html.dark .keep-light,
html.dark iframe {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

html.dark pre,
html.dark code {
    color: #0f172a !important;
}

/* Tables go DARK with the rest of the page. They used to be held white, which
   left a bright slab in the middle of every dark dashboard - and the inputs,
   selects and status chips inside them were then dark-on-white, with their
   text forced to inherit the table's dark ink so the values were unreadable. */
html.dark table,
html.dark table[class] {
    background-color: #111c30 !important;
    color: #e2e8f0 !important;
    border-color: #24344f !important;
}

html.dark table th,
html.dark table td,
html.dark th[class],
html.dark td[class] {
    background-color: transparent !important;
    border-color: #24344f !important;
}

html.dark table td {
    color: #e2e8f0;
}

html.dark table th {
    color: #cbd5e1;
}

html.dark table thead,
html.dark thead[class] {
    background-color: #16233b !important;
}

html.dark table tbody,
html.dark table tr,
html.dark tbody[class],
html.dark tr[class] {
    background-color: transparent !important;
}

html.dark table tbody tr:nth-child(even) {
    background-color: rgba(148, 163, 184, 0.04) !important;
}

html.dark table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.10) !important;
}

/* Sticky table headers must stay opaque or rows scroll visibly behind them. */
html.dark thead.sticky,
html.dark thead .sticky,
html.dark th.sticky {
    background-color: #16233b !important;
}

/* Prose-style tables on the notes pages (.table-container). */
html.dark .table-container {
    background-color: #111c30 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    border: 1px solid #1e2a44;
}

html.dark .table-container th {
    background-color: #172554 !important;
    color: #dbeafe;
}

html.dark .table-container td {
    color: #e2e8f0;
}

html.dark table a {
    color: #93c5fd;
}

/* Form controls inside tables (limits, level pickers, course selectors). */
html.dark table input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.dark table select,
html.dark table textarea {
    background-color: #0b1424 !important;
    color: #f1f5f9 !important;
    border-color: #334155 !important;
}

html.dark pre a,
html.dark .keep-light a {
    color: #1d4ed8;
}

html.dark pre *:not(.text-white),
html.dark code *:not(.text-white),
html.dark .quiz-container *:not(.text-white),
html.dark .keep-light *:not(.text-white) {
    color: inherit !important;
}

html.dark .quiz-container input,
html.dark .quiz-container select,
html.dark .quiz-container textarea {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #cbd5e1 !important;
}

/* Images and video are never inverted - they are content, not chrome. */
html.dark img,
html.dark video,
html.dark svg {
    filter: none !important;
}

/* Opt a subtree back to the light palette. */
html.dark [data-theme-keep-light] {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

html.dark [data-theme-keep-light] *:not(.text-white) {
    color: inherit !important;
}

/* ==========================================================================
   Bespoke component classes (declared in each page's inline <style>) that use
   light surfaces / dark text. Tailwind utilities are handled by the remaps
   above; these are the hand-written class names the remaps can't see.
   ========================================================================== */

/* Injected "Course Pathways" block (js/header-branding.js) */
html.dark .course-pathways {
    background: #152f52 !important;
    border-color: #1e3a8a !important;
}

html.dark .course-pathways h3 {
    color: #bfdbfe !important;
}

html.dark .course-pathways p {
    color: #cbd5e1 !important;
}

html.dark .course-pathways-links a {
    background: #1e3a8a !important;
    color: #dbeafe !important;
}

html.dark .course-pathways-links a:hover {
    background: #1d4ed8 !important;
}

/* Ad slots */
html.dark .ad-unit-wrap,
html.dark .inline-ad-wrap,
html.dark .sidebar-ad-wrap {
    background: #111c30 !important;
    border-color: #1e2a44 !important;
}

html.dark .ad-unit-label {
    color: #94a3b8 !important;
}

/* Hero panels */
html.dark .landing-hero,
html.dark .school-hero,
html.dark .create-hero {
    background: linear-gradient(180deg, #0f1b30 0%, #111c30 100%) !important;
    border-color: #1e2a44 !important;
}

html.dark .landing-value-card {
    background: rgba(17, 28, 48, 0.8) !important;
    border-color: #1e2a44 !important;
}

html.dark .school-step {
    border-left-color: #3b82f6 !important;
}

html.dark .school-card {
    background: rgba(17, 28, 48, 0.92) !important;
    border-color: #1e2a44 !important;
}

html.dark .pricing-card {
    background: #111c30 !important;
    border-color: #1e2a44 !important;
}

html.dark .pricing-card.featured {
    background: linear-gradient(180deg, #111c30 0%, #152f52 100%) !important;
    border-color: #3b82f6 !important;
}

/* Generic cards / panels used by the app pages */
html.dark .card,
html.dark .intro,
html.dark .order,
html.dark .result,
html.dark .part-info-box,
html.dark .course-card,
html.dark .demo-card,
html.dark .demo-dashboard-panel,
html.dark .demo-modal-panel,
html.dark .demo-section-nav,
html.dark .table-wrap,
html.dark .gate,
html.dark .entry-card,
html.dark .tpl-modal,
html.dark .help-tip,
html.dark .image-action-btn {
    background-color: #111c30 !important;
    border-color: #1e2a44 !important;
}

/* Dark-mode toast notifications: elevated surface, crisp high-contrast text,
   and preserved semantic left accent borders + icon colours. */
html.dark .toast,
html.dark #toast-container .toast {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
    border-left: 4px solid #3b82f6 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.48), 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

html.dark .toast.success,
html.dark #toast-container .toast.success {
    border-left-color: #22c55e !important;
}

html.dark .toast.success .toast-icon,
html.dark #toast-container .toast.success .toast-icon {
    color: #4ade80 !important;
}

html.dark .toast.error,
html.dark #toast-container .toast.error {
    border-left-color: #ef4444 !important;
}

html.dark .toast.error .toast-icon,
html.dark #toast-container .toast.error .toast-icon {
    color: #f87171 !important;
}

html.dark .toast.warning,
html.dark #toast-container .toast.warning {
    border-left-color: #f59e0b !important;
}

html.dark .toast.warning .toast-icon,
html.dark #toast-container .toast.warning .toast-icon {
    color: #fbbf24 !important;
}

html.dark .toast.info,
html.dark #toast-container .toast.info {
    border-left-color: #3b82f6 !important;
}

html.dark .toast.info .toast-icon,
html.dark #toast-container .toast.info .toast-icon {
    color: #60a5fa !important;
}

html.dark .toast .toast-message,
html.dark #toast-container .toast .toast-message {
    color: #f1f5f9 !important;
    font-weight: 500;
}

html.dark .toast .toast-message a,
html.dark #toast-container .toast .toast-message a {
    color: #93c5fd !important;
}

html.dark .toast .toast-close,
html.dark #toast-container .toast .toast-close {
    color: #94a3b8 !important;
    opacity: 0.85;
}

html.dark .toast .toast-close:hover,
html.dark #toast-container .toast .toast-close:hover {
    color: #f8fafc !important;
    opacity: 1;
}

/* Body copy and headings inside those dark cards need to match. */
html.dark .card p,
html.dark .intro p,
html.dark .order p,
html.dark .result p,
html.dark .course-card p {
    color: #cbd5e1 !important;
}

html.dark .card h2,
html.dark .card h3,
html.dark .intro h2,
html.dark .order h2,
html.dark .course-card h2,
html.dark .demo-modal-panel h3 {
    color: #f1f5f9 !important;
}

/* "Coming soon" holding pages */
html.dark .coming-soon {
    background: rgba(17, 28, 48, 0.9) !important;
    color: #e2e8f0 !important;
}

html.dark .demo-bar {
    background-color: #1e2a44 !important;
}

html.dark .demo-section-nav a,
html.dark .demo-muted {
    color: #cbd5e1 !important;
}

html.dark .demo-drop-zone {
    background: rgba(17, 28, 48, 0.65) !important;
    border-color: #3b82f6 !important;
}

html.dark .demo-drag-student,
html.dark .demo-action.secondary {
    background: #152f52 !important;
    color: #bfdbfe !important;
    border-color: #1e3a8a !important;
}

html.dark .demo-action-bar {
    background: rgba(17, 28, 48, 0.9) !important;
    border-color: #1e2a44 !important;
}

html.dark .demo-readonly {
    background: #2a2116 !important;
    border-color: #5b4a1c !important;
    color: #fcd34d !important;
}

/* Leaflet injects its own attribution control with a light background. */
html.dark .leaflet-control-attribution {
    background: rgba(17, 28, 48, 0.85) !important;
    color: #cbd5e1 !important;
}

html.dark .leaflet-control-attribution a {
    color: #93c5fd !important;
}

/* Inline accent colours (e.g. the spinnaker-part legends) are too dark to read
   once their panel background is remapped, so lighten the common ones. */
html.dark [style*="#1d4ed8"] {
    color: #93c5fd !important;
}

html.dark [style*="#d97706"] {
    color: #fcd34d !important;
}

html.dark [style*="#059669"] {
    color: #6ee7b7 !important;
}

/* Form fields written by hand rather than with utilities */
html.dark .field-label {
    color: #bfdbfe !important;
}

html.dark .field-input,
html.dark .field-textarea,
html.dark .input,
html.dark .select {
    background: #0f1b30 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html.dark .field-input:disabled {
    background: #1b2740 !important;
    color: #94a3b8 !important;
}

/* Chips / tags that rely on a light background */
html.dark .count,
html.dark .tag.cancelled {
    background: #1e2a44 !important;
    color: #cbd5e1 !important;
}

html.dark .tag.move {
    background: #1e3a8a !important;
    color: #bfdbfe !important;
}

html.dark .result-snippet mark {
    background: #1e3a8a !important;
    color: #bfdbfe !important;
}

/* Demo sections have colourful light gradients; flatten them to dark surfaces. */
html.dark .demo-section {
    background: #111c30 !important;
    border-color: #1e2a44 !important;
}

html.dark #demo-weather {
    border-left-color: #3b82f6 !important;
}

/* Showcase tables follow the dark table palette above. */
html.dark .demo-shell .demo-section table,
html.dark .demo-table {
    background-color: #111c30 !important;
}

html.dark .demo-table th {
    background: #16233b !important;
    color: #bfdbfe !important;
}

html.dark .demo-table td {
    color: #e2e8f0 !important;
}

/* A table inside a surface that deliberately stays light stays light too. */
html.dark .keep-light table,
html.dark [data-theme-keep-light] table,
html.dark .quiz-container table {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

html.dark .keep-light table thead,
html.dark [data-theme-keep-light] table thead,
html.dark .quiz-container table thead {
    background-color: #f1f5f9 !important;
}

html.dark .keep-light table th,
html.dark .keep-light table td,
html.dark [data-theme-keep-light] table th,
html.dark [data-theme-keep-light] table td,
html.dark .quiz-container table th,
html.dark .quiz-container table td {
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

/* ==========================================================================
   Dark mode polish (site wide)
   ========================================================================== */

/* Light gradient sections that the earlier list missed (e.g. the orange/yellow
   Parent Portal Photos panel, which kept its cream gradient under dark cards). */
html.dark .from-orange-50,
html.dark .from-orange-100,
html.dark .from-yellow-50,
html.dark .from-yellow-100,
html.dark .from-amber-50,
html.dark .from-amber-100,
html.dark .from-emerald-50,
html.dark .from-teal-50,
html.dark .from-cyan-50,
html.dark .from-red-50,
html.dark .from-rose-50,
html.dark .from-slate-50,
html.dark .from-slate-100,
html.dark .from-gray-50,
html.dark .from-gray-100,
html.dark .from-white,
html.dark .from-green-100,
html.dark .from-purple-100,
html.dark .from-indigo-100 {
    background-image: none !important;
    background-color: #111c30 !important;
}

/* Remaining light tints with no dark mapping yet. */
html.dark .bg-pink-100 { background-color: #3a1c2c !important; }
html.dark .bg-violet-50 { background-color: #1f1a3a !important; }
html.dark .bg-violet-100 { background-color: #2a2350 !important; }
html.dark .bg-lime-50 { background-color: #1a2a0c !important; }
html.dark .bg-lime-100 { background-color: #243a12 !important; }
html.dark .bg-orange-200 { background-color: #4a2f14 !important; }
html.dark .bg-amber-200 { background-color: #4a3914 !important; }
html.dark .bg-yellow-200 { background-color: #4a4214 !important; }
html.dark .bg-green-200 { background-color: #1a4a27 !important; }
html.dark .bg-emerald-200 { background-color: #14493a !important; }
html.dark .bg-blue-200 { background-color: #1c3a63 !important; }
html.dark .bg-indigo-200 { background-color: #262a63 !important; }
html.dark .bg-purple-200 { background-color: #352c63 !important; }
html.dark .bg-red-200 { background-color: #4a2226 !important; }
html.dark .bg-orange-50\/50,
html.dark .bg-orange-50\/70 { background-color: rgba(42, 28, 16, 0.75) !important; }

html.dark .border-orange-100,
html.dark .border-orange-300,
html.dark .border-yellow-300,
html.dark .border-amber-100 { border-color: #5a4516 !important; }
html.dark .border-green-100,
html.dark .border-green-300,
html.dark .border-emerald-300 { border-color: #1e4a30 !important; }
html.dark .border-red-200,
html.dark .border-rose-100 { border-color: #5a262a !important; }
html.dark .border-indigo-100,
html.dark .border-purple-100 { border-color: #2c2652 !important; }
html.dark .border-white { border-color: #24344f !important; }

/* Placeholder and disabled text that vanished on dark fields. */
html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #7c8ba1;
    opacity: 1;
}

html.dark input:disabled,
html.dark select:disabled,
html.dark textarea:disabled {
    background-color: #162036;
    color: #8a99b0;
}

html.dark select option,
html.dark select optgroup {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* Checkboxes and radios: keep the native control readable on dark panels. */
html.dark input[type="checkbox"],
html.dark input[type="radio"] {
    accent-color: #3b82f6;
    color-scheme: dark;
}

/* Ad iframes are not reading surfaces: an unfilled slot should not paint a
   bright white block in the dark side rails. */
html.dark ins.adsbygoogle,
html.dark ins.adsbygoogle iframe,
html.dark .ad-unit-wrap iframe,
html.dark .inline-ad-wrap iframe,
html.dark .sidebar-ad-wrap iframe,
html.dark .ln-ad-rail-card iframe,
html.dark iframe[id^="aswift"],
html.dark iframe[src*="googlesyndication"],
html.dark iframe[src*="doubleclick"] {
    background-color: transparent !important;
    color-scheme: normal;
}

/* Parent Portal Photos: match the other dashboard sections (bg-gray-100 tone)
   so its white cards still stand out from the section behind them. */
html.dark #parent-portal-photos-section {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* Disabled buttons kept their saturated colour, so they looked enabled but
   muddy; dim them consistently instead. */
html.dark button:disabled,
html.dark button[disabled] {
    opacity: 0.55;
}

/* Muted helper text in dashboard cards sat too close to the background. */
html.dark .text-gray-400,
html.dark .text-slate-400 {
    color: #94a3b8 !important;
}

html.dark .text-gray-500,
html.dark .text-slate-500 {
    color: #a3b1c6 !important;
}

/* Re-assert white text after the shade overrides above. */
html.dark .text-white,
html.dark .text-white\/90 {
    color: #ffffff !important;
}

/* Shadows tuned for a dark page (Tailwind's are black-at-10%, invisible). */
html.dark .shadow,
html.dark .shadow-sm,
html.dark .shadow-md {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

html.dark .shadow-lg,
html.dark .shadow-xl {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

/* Tailwind utility subset is missing a handful of classes used in schools.html,
   so those buttons/links rendered colourless in light mode too. */
.bg-amber-600 {
    background-color: #d97706;
}

/* The triage queue's ownership-claim actions: the subset has no amber-700/800,
   so "Verify and link" rendered with no background and the white text sat
   unreadably on the pale amber card — the button was there, just invisible. */
.bg-amber-700 {
    background-color: #b45309;
}

.hover\:bg-amber-800:hover,
.bg-amber-700:hover {
    background-color: #92400e;
}

.hover\:bg-amber-700:hover,
.bg-amber-600:hover {
    background-color: #b45309;
}

.text-emerald-700 {
    color: #047857;
}

.hover\:text-emerald-900:hover {
    color: #064e3b;
}

/* ==========================================================================
   MOBILE HARDENING (global)
   Cross-page fixes for small screens. These are intentionally broad: they
   make the whole site resilient rather than patching one page at a time.
   ========================================================================== */

/* Form controls carry an intrinsic minimum width (an input's default `size`,
   a select's longest option, a textarea's `cols`). As grid/flex items they
   default to min-width:auto and so refuse to shrink, which pushed a whole
   card - and the page - wider than the viewport (seen on schools.html).
   Let them shrink. Checkbox/radio/range/small buttons are left alone so they
   keep their square hit area. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="color"]),
select,
textarea {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Media must never be wider than the column it sits in. */
img,
video,
canvas,
iframe {
    max-width: 100%;
}

/* Long, unbreakable strings (emails, URLs, reference codes) should wrap rather
   than stretch their container off-screen. */
p,
li,
td,
th,
h1,
h2,
h3,
h4,
dd {
    overflow-wrap: break-word;
}

/* Anything inside a content column can shrink; only explicit min-width rules
   should stop it. */
@media (max-width: 768px) {

    .content-block,
    .card,
    main,
    section,
    article,
    aside {
        min-width: 0;
    }
}

/* Firebase Auth helper iframe.
   Firebase injects a hidden same-origin iframe (firebaseapp.com/__/auth/iframe)
   to read and sync auth state. It is designed to sit invisibly off-screen at
   1x1 and is never meant to be touched. The global mobile iframe rules above
   force EVERY iframe to width:100% / height:300px, which grew that helper to
   cover the whole header and silently swallow taps on the school selector,
   dark-mode toggle and Logout - the page looked normal, only at phone widths,
   and only once Firebase had a session to sync. Pin any auth/helper iframe
   back to a 1x1, off-screen, non-interactive element. */
iframe[src*="/__/auth/iframe"]:not(.embed-container iframe),
iframe[src*="firebaseapp.com/__/auth"]:not(.embed-container iframe) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    max-width: 1px !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    overflow: hidden !important;
}

/* Contribution review action buttons */
.btn-accept-contribution {
  background-color: #047857 !important;
  color: #ffffff !important;
  border: 1px solid #065f46 !important;
}
.btn-accept-contribution:hover {
  background-color: #065f46 !important;
}
.btn-reject-contribution {
  background-color: #ffffff !important;
  color: #b91c1c !important;
  border: 1px solid #f87171 !important;
}
.btn-reject-contribution:hover {
  background-color: #fef2f2 !important;
}
.btn-publish-contribution {
  background-color: #1d4ed8 !important;
  color: #ffffff !important;
  border: 1px solid #1e40af !important;
}
.btn-publish-contribution:hover {
  background-color: #1e40af !important;
}
html.dark .btn-reject-contribution {
  background-color: #2a1416 !important;
  color: #fca5a5 !important;
  border-color: #7f1d1d !important;
}
html.dark .btn-reject-contribution:hover {
  background-color: #3b181c !important;
}

/* ==========================================================================
   Parent Photos — step strip

   The dashboard's Tailwind build is a pre-built stylesheet, so a class that was
   never compiled into it does nothing at all. `.photo-step` is defined here
   rather than in the markup for that reason: the strip's shape should not depend
   on which utilities happened to make it into the build.
   ========================================================================== */
.photo-step {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border-radius: 9999px;
    padding: 0.25rem 0.6rem;
    line-height: 1.25;
    transition: background-color 150ms ease, color 150ms ease;
}

.photo-step[data-step="course"],
.photo-step[data-step="tag"],
.photo-step[data-step="upload"] {
    background-color: #ffedd5; /* orange-100 */
    color: #7c2d12;            /* orange-900 */
}

html.dark .photo-step[data-step="course"],
html.dark .photo-step[data-step="tag"],
html.dark .photo-step[data-step="upload"] {
    background-color: #3a2412;
    color: #fdba74;
}
