/*
 * ============================================================
 * HEADER & NAVIGATION
 * One floating header bar (every public page, markup generated
 * identically into each page — learning/<level>.html with ../ paths):
 *
 *   [logo mark + name] · [main nav, «شروع یادگیری» with a levels
 *   dropdown] · [ورود | رزرو رایگان کلاس | theme toggle]
 *
 * Behaviour lives in js/site-header.js (dropdown, scrolled state, mobile
 * sheet close) and js/header-scroll.js (hide on scroll down).
 * ============================================================
 */

/* ---- Floating header bar ----
   No backdrop-filter on purpose: this fixed element recomposites on every
   hide/show and theme change, and a blur here was one of the biggest
   sources of scroll stutter on weaker GPUs. --header-glass-bg is an opaque-
   enough solid color instead (tokens.css). */
.site-header {
    --header-h: 68px;
    width: calc(100% - 32px);
    max-width: 1480px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 10px 0 14px;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background-color: var(--header-glass-bg);
    border: 1px solid var(--neutral-border);
    border-top-color: var(--glass-border-highlight);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px -12px rgba(26, 54, 93, 0.16);
    visibility: visible;
    /* `all` also animates the hide/show transform slide below. */
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0s;
}
/* Once the page has scrolled a little (js/site-header.js), the bar sits a
   touch closer to the top and its shadow deepens, so it reads as floating
   above the content rather than part of it. */
.site-header.is-scrolled {
    top: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 18px 40px -14px rgba(26, 54, 93, 0.28);
}
[data-theme="dark"] .site-header.is-scrolled {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -12px rgba(0, 0, 0, 0.6);
}
/* Scroll-direction hide/show (js/header-scroll.js). visibility switches to
   hidden only after the slide-out, so off-screen links leave the tab order. */
.site-header.header-hidden {
    transform: translateX(-50%) translateY(-160%);
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.6s;
}
@media (prefers-reduced-motion: reduce) {
    .site-header,
    .site-header.header-hidden {
        transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, visibility 0s linear 0s;
    }
}

/* ---- Brand ---- */
.logo-link {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    padding: 6px;
    border-radius: 16px;
    text-decoration: none;
}
.logo-link:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 2px; }
/* Monogram: navy → burgundy (the site's two brand colors, fixed in both
   themes) with a thin German tricolor underline. */
/* The academy logo (assets/images/logo-mark.webp, 128px for sharp 2-3x
   screens). Its rounded tile and gradient are part of the image. */
.logo-mark {
    flex-shrink: 0;
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 12px -4px rgba(93, 13, 24, 0.55);
}
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    line-height: 1.25;
}
.logo-main {
    font-family: var(--font-display-fa);
    font-size: 17px;
    font-weight: 800;
    color: var(--primary-navy);
    white-space: nowrap;
}
.logo-sub {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    direction: ltr;
    white-space: nowrap;
}

/* ---- Main navigation (desktop) ---- */
.main-nav {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 12px;
    display: flex;
    justify-content: center;
}
.main-nav-list {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-item { position: relative; display: flex; align-items: center; }

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 11px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-link:hover,
.nav-link:focus-visible,
.nav-item.has-menu:hover > .nav-link,
.nav-item.is-open > .nav-link {
    color: var(--primary-navy);
    background-color: rgba(26, 54, 93, 0.05);
}
[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link:focus-visible,
[data-theme="dark"] .nav-item.has-menu:hover > .nav-link,
[data-theme="dark"] .nav-item.is-open > .nav-link { background-color: rgba(148, 163, 184, 0.1); }
.nav-link:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 1px; }
/* Current page: brand color plus a short bar under the label. */
.nav-link[aria-current="page"],
.nav-link.is-section-current { color: var(--primary-navy); }
.nav-link[aria-current="page"]::after,
.nav-link.is-section-current::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 11px;
    width: 18px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--accent-gold);
}

/* «رایگان» — a small tag next to the two free entry points. */
.nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px 2px;
    border-radius: 999px;
    background-color: var(--accent-soft-bg);
    color: var(--accent-gold);
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
}

