/* Public website styles (doc/web.md). Math illustrations: public/img (tools/make-svg.py). */

/* ---------------------------------------------------------------- font (local, OFL: fonts/vazirmatn/LICENSE-OFL.txt) */

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/vazirmatn/vazirmatn-arabic-wght-normal.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/vazirmatn/vazirmatn-latin-wght-normal.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;
}

/* ---------------------------------------------------------------- tokens */

:root {
    --bg: #f7f7fc;
    --surface: #ffffff;
    --text: #1b1f3b;
    --muted: #5b6283;
    --border: #e3e5f2;
    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --gold: #f59e0b;
    --gold-soft: #fde68a;
    --night: #14123a;
    --night-2: #2a1e6e;
    --grid: rgba(79, 70, 229, .07);
    --icon-bg: #eef0ff;
    --radius: 20px;
    --shadow: 0 10px 30px rgba(30, 27, 75, .08);
    --shadow-hover: 0 18px 40px rgba(30, 27, 75, .14);
    --math: "Cambria Math", "Times New Roman", serif;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e0d24;
        --surface: #17163a;
        --text: #eceefe;
        --muted: #a5a9cc;
        --border: #2b2a5a;
        --primary: #8b85ff;
        --primary-2: #b18cff;
        --grid: rgba(139, 133, 255, .07);
        --icon-bg: #24225a;
        --shadow: none;
        --shadow-hover: 0 0 0 1px #3d3b80;
        --danger: #f87171;
        --danger-soft: rgba(248, 113, 113, .1);
        --success: #34d399;
        --success-soft: rgba(52, 211, 153, .1);
    }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: Vazirmatn, Tahoma, sans-serif;
    font-size: 16px;
    line-height: 1.9;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { color: var(--primary); }

h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; font-weight: 800; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.container.narrow { max-width: 760px; }

.icon { width: 1em; height: 1em; flex: none; }

/* ---------------------------------------------------------------- header */

.header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    min-height: 72px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.brand-name { font-weight: 800; font-size: 1.05rem; }
.brand-role { font-size: .8rem; color: var(--muted); }

.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }

.nav a {
    padding: 6px 14px;
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: .95rem;
    transition: background .2s, color .2s;
}

.nav a:hover { background: var(--icon-bg); color: var(--primary); }

.nav a.nav-cta { background: var(--primary); color: #ffffff; }
.nav a.nav-cta:hover { background: var(--primary-2); color: #ffffff; }

/* ---------------------------------------------------------------- hero */

.hero {
    position: relative;
    overflow: hidden;
    padding: 72px 0 96px;
    color: #ffffff;
    background:
        radial-gradient(circle at 15% 20%, rgba(124, 58, 237, .55), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(245, 158, 11, .22), transparent 40%),
        linear-gradient(135deg, var(--night), var(--night-2));
}

/* graph paper + formula tile */
.hero-pattern {
    position: absolute;
    inset: 0;
    background-image:
        url("../img/formulas.svg"),
        linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 600px 440px, 32px 32px, 32px 32px;
    opacity: .16;
    mask-image: linear-gradient(to bottom, #000 60%, transparent);
}

.hero-symbols span {
    position: absolute;
    font-family: var(--math);
    font-style: italic;
    color: rgba(255, 255, 255, .14);
    animation: float 9s ease-in-out infinite;
    user-select: none;
}

.hero-symbols span:nth-child(1) { top: 12%; right: 4%; font-size: 72px; }
.hero-symbols span:nth-child(2) { top: 70%; right: 10%; font-size: 56px; animation-delay: -2s; }
.hero-symbols span:nth-child(3) { top: 8%; left: 44%; font-size: 64px; animation-delay: -4s; }
.hero-symbols span:nth-child(4) { bottom: 8%; left: 40%; font-size: 44px; animation-delay: -1s; }
.hero-symbols span:nth-child(5) { top: 40%; left: 2%; font-size: 60px; animation-delay: -6s; }
.hero-symbols span:nth-child(6) { bottom: 14%; right: 46%; font-size: 48px; animation-delay: -3s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-14px) rotate(6deg); }
}

.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: center;
    gap: 48px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border: 1px solid rgba(253, 230, 138, .45);
    border-radius: 999px;
    background: rgba(253, 230, 138, .1);
    color: var(--gold-soft);
    font-size: .9rem;
    font-weight: 600;
}

