:root {
    --navy: #12355b;
    --navy-deep: #0b2440;
    --teal: #0f8b8d;
    --teal-soft: #e8f7f5;
    --gold: #f2b84b;
    --red: #c84b4b;
    --ink: #182230;
    --muted: #627184;
    --line: #dbe3eb;
    --surface: #ffffff;
    --soft: #f4f7fa;
    --radius: 18px;
    --shadow: 0 18px 45px rgba(11, 36, 64, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font-family: Tahoma, Arial, sans-serif; line-height: 1.75; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img, iframe { max-width: 100%; }
.container { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; right: 8px; transform: translateY(-150%); background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; z-index: 50; top: 0; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.header-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 50px; color: #fff; background: var(--red); border-radius: 7px 7px 12px 7px; font-size: 12px; font-weight: 800; box-shadow: 7px 7px 0 #f4d6d6; }
.brand strong, .brand small { display: block; }
.brand strong { color: var(--navy-deep); font-size: 17px; }
.brand small { color: var(--muted); font-size: 11px; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a { padding: 9px 14px; color: #405268; border-radius: 10px; font-size: 14px; font-weight: 700; }
.main-nav a:hover, .main-nav a.active { background: var(--teal-soft); color: #086a6c; }
.nav-toggle { display: none; border: 1px solid var(--line); background: #fff; color: var(--navy); border-radius: 10px; padding: 8px 12px; }

.hero { position: relative; overflow: hidden; padding: 72px 0 66px; color: #fff; background: linear-gradient(125deg, var(--navy-deep), var(--navy) 58%, #126f75); }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .12; background-image: linear-gradient(30deg, transparent 35%, #fff 35%, #fff 36%, transparent 36%); background-size: 58px 58px; }
.hero-grid { position: relative; display: grid; grid-template-columns: 1.45fr .8fr; gap: 62px; align-items: center; }
.hero-kicker, .eyebrow { display: inline-block; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .05em; }
.hero-kicker { color: #b8eeec; }
.hero h1 { max-width: 720px; margin: 12px 0 14px; font-size: clamp(35px, 5vw, 62px); line-height: 1.25; letter-spacing: -.03em; }
.hero-copy > p { margin: 0; color: #dbe9f3; font-size: 18px; }
.hero-search { display: flex; gap: 8px; max-width: 690px; margin-top: 28px; padding: 7px; background: #fff; border-radius: 15px; box-shadow: 0 16px 45px rgba(0,0,0,.18); }
.hero-search input { min-width: 0; flex: 1; padding: 13px 15px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.hero-search input:focus { box-shadow: inset 0 0 0 2px var(--teal); border-radius: 9px; }
.hero-search button { border: 0; border-radius: 10px; padding: 10px 24px; cursor: pointer; background: var(--gold); color: #33260a; font-weight: 800; }
.library-stat { margin-top: 14px !important; font-size: 13px !important; }
.library-stat strong { color: #fff; }
.hero-panel { padding: 25px; color: var(--ink); background: rgba(255,255,255,.96); border: 1px solid rgba(255,255,255,.34); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-panel-title { color: var(--navy); font-weight: 800; }
.hero-panel ol { list-style: none; padding: 0; margin: 17px 0 0; }
.hero-panel li { display: flex; gap: 13px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.hero-panel li b { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); }
.hero-panel li span, .hero-panel li strong, .hero-panel li small { display: block; }
.hero-panel li small { color: var(--muted); }

.section { padding-block: 64px; }
.section-muted { background: var(--soft); }
.section-heading { margin-bottom: 25px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 4px 0 0; color: var(--navy-deep); font-size: clamp(25px, 3vw, 36px); line-height: 1.3; }
.text-link { color: var(--teal); font-weight: 700; }
.result-count { padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 13px; }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.level-card { position: relative; min-height: 245px; overflow: hidden; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: transform .2s, box-shadow .2s, border-color .2s; }
.level-card:hover { transform: translateY(-4px); border-color: #9fcfcd; box-shadow: var(--shadow); }
.level-card::after { content: ""; position: absolute; left: -30px; bottom: -45px; width: 130px; height: 130px; border-radius: 50%; background: var(--teal-soft); }
.level-number { color: var(--teal); font-weight: 800; }
.level-card h3 { margin: 34px 0 6px; color: var(--navy); font-size: 25px; }
.level-card p { margin: 0; color: var(--muted); }
.card-link { position: absolute; z-index: 1; bottom: 24px; right: 30px; color: var(--teal); font-size: 13px; font-weight: 800; }
.level-preparatory { border-top: 4px solid var(--gold); }
.level-primary { border-top: 4px solid var(--teal); }
.level-secondary { border-top: 4px solid var(--navy); }

.notes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; }
.note-card { display: flex; min-height: 225px; flex-direction: column; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 15px; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.note-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.note-card-main { display: flex; gap: 16px; align-items: flex-start; padding: 22px 20px 14px; }
.pdf-icon { flex: 0 0 auto; display: grid; place-items: center; width: 45px; height: 54px; border-radius: 6px 6px 11px 6px; color: #fff; background: var(--red); font-size: 11px; font-weight: 900; }
.note-card-copy { min-width: 0; }
.note-card h3 { margin: 5px 0 7px; color: var(--navy-deep); font-size: 17px; line-height: 1.55; }
.note-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.note-meta { display: flex; justify-content: space-between; gap: 12px; padding: 11px 20px; color: var(--muted); background: #f8fafc; border-top: 1px solid #e8edf2; font-size: 11px; }

.page-hero, .note-heading { padding: 42px 0; background: linear-gradient(180deg, #edf7f7, #fff); border-bottom: 1px solid var(--line); }
.page-hero h1, .note-heading h1 { margin: 6px 0; color: var(--navy-deep); font-size: clamp(31px, 4vw, 50px); line-height: 1.35; }
.page-hero p { margin: 0; color: var(--muted); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 19px; color: var(--muted); font-size: 12px; }
.breadcrumbs a:hover { color: var(--teal); }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.filter-card { display: flex; justify-content: space-between; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-right: 4px solid var(--teal); border-radius: 12px; background: #fff; }
.filter-card:hover { border-color: var(--teal); }
.filter-card span { color: var(--navy); font-weight: 800; }
.filter-card small { color: var(--muted); white-space: nowrap; }
.state-card { padding: 28px; text-align: center; border: 1px dashed #b8c7d5; border-radius: var(--radius); background: #fff; }
.state-card strong { color: var(--navy); font-size: 18px; }
.state-card p { margin: 6px 0 0; color: var(--muted); }
.error-state { border-color: #e4b2b2; background: #fff8f8; }
.error-state strong { color: #9b3333; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 30px; }
.pagination a { padding: 8px 16px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--teal); font-weight: 700; }
.pagination span { color: var(--muted); font-size: 13px; }

.note-title-row { display: flex; gap: 18px; align-items: flex-start; }
.large-pdf-icon { display: grid; place-items: center; flex: 0 0 64px; height: 78px; border-radius: 8px 8px 16px 8px; color: #fff; background: var(--red); font-size: 14px; font-weight: 900; box-shadow: 9px 9px 0 #f0cdcd; }
.note-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.note-facts span { padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 12px; }
.note-facts strong { color: var(--navy); }
.note-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 24px; align-items: start; }
.note-main, .info-card, .action-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.viewer-toolbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.viewer-toolbar strong, .viewer-toolbar small { display: block; }
.viewer-toolbar small { color: var(--muted); }
.pdf-viewer { height: min(78vh, 920px); min-height: 620px; background: #354052; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.pdf-viewer iframe { width: 100%; height: 100%; border: 0; }
.note-sidebar { display: grid; gap: 16px; }
.info-card, .action-card { padding: 22px; box-shadow: none; }
.info-card h2 { margin: 5px 0 10px; color: var(--navy); font-size: 20px; }
.info-card p, .action-card p { color: var(--muted); font-size: 14px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 43px; border: 1px solid transparent; border-radius: 10px; padding: 9px 17px; cursor: pointer; font-weight: 800; }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: #0b7678; }
.button-ghost { border-color: var(--line); color: var(--navy); background: #fff; }
.button-block { width: 100%; margin-top: 8px; }
.search-page-form { max-width: 780px; }
.prose-card { max-width: 900px; }
.prose-card h2 { margin: 30px 0 7px; color: var(--navy); }
.prose-card p { color: #435469; }
.prose-card a { color: var(--teal); text-decoration: underline; }
.muted { color: var(--muted) !important; }
.not-found { padding: 70px 20px; text-align: center; }
.not-found > span { display: block; color: #d6e6e5; font-size: 100px; font-weight: 900; line-height: 1; }
.not-found h1 { margin: 8px 0; color: var(--navy); }
.not-found p { color: var(--muted); }

.site-footer { padding: 42px 0 16px; color: #dce8f2; background: var(--navy-deep); }
.footer-grid { display: flex; justify-content: space-between; gap: 35px; }
.footer-grid strong { color: #fff; font-size: 18px; }
.footer-grid p { max-width: 520px; margin: 5px 0; color: #aebed0; }
.footer-grid nav { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 17px; }
.footer-grid a:hover { color: #fff; }
.copyright { margin-top: 27px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); color: #8ea2b8; font-size: 12px; }

@media (max-width: 900px) {
    .hero-grid, .note-layout { grid-template-columns: 1fr; }
    .hero-panel { max-width: 630px; }
    .level-grid, .notes-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-grid { grid-template-columns: repeat(3, 1fr); }
    .note-sidebar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
    .header-row { min-height: 68px; }
    .brand small { display: none; }
    .nav-toggle { display: block; }
    .main-nav { display: none; position: absolute; top: 68px; right: 16px; left: 16px; padding: 10px; flex-direction: column; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
    .main-nav.open { display: flex; }
    .hero { padding: 48px 0; }
    .hero-grid { gap: 30px; }
    .hero h1 { font-size: 36px; }
    .hero-search { flex-direction: column; }
    .hero-search button { min-height: 45px; }
    .section { padding-block: 46px; }
    .level-grid, .notes-grid, .filter-grid, .note-sidebar { grid-template-columns: 1fr; }
    .level-card { min-height: 210px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .filter-card { padding: 14px; }
    .note-title-row { display: block; }
    .large-pdf-icon { margin-bottom: 22px; }
    .viewer-toolbar { align-items: stretch; flex-direction: column; }
    .pdf-viewer { min-height: 500px; }
    .footer-grid { flex-direction: column; }
}

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

/* SEO/content hierarchy improvements */
.seo-copy-card,
.note-content-card {
    margin-top: 28px;
    padding: 25px 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.seo-copy-card h2,
.note-content-card h2,
.note-content-card h3 {
    margin: 5px 0 10px;
    color: var(--navy-deep);
    line-height: 1.45;
}
.seo-copy-card p,
.note-content-card p {
    margin: 0;
    color: #435469;
    line-height: 1.95;
}
.home-seo-copy { margin-top: 38px; }
.grade-links-section { margin-top: 42px; }
.context-links {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}
.context-links a {
    padding: 8px 12px;
    border: 1px solid #cfe2e2;
    border-radius: 999px;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 13px;
    font-weight: 800;
}
.context-links a:hover { border-color: var(--teal); }
.context-links-wide { gap: 10px; }
.note-primary-column { display: grid; gap: 20px; min-width: 0; }
.note-content-card { margin-top: 0; box-shadow: var(--shadow); }
.extracted-content { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.fact-list { margin: 15px 0 0; }
.fact-list div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.fact-list dt { color: var(--muted); }
.fact-list dd { margin: 0; color: var(--navy); font-weight: 800; text-align: left; }
.fact-list a { color: var(--teal); }
.pagination-pages { display: flex; align-items: center; gap: 7px; }
.pagination-pages a,
.pagination-pages .current {
    min-width: 36px;
    min-height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--navy);
    font-weight: 800;
}
.pagination-pages .current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination-pages > span:not(.current) { color: var(--muted); }

@media (max-width: 680px) {
    .seo-copy-card, .note-content-card { padding: 20px; }
    .pagination { flex-wrap: wrap; gap: 10px; }
    .pagination-pages { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
    .fact-list div { align-items: flex-start; }
}