/* Dropdown trigger: the label itself stays a real link to learning.html
   (crawlable, one click away); this small chevron opens the levels. */
.nav-menu-toggle {
    width: 24px;
    height: 28px;
    margin-inline-start: -8px;
    position: relative;
    z-index: 1; /* above the neighbouring link it overlaps, so its whole 24px target stays clickable */
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-menu-toggle svg { width: 15px; height: 15px; transition: transform 0.25s ease; }
.nav-menu-toggle:hover,
.nav-menu-toggle:focus-visible { color: var(--primary-navy); background-color: rgba(26, 54, 93, 0.06); }
.nav-menu-toggle:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 1px; }
.nav-item.has-menu:hover .nav-menu-toggle svg,
.nav-item.is-open .nav-menu-toggle svg { transform: rotate(180deg); }

/* ---- Levels dropdown ---- */
.nav-menu {
    position: absolute;
    top: calc(100% + 16px);
    right: 50%;
    width: 560px;
    padding: 18px;
    background-color: var(--color-surface);
    border: 1px solid var(--neutral-border);
    border-radius: 20px;
    box-shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.35), 0 2px 6px rgba(15, 23, 42, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translate(50%, 8px);
    /* Closing waits a moment (the second half of each delay), so a pointer that strays
       outside the panel on its way across it doesn't lose it; re-entering keeps it open. */
    transition: opacity 0.2s ease 0.25s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) 0.25s, visibility 0s linear 0.45s;
    z-index: 5;
}
/* Invisible bridge across the gap so moving the pointer from the label
   down into the panel never closes it. */