.badge .icon { font-size: 1.15em; }

.hero h1 {
    margin: 18px 0 12px;
    font-size: clamp(2.3rem, 5vw, 3.6rem);
    font-weight: 900;
    background: linear-gradient(90deg, #ffffff, #e0e7ff 55%, var(--gold-soft));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-tagline { max-width: 34em; font-size: 1.12rem; color: rgba(255, 255, 255, .82); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero-figure img {
    width: 100%;
    filter: drop-shadow(0 24px 48px rgba(0, 0, 0, .35));
    animation: rise .9s ease-out both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.hero-small { padding: 80px 0; text-align: center; }

/* ---------------------------------------------------------------- buttons */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s, background .2s;
}

.button:hover { transform: translateY(-2px); }

.button-gold {
    background: linear-gradient(135deg, #fbbf24, var(--gold));
    color: #1e1b4b;
    box-shadow: 0 10px 24px rgba(245, 158, 11, .35);
}

.button-gold:hover { box-shadow: 0 14px 30px rgba(245, 158, 11, .45); color: #1e1b4b; }

.button-ghost {
    border-color: rgba(255, 255, 255, .5);
    color: #ffffff;
    background: rgba(255, 255, 255, .06);
}

.button-ghost:hover { background: rgba(255, 255, 255, .14); color: #ffffff; }

/* ---------------------------------------------------------------- highlights (overlap the hero) */

.highlights { position: relative; margin-top: -52px; z-index: 2; }

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
    gap: 18px;
}

.highlight {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.highlight h3 { margin: 0 0 4px; font-size: 1.05rem; }
.highlight p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.8; }

.highlight-icon, .card-icon, .contact-icon {
    display: grid;
    place-items: center;
    flex: none;
    border-radius: 16px;
    background: var(--icon-bg);
    color: var(--primary);
}

.highlight-icon { width: 54px; height: 54px; font-size: 32px; }

/* ---------------------------------------------------------------- sections */

.section { padding: 88px 0; }

.section-grid {
    background-color: var(--surface);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    border-block: 1px solid var(--border);
}

.section-head { margin-bottom: 36px; }

.eyebrow {
    display: inline-block;
    color: var(--gold);
    font-weight: 700;
    font-size: .9rem;
    letter-spacing: .02em;
}

.title {
    position: relative;
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    padding-bottom: 18px;
    margin-bottom: 22px;
}

/* little sine wave under each section title */
.title::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 120px;
    height: 16px;
    background: url("../img/wave.svg") no-repeat;
}

.lead { font-size: 1.06rem; color: var(--muted); }

/* about */
.chips { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 999px;
    background: var(--icon-bg);
    color: var(--primary);
    font-weight: 600;
    font-size: .93rem;
}

.chip .icon { font-size: 1.35em; }

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    align-items: center;
    gap: 56px;
}

.paper {
    padding: 18px 18px 14px;
    background: #fffdf6;
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, .04);
    transform: rotate(-2deg);
    transition: transform .3s;
}

.paper:hover { transform: rotate(0deg) scale(1.02); }

.paper figcaption {
    margin-top: 8px;
    text-align: center;
    color: #6b6f8f;
    font-size: .88rem;
}

/* classes */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 20px;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 28px 24px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--gold));
}

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

.card-icon { width: 60px; height: 60px; margin-bottom: 18px; font-size: 36px; }

.card h3 { font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; line-height: 1.85; }

/* quote band with golden spiral */
.quote {
    position: relative;
    overflow: hidden;
    padding: 96px 0;
    background: linear-gradient(135deg, var(--night-2), var(--night));
    color: #ffffff;
    text-align: center;
}

.quote-spiral {
    position: absolute;
    top: 50%;
    left: -180px;
    width: 640px;
    height: 400px;
    transform: translateY(-50%);
    background: url("../img/golden-spiral.svg") no-repeat center / contain;
    opacity: .35;
}

.quote blockquote { position: relative; margin: 0; }

.quote blockquote::before {
    content: "❝";
    display: block;
    color: var(--gold);
    font-size: 4rem;
    line-height: .6;
    margin-bottom: 18px;
}

.quote p { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; line-height: 1.7; margin: 0; }
.quote footer { margin-top: 14px; color: var(--gold-soft); font-weight: 600; }

