/* SLEEP BETTER Program Styles */

/* Self-hosted Poppins (SIL OFL 1.1 — see fonts/OFL.txt). Replaces the Google Fonts
   <link> so no viewer IP leaks to fonts.gstatic.com on page load (HIPAA privacy;
   lets the CSP keep style-src/font-src at 'self'). Per-subset unicode-range kept so
   the browser still fetches only the subset it needs (latin for English content). */
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap;
    src: url('../fonts/poppins-300-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap;
    src: url('../fonts/poppins-300-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/poppins-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('../fonts/poppins-400-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('../fonts/poppins-600-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('../fonts/poppins-600-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/poppins-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap;
    src: url('../fonts/poppins-700-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette - Purple/Blue Theme */
    --primary-purple: #6B5B95;
    --primary-blue: #4A90E2;
    --dark-purple: #4A3F6B;
    --light-purple: #9B8FC4;
    --accent-blue: #5BA3E8;
    --dark-blue: #2E5C8A;
    /* WCAG-AA button blue: white text on this reads 5.35:1 (accent-blue was 2.67:1). */
    --btn-primary-bg: #2B6CB0;
    --light-bg: #F5F7FA;
    --white: #FFFFFF;
    --text-dark: #2C3E50;
    /* Darkened from #6C757D (4.36:1 on --light-bg, just under AA) to clear 4.5:1. */
    --text-light: #5C636A;
    --success: #28A745;
    --border-color: #E0E6ED;
    
    /* Typography */
    --font-main: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;
    
    /* Height of the sticky header box. Every header-coupled offset below derives
       from this; it must be >= the rendered header height or the sidebar heading is
       clipped. Deliberately a ceiling, not an exact fit — erring high degrades to a
       harmless gap, erring low re-creates the occlusion (guarded by I1/I2). */
    --header-h: 84px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Clip the sub-pixel horizontal sliver the off-canvas sidebar adds to
   scrollWidth on mobile (no visible content is cut off). Applied at the root
   scroll container, which is compatible with the sticky header. */
html {
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--light-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Layout with Sidebar */
.page-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

.main-content {
    flex: 1;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* Header and Navigation */
header {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: var(--spacing-sm) 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--white);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* The brand is the navbar's last unprotected flex child. Letting it wrap grows the
   header past --header-h and re-opens the sidebar occlusion, so it is pinned to one
   line — which means row pressure now releases as horizontal overflow instead (the
   1150px hamburger contains it; guarded by I8). */
.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* gap is --spacing-sm, not --spacing-md: with the brand pinned to one line
   (.logo h1 white-space: nowrap) nothing in this row can shrink, so the row's
   minimum width is fixed. At --spacing-md the six gaps push that minimum to
   ~1157px against the 1136px a 1280px viewport leaves inside .container, and the
   row overflows instead of wrapping. Widening the gap again re-breaks I8. */
.nav-menu {
    display: flex;
    /* Center every item: the plain-link <li>s would otherwise top-align (default stretch)
       while .nav-auth centres its own content, dropping the Log in / Log out control below
       the rest of the row. */
    align-items: center;
    list-style: none;
    gap: var(--spacing-sm);
}

/* Keeps the study-id + Log out controls on one line. Without this the li shrinks
   (default flex-shrink: 1) and its two inline children wrap — study id on one line,
   Log out ragged below. flex-shrink: 0 is why the nav cannot squeeze, and so why the
   hamburger takes over at 1150px rather than 768px. */
.nav-auth {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

/* Auth-state nav controls (S2/FR-NAV-4/D6): the identity+logout pair and the Login link
   are mutually exclusive, chosen by the tri-state [data-auth] auth-state.js paints on
   <html>. Both stay hidden until it resolves, so neither flashes before auth is known.
   Higher specificity than the .nav-auth base rule above, so order-independent. */
.nav-auth[data-auth-for] {
    display: none;
}

[data-auth='authenticated'] .nav-auth[data-auth-for='authenticated'],
[data-auth='anonymous'] .nav-auth[data-auth-for='anonymous'] {
    display: flex;
}

/* The nav "Log in" link is redundant on the login page itself (it points at this page), so
   hide it there. Outspecifies the reveal rule above; the authenticated pair still shows if a
   signed-in user lands here. */
body[data-content-page='login'] .nav-auth[data-auth-for='anonymous'] {
    display: none;
}

/* Program and Resources point at gated pages; for an anonymous visitor they only bounce to
   login, so hide them until auth resolves as authenticated (same no-flash pattern as the
   Log in/out controls). Gated pages only ever render authenticated, so the links show there. */
.nav-menu li[data-auth-gated] {
    display: none;
}

[data-auth='authenticated'] .nav-menu li[data-auth-gated] {
    display: block;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Mobile top-nav hamburger (button injected by main.js). Hidden on desktop; the
   @media (max-width: 1150px) rule reveals it and collapses .nav-menu into a
   dropdown so the seven links + auth controls no longer stack in the sticky
   header. The nav collapses at 1150px, not the 768px the rest of the layout uses:
   below ~1150 the links plus .nav-auth exceed the container and the row cannot
   shrink (.nav-auth is flex-shrink: 0), so it would overflow the page instead. */
.nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: var(--spacing-xs);
}

/* Left Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: var(--white);
    box-shadow: var(--shadow-md);
    position: fixed;
    left: 0;
    top: var(--header-h); /* Below the header */
    bottom: 0;
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.sidebar-nav {
    padding: var(--spacing-sm) 0;
}

.sidebar-section {
    margin-bottom: var(--spacing-sm);
}

.sidebar-section-title {
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--light-bg);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
    background-color: var(--light-bg);
    border-left-color: var(--primary-blue);
}

.sidebar-menu a.active {
    background-color: var(--light-bg);
    border-left-color: var(--primary-purple);
    color: var(--primary-purple);
    font-weight: 600;
}

.sidebar-menu a .icon {
    margin-right: var(--spacing-xs);
    font-size: 1.25rem;
}

.sidebar-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: var(--light-bg);
}

.sidebar-submenu a {
    padding-left: calc(var(--spacing-md) + 1.5rem);
    font-size: 0.9rem;
}

.week-section {
    border-left: 3px solid transparent;
    transition: border-color 0.3s ease;
}

.week-section.active {
    border-left-color: var(--primary-purple);
}

.week-title {
    display: flex;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 600;
    color: var(--dark-purple);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.week-title:hover {
    background-color: var(--light-bg);
}

/* padding/margin-bottom are zeroed to shed the bare .week-number pill rule below,
   whose horizontal padding exceeds this width and renders the circle as an ellipse. */
.week-title .week-number {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    font-size: 0.875rem;
    margin-right: var(--spacing-sm);
    margin-bottom: 0;
}

.week-title .toggle-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.week-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.week-section.collapsed .sidebar-submenu {
    display: none;
}

/* Sidebar Toggle Button (Mobile). Hidden by default — only the
   @media (max-width: 1024px) rule flips it to display:flex, so on desktop the
   sidebar is open and the button does not paint over the "Program Navigation"
   header. align-items/justify-content stay here, inert while display:none. */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: calc(var(--header-h) + 10px);
    left: 10px;
    /* Below the sticky header (1000) so an open mobile top-nav dropdown paints
       over this toggle instead of the toggle poking through it. The toggle sits
       10px below --header-h, so it never collides with the header in its normal
       (closed) state. Still above the sidebar (900) and
       its backdrop (899). */
    z-index: 999;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    font-size: 1.5rem;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    box-shadow: var(--shadow-lg);
}

/* Back-to-top button (injected by main.js). Shares the right-edge column with the
   FAQ pill (faq-widget.css) and stacks above it via the same --spacing-md token so
   the two fixed widgets no longer collide in the bottom-right corner. The pill's
   toggle is ~46px tall (unpinned inline-flex) plus a 12px gap. On the intentional
   stacking scale it sits at 1005 (below the FAQ pill at 1010). */
.back-to-top {
    position: fixed;
    right: var(--spacing-md);
    bottom: calc(var(--spacing-md) + 46px + 12px);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    z-index: 1005;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.back-to-top--visible {
    display: flex;
}

.back-to-top:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

/* When the FAQ panel is open it expands up into this button's space; hide it.
   !important beats the .back-to-top--visible display the scroll handler sets. */
body.faq-open .back-to-top {
    display: none !important;
}

/* Main content with sidebar */
body.has-sidebar .main-content {
    margin-left: 280px;
    width: calc(100% - 280px);
    min-height: calc(100vh - var(--header-h));
}

body.has-sidebar .page-wrapper {
    min-height: calc(100vh - var(--header-h));
}

/* Ensure containers within main-content respect boundaries */
body.has-sidebar .main-content .container {
    max-width: 1200px;
    width: 100%;
}

/* Ensure page-header doesn't overflow */
body.has-sidebar .page-header .container {
    max-width: 100%;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    padding: var(--spacing-xl) 0;
}

.hero .container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    align-items: center;
}

.hero-content h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

.subtitle {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sleep-icon {
    font-size: 8rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--btn-primary-bg);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Solid so it stays legible on any background — the transparent/white version
   read 1.07:1 white-on-white where it was placed over a light section. */
.btn-secondary {
    background-color: var(--white);
    color: var(--dark-purple);
    border: 2px solid var(--primary-purple);
}

.btn-secondary:hover {
    background-color: var(--light-bg);
    color: var(--dark-purple);
}

.btn-light {
    background-color: var(--white);
    color: var(--primary-purple);
}

.btn-light:hover {
    background-color: var(--light-bg);
    transform: translateY(-2px);
}

/* Sections */
section {
    padding: var(--spacing-xl) 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--dark-purple);
}

/* Overview Section */
.overview {
    background-color: var(--white);
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.overview-card {
    text-align: center;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    background-color: var(--light-bg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.overview-card h3 {
    color: var(--primary-purple);
    margin-bottom: var(--spacing-xs);
    font-size: 1.5rem;
}

.overview-card p {
    color: var(--text-light);
}

/* Weeks Preview Section */
.weeks-preview {
    background-color: var(--light-bg);
}

.weeks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.week-card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid var(--primary-purple);
}

.week-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.week-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.week-card h3 {
    color: var(--dark-purple);
    margin-bottom: var(--spacing-sm);
    font-size: 1.5rem;
}

.week-card p {
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

.week-features {
    list-style: none;
    padding: 0;
}

.week-features li {
    padding: var(--spacing-xs) 0;
    color: var(--text-dark);
    position: relative;
    padding-left: 1.5rem;
}

.week-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.cta-center {
    text-align: center;
    margin-top: var(--spacing-lg);
}

/* Participants Section */
.participants {
    background-color: var(--white);
}

.participants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

.participant-card {
    text-align: center;
    padding: var(--spacing-md);
    background-color: var(--light-bg);
    border-radius: var(--radius-md);
    transition: transform 0.3s ease;
}

.participant-card:hover {
    transform: scale(1.05);
}

.participant-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-sm);
}

.participant-card h3 {
    color: var(--primary-purple);
    margin-bottom: var(--spacing-sm);
    font-size: 1.5rem;
}

.participant-card p {
    color: var(--text-light);
}

/* Contact CTA Section */
.contact-cta {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
}

.contact-box {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.contact-box h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.contact-box > p {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 1.25rem;
}

.contact-icon {
    font-size: 1.5rem;
}

.contact-item a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.contact-cta .contact-info {
    background: transparent;
    padding: 0;
}

.contact-cta .contact-item a {
    color: var(--white);
}

.contact-item a:hover {
    opacity: 0.8;
}

/* Footer */
footer {
    background-color: var(--dark-purple);
    color: var(--white);
    padding: var(--spacing-lg) 0 var(--spacing-md);
}

/* Footer with sidebar */
body.has-sidebar footer {
    margin-left: 280px;
    width: calc(100% - 280px);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.footer-section h4 {
    margin-bottom: var(--spacing-sm);
    /* Lightened from --light-purple (#9b8fc4, 3.21:1 on the dark footer) to clear AA. */
    color: #CFC7E6;
}

.footer-section p {
    opacity: 0.9;
    line-height: 1.8;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

.footer-bottom p {
    margin: var(--spacing-xs) 0;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    text-align: center;
    padding: var(--spacing-lg) 0;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.page-header p {
    font-size: 1.25rem;
    opacity: 0.95;
}

/* Progress Tracker */
.progress-section {
    background-color: var(--white);
    padding: var(--spacing-md) 0;
}

.progress-tracker {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
}

.progress-step.completed .step-number {
    background-color: var(--success);
    color: var(--white);
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-dark);
    font-weight: 500;
}

.progress-line {
    flex: 1;
    height: 3px;
    background-color: var(--border-color);
    margin: 0 var(--spacing-sm);
    max-width: 100px;
}

/* Week Detail Sections */
.week-detail {
    padding: var(--spacing-xl) 0;
}

.week-detail.alt-bg {
    background-color: var(--white);
}

.week-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.week-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.week-header h2 {
    font-size: 2.5rem;
    color: var(--dark-purple);
    margin-bottom: var(--spacing-sm);
}

.week-description {
    font-size: 1.25rem;
    color: var(--text-light);
    max-width: 800px;
    margin: 0 auto;
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.lesson-card {
    background: var(--white);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.week-detail.alt-bg .lesson-card {
    background: var(--light-bg);
}

.lesson-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.lesson-icon {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-sm);
}

.lesson-card h3 {
    color: var(--dark-purple);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.lesson-card p {
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

.quiz-section {
    text-align: center;
    padding: var(--spacing-md);
    background: var(--white);
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-blue);
}

.week-detail.alt-bg .quiz-section {
    background: var(--light-bg);
}

.quiz-section h3 {
    color: var(--dark-purple);
    margin-bottom: var(--spacing-sm);
}

.quiz-section p {
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
}

/* Completion CTA */
.completion-cta {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--white);
    padding: var(--spacing-xl) 0;
}

.completion-box {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.completion-box h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
}

.completion-box > p {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
}

.completion-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
}

.benefit-icon {
    font-size: 1.5rem;
    color: var(--success);
}

/* Lesson Page Styles */
.lesson-content {
    background: var(--white);
    padding: var(--spacing-xl) 0;
}

.lesson-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Single canonical .video-container (the duplicate #000 rule in the VIDEO SECTION
   block was removed). The brand gradient is the empty-state background: on lesson
   pages the transparent .video-placeholder lets it show through as a styled
   "coming soon" panel instead of a bare black box; on the homepage the introduction
   player adds .video-cover, which fills the container opaquely so the "coming soon"
   reading never appears there. Host-agnostic — placeholder styling only, no
   player/source. */
.video-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto var(--spacing-lg);
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--white);
}

.video-placeholder .play-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-sm);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.video-placeholder .play-icon:hover {
    transform: scale(1.1);
}

/* On lesson pages the whole placeholder is the play control (role="button" + tabindex in
   the markup), so it needs a pointer over all of it and a focus ring a keyboard user can
   see — it is the only route to the lesson video. */
.video-placeholder[role="button"] {
    cursor: pointer;
}

/* Home introduction player: an OPAQUE full-bleed control. Transparency here would let
   .video-container's gradient read as the lesson pages' "coming soon" empty state on a
   public recruitment page. */
.video-placeholder.video-cover {
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4A3F6B 0%, #6B5B95 50%, #4A90E2 100%);
}

.video-cover-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.video-placeholder[role="button"]:focus-visible {
    outline: 3px solid var(--white);
    outline-offset: 4px;
}

.lesson-overview {
    background: var(--light-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.lesson-overview h3 {
    color: var(--dark-purple);
    margin-bottom: var(--spacing-sm);
}

.lesson-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 2px solid var(--border-color);
}

/* About Page */
.about-section {
    background: var(--white);
    padding: var(--spacing-xl) 0;
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-content h2 {
    color: var(--dark-purple);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.about-content p {
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    line-height: 1.8;
}

.about-content ul {
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
}

.about-content li {
    color: var(--text-light);
    margin-bottom: var(--spacing-xs);
    line-height: 1.8;
}

/* Contact Page */
.contact-section {
    background: var(--white);
    padding: var(--spacing-xl) 0;
}

.contact-content {
    max-width: 800px;
    margin: 0 auto;
}

.contact-card {
    background: var(--light-bg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.contact-card h3 {
    color: var(--dark-purple);
    margin-bottom: var(--spacing-sm);
}

.contact-details {
    display: grid;
    gap: var(--spacing-sm);
}

.contact-detail-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--white);
    border-radius: var(--radius-sm);
}

.contact-detail-item strong {
    color: var(--dark-purple);
    min-width: 80px;
}

.contact-detail-item a {
    /* --primary-blue (#4A90E2) is 3.29:1 on white; --dark-blue clears AA (7.7:1). */
    color: var(--dark-blue);
    text-decoration: none;
}

.contact-detail-item a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* Sidebar becomes overlay on tablets/mobile */
    .sidebar {
        transform: translateX(-100%);
        top: 0;
        padding-top: var(--header-h);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    body.has-sidebar .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    body.has-sidebar footer {
        margin-left: 0;
        width: 100%;
    }
    
    /* Overlay backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 899;
    }
    
    .sidebar-backdrop.show {
        display: block;
    }
}

@media (max-width: 1150px) {
    /* Collapse the top nav behind the injected hamburger. Closed by default;
       .open (toggled by main.js) drops it below the header as an overlay so it
       doesn't push page content or stretch the sticky header. */
    .nav-toggle {
        display: block;
    }

    .navbar .container {
        position: relative;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: var(--spacing-xs);
        background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
        padding: var(--spacing-sm);
        box-shadow: var(--shadow-md);
        z-index: 1000;
    }

    .nav-menu.open {
        display: flex;
    }
}

@media (max-width: 768px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .sleep-icon {
        font-size: 5rem;
    }
    
    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .section-title {
        font-size: 2rem;
    }
    
    .contact-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .progress-tracker {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .progress-line {
        display: none;
    }
    
    .sidebar {
        width: 260px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.3rem;
    }

    .hero-content h2 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    /* Mirror the FAQ pill's tightened offset (faq-widget.css uses --spacing-sm
       below 480px) so the two right-edge widgets stay aligned on small screens. */
    .back-to-top {
        right: var(--spacing-sm);
        bottom: calc(var(--spacing-sm) + 46px + 12px);
    }
}

/* ===================================
   CONTACT FORM STYLES
   =================================== */

.contact-form-card {
    grid-column: 1 / -1; /* Span full width */
}

.contact-form {
    margin-top: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-dark);
    background: white;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form .btn {
    margin-top: var(--spacing-sm);
    padding: 12px 32px;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
    }
}

/* ===================================
   VIDEO SECTION STYLES
   =================================== */

/* .video-container is defined once, in the Lesson Page Styles section above.
   The former duplicate here (background:#000) shadowed the gradient and caused
   the bare-black lesson video box; it has been merged into that single rule. */

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

@media (max-width: 768px) {
    .video-container {
        border-radius: var(--radius-sm);
    }
    
    .video-cover-title {
        font-size: 1.1rem;
    }
}

/* ===================================
   RESOURCES PAGE STYLES
   =================================== */

.resource-category {
    margin-bottom: var(--spacing-xl);
}

.resource-category h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 3px solid var(--primary-blue);
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.resource-card {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.resource-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

.resource-card h3 {
    font-size: 1.3rem;
    color: var(--primary-purple);
    margin-bottom: var(--spacing-sm);
}

.resource-card p {
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    flex-grow: 1;
}

.resource-features {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm) 0;
}

.resource-features li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-dark);
}

.resource-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.resource-card .btn {
    margin-top: var(--spacing-sm);
    align-self: flex-start;
}

/* Links Section */
.links-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.link-card {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.link-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.link-card h3 {
    font-size: 1.2rem;
    color: var(--primary-purple);
    margin-bottom: var(--spacing-sm);
}

.link-card p {
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.app-card {
    background: var(--light-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

.app-card h4 {
    font-size: 1.1rem;
    color: var(--primary-purple);
    margin-bottom: var(--spacing-sm);
}

.app-card ul {
    list-style: none;
    padding: 0;
}

.app-card li {
    padding: 0.3rem 0;
    color: var(--text-dark);
}

.app-card li:before {
    content: "• ";
    color: var(--primary-blue);
    font-weight: bold;
}

.note {
    font-style: italic;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: var(--spacing-sm);
}

/* Support Section */
.support-section {
    background: var(--light-bg);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.support-section > p {
    margin-bottom: var(--spacing-md);
    color: var(--text-dark);
}

.support-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.support-item {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-blue);
}

.support-item h4 {
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}

.support-item p {
    color: var(--text-light);
    margin: 0;
}

.contact-info {
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background: white;
    border-radius: var(--radius-sm);
    text-align: center;
    color: var(--text-dark);
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    text-align: center;
    margin-top: var(--spacing-xl);
}

.cta-section h2 {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    color: white;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
}

/* The base .hero-buttons rule stays left-aligned for the home hero. */
.cta-section .hero-buttons,
.completion-box .hero-buttons,
.quiz-results .hero-buttons {
    justify-content: center;
}

/* Responsive Adjustments for Resources */
@media (max-width: 768px) {
    .resource-grid {
        grid-template-columns: 1fr;
    }
    
    .links-section {
        grid-template-columns: 1fr;
    }
    
    .apps-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .resource-category h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-section {
        padding: var(--spacing-md);
    }
    
    .cta-section h2 {
        font-size: 1.5rem;
    }
}