.nav-menu::before {
    content: '';
    position: absolute;
    top: -18px;
    left: 0;
    right: 0;
    height: 18px;
}
@media (hover: hover) {
    .nav-item.has-menu:hover > .nav-menu {
        opacity: 1;
        visibility: visible;
        transform: translate(50%, 0);
        transition-delay: 0.06s, 0.06s, 0s;
    }    /* A clicked entry closes the panel even though the pointer is still
       over it (js/site-header.js), until the pointer leaves the item. */
    .nav-item.has-menu.is-dismissed:hover > .nav-menu {
        opacity: 0;
        visibility: hidden;
        transform: translate(50%, 8px);
        transition-delay: 0s, 0s, 0.2s;
    }
}
.nav-item.is-open > .nav-menu {
    opacity: 1;
    visibility: visible;
    transform: translate(50%, 0);
    transition-delay: 0s;
}
.nav-menu-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 6px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--neutral-border);
}
.nav-menu-head strong { font-family: var(--font-body); font-size: 14.5px; font-weight: 800; color: var(--ink); }
.nav-menu-head span { font-family: var(--font-body); font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.nav-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-level {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.nav-level:hover,
.nav-level:focus-visible,
.nav-level[aria-current="page"] { background-color: var(--neutral-soft-bg); }
.nav-level:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: -2px; }
.nav-level-code {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background-color: var(--accent-soft-bg);
    color: var(--accent-gold);
    font-family: 'Inter', var(--font-body);
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-level:hover .nav-level-code,
.nav-level[aria-current="page"] .nav-level-code {
    background: linear-gradient(135deg, var(--grad-btn-start), var(--grad-btn-end));
    color: #FFFFFF;
}
.nav-level-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-level-text strong { font-family: var(--font-body); font-size: 13.5px; font-weight: 700; color: var(--ink); }
.nav-level-text span {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-menu-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 12px 6px 2px;
    border-top: 1px solid var(--neutral-border);
}
.nav-menu-foot a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
}
.nav-menu-all { color: var(--accent-gold); }
.nav-menu-all svg { width: 14px; height: 14px; transition: transform 0.2s ease; }
.nav-menu-all:hover svg { transform: translateX(-3px); }
.nav-menu-hint { color: var(--ink-soft); }
.nav-menu-hint b { color: var(--primary-navy); font-weight: 700; margin-inline-start: 3px; }
.nav-menu-foot a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---- «منابع و کتاب‌ها» dropdown: three columns — book categories, exam
   boards, book series — each row a deep link into resources.html
   (?cat=<slug> / ?series=<slug>, read by js/pages/resources.js). ---- */
.nav-menu-resources { width: 460px; }
.nav-res-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
}
.nav-res-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nav-res-col + .nav-res-col { padding-inline-start: 6px; border-inline-start: 1px solid var(--neutral-border); }
.nav-res-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 8px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 800;
    color: var(--ink-muted);
}
.nav-res-title-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background-color: var(--accent-soft-bg);
    color: var(--accent-gold);
}
.nav-res-title-icon svg { width: 15px; height: 15px; }
.nav-res-list { display: flex; flex-direction: column; gap: 1px; list-style: none; margin: 0; padding: 0; }
.nav-res-link {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 7px 10px;
    border-radius: 11px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.nav-res-link strong {
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    transition: color 0.2s ease;
}
.nav-res-link strong[dir="ltr"] { font-family: 'Inter', var(--font-body); font-size: 13px; font-weight: 600; text-align: right; }
.nav-res-link span {
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-res-link span[dir="ltr"] { font-family: 'Inter', var(--font-body); font-size: 11px; text-align: right; }
.nav-res-link:hover,
.nav-res-link:focus-visible { background-color: var(--neutral-soft-bg); }
.nav-res-link:hover strong,
.nav-res-link:focus-visible strong { color: var(--accent-gold); }
.nav-res-link:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: -2px; }

/* Category rows → the preview pane beside them: the active row (default
   «کتاب اصلی دوره», then whichever is hovered — js/site-header.js) is
   tinted and grows an arrow toward the pane. */
.nav-res-link { position: relative; padding-inline-end: 30px; }
.nav-res-link.is-active { background-color: var(--neutral-soft-bg); }
.nav-res-link.is-active strong { color: var(--accent-gold); }
.nav-res-arrow {
    position: absolute;
    top: 50%;
    inset-inline-end: 8px;
    display: flex;
    color: var(--accent-gold);
    opacity: 0;
    transform: translate(4px, -50%);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-res-arrow svg { width: 15px; height: 15px; }
.nav-res-link:hover .nav-res-arrow,
.nav-res-link:focus-visible .nav-res-arrow,
.nav-res-link.is-active .nav-res-arrow { opacity: 1; transform: translate(0, -50%); }

/* The preview is a fly-out beside the hovered row (like a nested Windows menu): it opens to the left of the
   panel, level with the row, and only while a row (or the fly-out itself) is hovered or focused.
   js/site-header.js sets --pane-top. */
.nav-res-col.nav-res-pane {
    position: absolute;
    top: var(--pane-top, 56px);
    right: calc(100% + 6px); /* the 6px gap is bridged by ::before so the pointer never leaves the item */
    width: 340px;
    padding: 0 10px 10px;
    border: 1px solid var(--neutral-border);
    border-radius: 18px;
    background-color: var(--color-surface);
    box-shadow: 0 24px 60px -18px rgba(15, 23, 42, 0.35), 0 2px 6px rgba(15, 23, 42, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateX(6px);
    transition: opacity 0.16s ease 0.12s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) 0.12s, visibility 0s linear 0.3s, top 0.18s ease;
    z-index: 2;
}
.nav-res-col + .nav-res-col.nav-res-pane { padding-inline-start: 10px; border-inline-start: 1px solid var(--neutral-border); }
.nav-res-pane::before { content: ''; position: absolute; top: 0; bottom: 0; right: -8px; width: 8px; }
.nav-menu-resources.pane-right .nav-res-col.nav-res-pane { right: auto; left: calc(100% + 6px); transform: translateX(-6px); }
.nav-menu-resources.pane-right .nav-res-pane::before { right: auto; left: -8px; }
.nav-menu-resources.pane-right .nav-res-cols:has(.nav-res-link:hover) .nav-res-pane,
.nav-menu-resources.pane-right .nav-res-cols:has(.nav-res-link:focus-visible) .nav-res-pane,
.nav-menu-resources.pane-right .nav-res-pane:hover { transform: none; }
.nav-res-pane .nav-res-title { padding-top: 10px; color: var(--ink-soft); }
.nav-res-cols:has(.nav-res-link:hover) .nav-res-pane,
.nav-res-cols:has(.nav-res-link:focus-visible) .nav-res-pane,
.nav-res-pane:hover {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0.04s, 0.04s, 0s, 0s;
}
.nav-item.has-menu.is-dismissed .nav-res-pane { display: none; }
.nav-res-panel[hidden] { display: none; }
.nav-res-panel { animation: nav-prev-in 0.22s ease both; }
@keyframes nav-prev-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.nav-prev-sub { margin-inline-start: auto; font-family: 'Inter', var(--font-body); font-size: 11px; font-weight: 600; color: var(--ink-muted); }

/* A hovered category's items. */
.nav-prev-list { display: flex; flex-direction: column; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-prev-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 12px;
    background-color: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    text-decoration: none;
    transition: box-shadow 0.2s ease;
}
.nav-prev-item:hover,
.nav-prev-item:focus-visible { box-shadow: 0 6px 16px -10px rgba(26, 54, 93, 0.45); }
.nav-prev-item:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 1px; }
[data-theme="dark"] .nav-prev-item { background-color: rgba(15, 23, 42, 0.55); box-shadow: none; }
.nav-prev-thumb {
    flex-shrink: 0;
    width: 24px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 3px 5px 5px 3px;
    overflow: hidden;
    background-color: var(--accent-soft-bg);
    color: var(--accent-gold);
}
.nav-prev-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-prev-thumb svg { width: 15px; height: 15px; }
.nav-prev-title {
    flex: 1;
    min-width: 0;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}
.nav-prev-item:hover .nav-prev-title { color: var(--accent-gold); }
.nav-prev-level {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--neutral-border);
    font-family: 'Inter', var(--font-body);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ink-soft);
}
.nav-prev-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 10px 6px 0;
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
}
.nav-prev-all svg { width: 14px; height: 14px; }
.nav-prev-all:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Loading / empty / failed. */
.nav-prev-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 220px;
    padding: 16px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 12.5px;
    color: var(--ink-soft);
}
.nav-prev-state .nav-prev-all { margin: 4px 0 0; }
.nav-prev-empty strong { font-size: 13.5px; font-weight: 800; color: var(--ink); line-height: 1.7; }
.nav-prev-empty > span:last-child { font-size: 12px; color: var(--ink-muted); }
.nav-prev-empty-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background-color: var(--color-surface);
    color: var(--ink-muted);
}
.nav-prev-empty-icon svg { width: 22px; height: 22px; }
.nav-prev-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--neutral-border);
    border-top-color: var(--accent-gold);
    animation: nav-prev-spin 0.8s linear infinite;
}
@keyframes nav-prev-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .nav-res-panel { animation: none; }
    .nav-prev-spinner { animation-duration: 2.4s; }
}
.nav-series-list { display: flex; flex-direction: column; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-series {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 7px 8px 8px;
    border-radius: 12px;
    background-color: var(--color-surface);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.nav-series-head { display: flex; align-items: center; gap: 10px; text-decoration: none; border-radius: 8px; }
.nav-series-head:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 2px; }
.nav-series-cover {
    flex-shrink: 0;
    width: 24px;
    height: 32px;
    border-radius: 3px 5px 5px 3px;
    overflow: hidden;
    background-color: var(--neutral-soft-bg);
    box-shadow: 0 3px 8px -3px rgba(15, 23, 42, 0.45), inset 2px 0 0 rgba(0, 0, 0, 0.12);
}
.nav-series-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-series-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nav-series-text strong {
    font-family: 'Inter', var(--font-body);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    text-align: right;
    transition: color 0.2s ease;
}
.nav-series-text > span { font-family: var(--font-body); font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.nav-series-head:hover strong { color: var(--accent-gold); }
.nav-series-count {
    margin-inline-start: auto;
    padding: 2px 8px 1px;
    border-radius: 999px;
    background-color: var(--neutral-soft-bg);
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--ink-soft);
    white-space: nowrap;
}
.nav-series-books { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-series-book {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--neutral-border);
    font-family: 'Inter', var(--font-body);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.nav-series-book:hover,
.nav-series-book:focus-visible {
    background: linear-gradient(135deg, var(--grad-btn-start), var(--grad-btn-end));
    border-color: transparent;
    color: #FFFFFF;
}
.nav-series-book:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 1px; }
[data-theme="dark"] .nav-series { background-color: rgba(15, 23, 42, 0.55); box-shadow: none; }

/* ---- «درباره ما» dropdown: two plain entries plus the featured
   «همکاری با ما / جذب مدرس» card (teach.html). ---- */
.nav-menu-compact { width: 348px; padding: 10px; }
.nav-menu-list { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 14px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.nav-entry:hover,
.nav-entry:focus-visible,
.nav-entry[aria-current="page"] { background-color: var(--neutral-soft-bg); }
.nav-entry:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: -2px; }
.nav-entry-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background-color: var(--neutral-soft-bg);
    color: var(--primary-navy);
    transition: background-color 0.2s ease, color 0.2s ease;
}
.nav-entry-icon svg { width: 19px; height: 19px; }
.nav-entry:hover .nav-entry-icon,
.nav-entry[aria-current="page"] .nav-entry-icon { background-color: var(--accent-soft-bg); color: var(--accent-gold); }