/* contact: call to action on the home page */
.cta {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 28px;
    padding: 32px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--night), var(--night-2));
    color: #ffffff;
}
.cta .contact-icon { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; background: rgba(255, 255, 255, .1); color: var(--gold-soft); }
.cta-text { flex: 1 1 260px; }
.cta-text h2 { margin: 0 0 6px; font-size: 1.5rem; }
.cta-text p { margin: 0; color: rgba(255, 255, 255, .8); line-height: 1.9; }

/* contact page and form */
.contact-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; align-items: start; }

.form-card, .contact-aside {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.contact-aside .contact-icon { width: 52px; height: 52px; font-size: 28px; border-radius: 14px; margin-bottom: 14px; }
.contact-aside h2 { font-size: 1.15rem; margin: 0 0 10px; }
.contact-aside p { margin: 0; color: var(--muted); line-height: 1.9; }

.field { display: grid; align-content: start; gap: 6px; margin-bottom: 20px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 18px; }
.field label { font-weight: 700; }
.field .req { color: var(--danger); }
.field .optional { color: var(--muted); font-weight: 400; font-size: .88rem; }
.field-hint { color: var(--muted); font-size: .86rem; }
.field input, .field textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 170px; resize: vertical; line-height: 1.9; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--grid); }
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .88rem; font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.form-actions .button { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.form-note { color: var(--muted); font-size: .86rem; }

/* honeypot: invisible to people, filled by bots (no inline style: CSP) */
.hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; margin-bottom: 22px; border-radius: 14px; border: 1px solid; line-height: 1.9; }
.alert p { margin: 0; }
.alert strong { display: block; }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--text); }
.alert-error { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }

/* 404 */
.not-found { position: relative; }

.not-found-code {
    font-size: clamp(5rem, 16vw, 9rem);
    font-weight: 900;
    line-height: 1;
    color: rgba(255, 255, 255, .9);
}

.not-found-code span { font-family: var(--math); font-style: italic; color: var(--gold-soft); }
.not-found .hero-tagline { margin-inline: auto; }

/* ---------------------------------------------------------------- books (index, book page, home overview) */

.nav a.is-active { background: var(--icon-bg); color: var(--primary); }

.button-small { gap: 6px; padding: 7px 16px; font-size: .9rem; background: var(--primary); color: #ffffff; flex: none; }
.button-small:hover { background: var(--primary-2); color: #ffffff; }
.button-small .icon { font-size: 1.2em; }
.button-outline { border-color: var(--primary); color: var(--primary); background: transparent; }
.button-outline:hover { background: var(--primary); color: #ffffff; }
.more { margin: 36px 0 0; text-align: center; }

.hero-page { text-align: start; padding: 56px 0 64px; }
.hero-page h1 { margin: 10px 0 14px; font-size: clamp(2rem, 4.4vw, 3rem); }
.hero-page .container { position: relative; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .92rem; color: rgba(255, 255, 255, .7); }
.breadcrumb a { color: var(--gold-soft); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.level-jump { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--icon-bg);
    color: var(--primary);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.9;
}
.tags-light { margin-bottom: 14px; }
.tags-light .tag { background: rgba(255, 255, 255, .12); color: #ffffff; border: 1px solid rgba(255, 255, 255, .25); }

/* books index */
.grade + .grade { margin-top: 40px; }
/* a level whose grades have one book each: grades in columns, not a row per book */
.grades-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 32px 20px;
}
.grades-inline .grade + .grade { margin-top: 0; }
.grades-inline .grade { display: flex; flex-direction: column; }
.grades-inline .book-grid { grid-template-columns: minmax(0, 1fr); flex: 1; }
.grade-title { display: flex; align-items: center; gap: 12px; font-size: 1.25rem; margin-bottom: 18px; }
.grade-number {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: var(--gold-soft);
    font-size: 1.15rem;
    font-weight: 800;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
}

.book-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform .25s, box-shadow .25s, border-color .25s;
}

.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--primary); }
.book-card .card-icon { width: 52px; height: 52px; margin: 0; font-size: 30px; }
.book-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.book-card-title { font-weight: 800; font-size: 1.12rem; }
.book-card-text { color: var(--muted); font-size: .92rem; line-height: 1.8; }
.book-card-arrow { color: var(--muted); font-size: 22px; align-self: center; transition: transform .25s, color .25s; }
.book-card:hover .book-card-arrow { color: var(--primary); transform: translateX(-4px); }