.nav-feature {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 14px 14px 14px 12px;
    border-radius: 16px;
    border: 1px solid rgba(26, 54, 93, 0.12);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(214, 158, 46, 0.16), transparent 60%),
        linear-gradient(135deg, rgba(26, 54, 93, 0.06), rgba(26, 54, 93, 0.02));
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.nav-feature:hover,
.nav-feature:focus-visible,
.nav-feature[aria-current="page"] {
    border-color: rgba(214, 158, 46, 0.55);
    box-shadow: 0 12px 26px -16px rgba(26, 54, 93, 0.45);
}
.nav-feature:hover { transform: translateY(-1px); }
.nav-feature:focus-visible { outline: 2px solid var(--accent-gold); outline-offset: 2px; }
[data-theme="dark"] .nav-feature {
    border-color: rgba(148, 163, 184, 0.18);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(214, 158, 46, 0.18), transparent 60%),
        linear-gradient(135deg, rgba(148, 163, 184, 0.1), rgba(148, 163, 184, 0.03));
}
.nav-feature-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--grad-btn-start), var(--grad-btn-end));
    color: #FFFFFF;
    box-shadow: 0 8px 18px -8px rgba(26, 54, 93, 0.6);
}
.nav-feature-icon svg { width: 21px; height: 21px; }
.nav-feature-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.nav-feature-kicker {
    align-self: flex-start;
    padding: 2px 8px 1px;
    border-radius: 999px;
    background-color: var(--accent-gold);
    color: #FFFFFF;
    font-family: var(--font-body);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.6;
}
.nav-feature-text strong { font-family: var(--font-body); font-size: 14.5px; font-weight: 800; color: var(--ink); }
.nav-feature-text > span:last-child {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.7;
    color: var(--ink-soft);
}
.nav-feature-go {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background-color: var(--color-surface);
    color: var(--accent-gold);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease;
}
.nav-feature-go svg { width: 15px; height: 15px; }
.nav-feature:hover .nav-feature-go { transform: translateX(-3px); }

/* ---- Actions: ورود · رزرو رایگان کلاس · divider · theme toggle ---- */
.header-left,
.header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.header-left { gap: 6px; }
.header-actions { gap: 8px; }
.header-actions .btn-cta {
    height: 42px;
    padding: 0 18px;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    white-space: nowrap;
}
.header-actions .btn-cta svg { width: 17px; height: 17px; flex-shrink: 0; }
/* ورود: a quiet text button, not a second outlined pill competing with
   the one real call-to-action next to it. */
.header-actions .header-login {
    padding: 0 14px;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--primary-navy);
}
.header-actions .header-login:hover,
.header-actions .header-login:focus-visible {
    transform: none;
    background-color: rgba(26, 54, 93, 0.05);
    border-color: var(--neutral-border);
    color: var(--primary-navy);
    box-shadow: none;
}
[data-theme="dark"] .header-actions .header-login:hover { background-color: rgba(148, 163, 184, 0.1); }
.header-actions .header-cta { box-shadow: 0 6px 16px -4px rgba(93, 13, 24, 0.45); }
.header-actions .header-cta:hover { box-shadow: 0 10px 22px -6px rgba(93, 13, 24, 0.55); }
.header-divider {
    width: 1px;
    height: 24px;
    margin: 0 4px;
    background-color: var(--neutral-border);
}
.header-actions .theme-toggle { width: 42px; height: 42px; }