/* book page */
.book-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 32px; }
.book-hero-icon {
    display: grid;
    place-items: center;
    width: 150px;
    height: 150px;
    border-radius: 36px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .2);
    color: var(--gold-soft);
    font-size: 96px;
}

.chapters { display: grid; gap: 12px; }

.chapter {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chapter summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
}

.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::after { content: "+"; margin-inline-start: auto; color: var(--primary); font-size: 1.5rem; font-weight: 400; }
.chapter[open] summary::after { content: "−"; }
.chapter[open] summary { border-bottom: 1px solid var(--border); }

.chapter-number {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--icon-bg);
    color: var(--primary);
    font-weight: 800;
}

.chapter-title { display: flex; flex-direction: column; font-weight: 700; line-height: 1.6; }
.chapter-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.chapter-count { padding: 2px 10px; border-radius: 999px; background: var(--icon-bg); color: var(--primary); font-size: .8rem; flex: none; }
.chapter-body { padding: 18px 20px 20px; }
.chapter-body > p { color: var(--muted); }

.lessons { margin: 0 0 16px; padding-inline-start: 22px; color: var(--text); list-style-type: persian; }
.lessons li { padding: 2px 0; }
.lessons li::marker { color: var(--gold); font-weight: 700; }

.resources { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.resource {
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.resource-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.resource-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--icon-bg); color: var(--primary); font-size: 26px; }
.resource-video .resource-icon { color: var(--gold); }
.resource-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.resource-title { font-weight: 700; overflow-wrap: anywhere; }
.resource-meta, .resource-text { color: var(--muted); font-size: .86rem; }
.resource-video video { display: block; width: 100%; margin-top: 12px; border-radius: 12px; background: #000000; aspect-ratio: 16 / 9; }

/* home: books overview */
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }

.level-card {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.level-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; color: var(--text); text-decoration: none; }
.level-head .card-icon { margin: 0; }
.level-title { display: block; font-size: 1.35rem; font-weight: 800; }
.level-subtitle { display: block; color: var(--muted); font-size: .9rem; }
.level-head:hover .level-title { color: var(--primary); }

.level-grades { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.level-grades li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.grade-chip { min-width: 108px; color: var(--gold); font-weight: 700; font-size: .92rem; }
.book-links { display: flex; flex-wrap: wrap; gap: 6px; }
.book-links a {
    padding: 3px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .9rem;
    text-decoration: none;
    transition: background .2s, color .2s, border-color .2s;
}
.book-links a:hover { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.book-links small { margin-inline-start: 6px; color: var(--muted); font-size: .76rem; }
.book-links a:hover small { color: rgba(255, 255, 255, .8); }
.tag-grade { background: var(--gold-soft); color: #7c4a03; }

/* ---------------------------------------------------------------- footer */

.footer {
    position: relative;
    overflow: hidden;
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--primary), var(--primary-2), var(--gold)) 1;
    background: var(--night);
    color: rgba(255, 255, 255, .78);
}

.footer-symbols {
    display: flex;
    justify-content: space-around;
    padding: 18px 20px 0;
    font-family: var(--math);
    font-style: italic;
    font-size: 26px;
    color: rgba(255, 255, 255, .12);
    user-select: none;
}

.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding-top: 18px;
    padding-bottom: 34px;
}

.footer-name { font-weight: 800; color: #ffffff; font-size: 1.05rem; }
.footer-role { font-size: .88rem; }

.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.footer-nav a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.footer-nav a:hover { color: var(--gold-soft); }

/* ---------------------------------------------------------------- responsive & motion */

@media (max-width: 860px) {
    .hero { padding: 48px 0 88px; }
    .hero-inner, .about-grid { grid-template-columns: minmax(0, 1fr); gap: 36px; }
    .hero-text { text-align: center; }
    .hero-tagline { margin-inline: auto; }
    .hero-actions { justify-content: center; }
    .hero-figure { max-width: 460px; margin: 0 auto; }
    .paper { max-width: 380px; margin: 0 auto; }
    .section { padding: 64px 0; }
    .quote-spiral { left: 50%; transform: translate(-50%, -50%); opacity: .3; }
    .book-hero { grid-template-columns: minmax(0, 1fr); }
    .book-hero-icon { display: none; }
    .contact-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
    .brand-role { display: none; }
    .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
    .header-inner { justify-content: center; }
    .nav a { padding: 4px 11px; font-size: .9rem; }
    .hero-symbols span:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}