/* ---- Auth-pending skeleton (js/global-nav.js initAuthNav()) ----
   Each page's pre-paint guard adds `auth-pending` to <html> when it sees a
   plausible session, so a signed-in visitor never sees ورود / ثبت‌نام flash
   while the profile loads: the button keeps its place but shows a pulsing
   avatar-sized placeholder until initAuthNav() resolves either way. */
:root.auth-pending .header-actions a.btn-cta[href$="login.html"] {
    visibility: hidden;
    position: relative;
}
:root.auth-pending .header-actions a.btn-cta[href$="login.html"]::after {
    content: '';
    visibility: visible;
    position: absolute;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--neutral-border);
    animation: headerAuthSkeletonPulse 1.3s ease-in-out infinite;
}
@keyframes headerAuthSkeletonPulse {
    0%, 100% { opacity: 0.45; }
    50% { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
    :root.auth-pending .header-actions a.btn-cta[href$="login.html"]::after { animation: none; opacity: 0.7; }
}

/* Theme toggle (.theme-toggle / .sheet-theme-row) lives in components.css —
   the dashboards use it too and don't load this stylesheet. */

/* ---- Menu button (tablet + phone) ---- */
.mobile-menu-btn {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--neutral-border);
    border-radius: 14px;
    background: transparent;
    color: var(--primary-navy);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.mobile-menu-btn:hover { background-color: rgba(26, 54, 93, 0.05); }
.mobile-menu-btn svg { width: 22px; height: 22px; }

/* ---- Mobile sheet ----
   No backdrop-filter on the scrim either (full-viewport blur is the most
   expensive shape it can take); a slightly darker plain scrim instead. */
.mobile-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.mobile-sheet-overlay.active { opacity: 1; pointer-events: auto; touch-action: none; }
/* js/mobile-menu.js pins the page while the sheet is open. */
html.sheet-open { overflow: hidden; }

.mobile-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    display: flex;
    flex-direction: column;
    padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    background-color: var(--bg-base);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.14);
    z-index: 2000;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s linear 0.4s;
}
.mobile-bottom-sheet.active {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s linear 0s;
}
.sheet-handle {
    flex-shrink: 0;
    width: 40px;
    height: 5px;
    margin: 0 auto 10px;
    border-radius: 10px;
    background-color: var(--neutral-border);
}
.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0 14px;
}
.sheet-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display-fa);
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-navy);
}
.sheet-brand .logo-mark { width: 34px; height: 34px; border-radius: 8px; }
.sheet-close {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--neutral-border);
    border-radius: 12px;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}
.sheet-close svg { width: 18px; height: 18px; }

.sheet-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--neutral-border);
    border-radius: 20px;
    background-color: var(--color-surface);
}
.sheet-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: 14px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    text-align: right;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.sheet-link:hover,
.sheet-link:focus-visible { background-color: var(--neutral-soft-bg); }
.sheet-link[aria-current="page"] { background-color: var(--accent-soft-bg); color: var(--accent-gold); }
.sheet-link-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background-color: var(--neutral-soft-bg);
    color: var(--primary-navy);
}
.sheet-link[aria-current="page"] .sheet-link-icon { background-color: var(--color-surface); color: var(--accent-gold); }
.sheet-link-icon svg { width: 18px; height: 18px; }
.sheet-link-label { flex: 1 1 auto; }
.sheet-link svg { flex-shrink: 0; }
/* Signed in: js/global-nav.js injectMobileProfile() adds an account card
   (name + dashboard / settings / logout rows, which get `sheet-link`). */
.sheet-account {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
    padding: 6px;
    border: 1px solid var(--neutral-border);
    border-radius: 20px;
    background-color: var(--color-surface);
}
.sheet-account .sheet-profile-head { padding: 8px 10px 12px; margin-bottom: 4px; }
.sheet-link.header-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 0;
    background: transparent;
    font-size: 14.5px;
    cursor: pointer;
}
.sheet-link.header-profile-menu-item svg { width: 18px; height: 18px; color: var(--ink-soft); }
.sheet-link.header-profile-menu-item.is-danger,
.sheet-link.header-profile-menu-item.is-danger svg { color: var(--color-error); }

.mobile-bottom-sheet .sheet-theme-row { padding: 14px 4px; margin-top: 8px; border-top: 1px solid var(--neutral-border); border-bottom: 0; }

.sheet-actions { display: grid; gap: 10px; margin-top: 4px; }
.sheet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 0;
    border: 1px solid transparent;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--grad-btn-start), var(--grad-btn-end));
    color: #FFFFFF;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 8px 20px -6px rgba(93, 13, 24, 0.45);
}
.sheet-btn svg { width: 18px; height: 18px; }
.sheet-btn-outline {
    background: transparent;
    border-color: var(--neutral-border);
    color: var(--primary-navy);
    box-shadow: none;
}

/* ---- Breakpoints ----
   ≤1339px: the full row gets tighter. ≤1199px: links move into the sheet;
   the bar keeps the brand, «رزرو رایگان کلاس», the theme toggle and the
   menu button. ≤768px (responsive.css hides .header-actions): brand + menu
   button only. */
@media (max-width: 1339px) {
    .site-header { gap: 10px; padding: 0 8px 0 10px; }
    .logo-main { font-size: 15px; }
    .nav-link { padding: 0 9px; font-size: 13.5px; }
    .header-actions { gap: 6px; }
    .header-actions .btn-cta { padding: 0 14px; font-size: 13px; }
    .header-divider { margin: 0 2px; }
}
@media (max-width: 1279px) {
    .nav-link { padding: 0 7px; font-size: 13px; }
    .nav-menu-toggle { margin-inline-start: -6px; }
    .header-actions .btn-cta { padding: 0 12px; }
}
@media (max-width: 1199px) {
    .main-nav { display: none; }
    .header-actions .header-login { display: none; }
    .mobile-menu-btn { display: flex; }
}
@media (max-width: 768px) {
    .site-header { --header-h: 62px; width: calc(100% - 24px); top: 12px; padding: 0 8px 0 6px; border-radius: 18px; }
    .site-header.is-scrolled { top: 8px; }
    .logo-link { gap: 9px; padding: 4px; }
    .logo-mark { width: 36px; height: 36px; border-radius: 9px; }
    .logo-main { font-size: 14px; }
    .logo-sub { font-size: 8.5px; letter-spacing: 1px; }
}
@media (max-width: 359px) {
    .logo-sub { display: none; }
    .logo-main { font-size: 13.5px; }
}

/* ---- lighter, shorter header menus (fewer words, less stretching) ---- */
.nav-badge { padding: 2px 6px 1px; font-size: 9.5px; font-weight: 700; opacity: 0.85; }
.nav-menu-resources .nav-menu-head span,
.nav-menu-resources .nav-menu-hint { display: none; }
.nav-menu-resources .nav-menu-foot { justify-content: flex-start; }
.nav-menu-compact .nav-entry .nav-level-text > span:not(:first-child) { display: none; }
.nav-menu-compact .nav-feature-text > span:last-child { display: none; }
