/* Layout: fixed navy brand bar, sticky contents rail on the left, one reading column of chapters.
   Brand = the product's own navy + saffron, Rajdhani headings + Noto Sans text (as in the app). */
:root {
  --paper: #EEF2F7; --surface: #FFFFFF; --ink: #0F1B2D; --muted: #56677F; --line: #D8E0EA;
  --navy: #0A1628; --navy-2: #13284A; --on-navy: #E8EEF7; --on-navy-muted: #A9B8CE;
  --saffron: #F59E0B; --saffron-ink: #A35A06; --saffron-wash: #FFF4DE;
  --ok: #157F4A; --warn: #B42318; --warn-wash: #FDECEA; --code: #E9EEF5;
  --f-display: 'Rajdhani', 'Noto Sans', system-ui, sans-serif;
  --f-body: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --rail: 288px; --col: 860px; --bar-h: 60px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0A1628; --surface: #0F1F3D; --ink: #E6ECF5; --muted: #98A8C0; --line: #213659;
  --navy: #060F1D; --navy-2: #102345; --on-navy: #E8EEF7; --on-navy-muted: #9FB0C8;
  --saffron: #F5A524; --saffron-ink: #FBBF24; --saffron-wash: #2A2412;
  --ok: #4ADE80; --warn: #F87171; --warn-wash: #2B1517; --code: #18294A; color-scheme: dark } }
:root[data-theme="dark"] {
  --paper: #0A1628; --surface: #0F1F3D; --ink: #E6ECF5; --muted: #98A8C0; --line: #213659;
  --navy: #060F1D; --navy-2: #102345; --on-navy: #E8EEF7; --on-navy-muted: #9FB0C8;
  --saffron: #F5A524; --saffron-ink: #FBBF24; --saffron-wash: #2A2412;
  --ok: #4ADE80; --warn: #F87171; --warn-wash: #2B1517; --code: #18294A; color-scheme: dark }

* { box-sizing: border-box }
html { scroll-padding-top: calc(var(--bar-h) + 16px) }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.65 var(--f-body); margin: 0 }
a { color: inherit }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; line-height: 1.15; margin: 0 }
code { font: 500 .86em var(--f-mono); background: var(--code); padding: .1em .4em; border-radius: 5px }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 4px }

/* ── brand bar ── */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--navy) }
.bar-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--navy); color: var(--on-navy);
  border-bottom: 3px solid var(--saffron); }
.bar-in { height: var(--bar-h); display: flex; align-items: center; gap: 14px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0 }
.brand img { width: 38px; height: 38px; border-radius: 9px; background: #fff; padding: 3px }
.brand b { font: 700 21px/1 var(--f-display); color: var(--saffron); white-space: nowrap }
.brand span { font-size: 12.5px; color: var(--on-navy-muted); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap }
.bar-in .sp { flex: 1 }
.search { position: relative; width: min(360px, 42vw) }
.search input { width: 100%; height: 38px; border-radius: 9px; border: 1px solid var(--navy-2); background: var(--navy-2); color: var(--on-navy);
  padding: 0 12px 0 34px; font: inherit; font-size: 14px }
.search input::placeholder { color: var(--on-navy-muted) }
.search svg { position: absolute; left: 10px; top: 11px; width: 16px; height: 16px; fill: var(--on-navy-muted) }
.results { position: absolute; top: 44px; right: 0; width: min(440px, 92vw); max-height: 60vh; overflow: auto; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 40px rgba(6, 15, 29, .28); padding: 6px }
.results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; font-size: 14px }
.results a:hover, .results a.on { background: var(--saffron-wash) }
.results small { display: block; color: var(--muted); font-size: 12px }
.icon-btn { height: 38px; min-width: 38px; border-radius: 9px; border: 1px solid var(--navy-2); background: transparent; color: var(--on-navy); font: 600 14px var(--f-body); cursor: pointer; padding: 0 10px }
.toc-btn { display: none }

/* ── frame ── */
.wrap { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: 40px; max-width: calc(var(--rail) + var(--col) + 120px); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.rail { position: sticky; top: calc(var(--bar-h) + 3px + env(safe-area-inset-top, 0px)); align-self: start; height: calc(100vh - var(--bar-h) - 3px); overflow: auto; padding-block: 22px 40px; font-size: 14px }
.rail ol, .rail ul { list-style: none; margin: 0; padding: 0 }
.rail .part > p { font: 700 12px var(--f-body); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 18px 0 6px }
.rail a { display: flex; gap: 8px; padding: 5px 8px; border-radius: 7px; text-decoration: none; color: var(--ink) }
.rail a .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6em }
.rail a:hover { background: var(--surface) }
.rail a.on { background: var(--saffron-wash); color: var(--saffron-ink); font-weight: 600 }
main { min-width: 0; max-width: var(--col); padding-block: 26px 80px }

/* ── cover ── */
.cover { background: var(--navy); color: var(--on-navy); border-radius: 18px; padding: 34px 34px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  position: relative; overflow: hidden }
.cover::after { content: ""; position: absolute; right: -80px; top: -120px; width: 360px; height: 360px; border-radius: 50%; border: 46px solid rgba(245, 158, 11, .12) }
.cover .kicker { font: 700 13px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--saffron) }
.cover h1 { font-size: clamp(38px, 6vw, 58px); color: #fff; margin: 8px 0 10px }
.cover p { color: var(--on-navy-muted); max-width: 52ch; margin: 0 }
.cover .facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 20px; font-size: 14px }
.cover .facts b { color: #fff; font-family: var(--f-display); font-size: 22px; margin-right: 4px }
.cover .school { position: relative; z-index: 1; display: grid; justify-items: center; gap: 8px; text-align: center; background: var(--navy-2); border-radius: 14px; padding: 18px 20px; width: 210px }
.cover .school img { width: 92px; height: 92px }
.cover .school b { font: 700 18px var(--f-display); color: #fff }
.cover .school span { font-size: 12.5px; color: var(--on-navy-muted) }

/* ── chapters ── */
.chapter { margin-top: 56px; padding-top: 8px }
.ch-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px }
.eyebrow { font: 700 12.5px var(--f-body); text-transform: uppercase; letter-spacing: .1em; color: var(--saffron-ink); margin: 0 0 6px }
.ch-head h2 { font-size: clamp(30px, 4.2vw, 40px) }
.ch-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--muted) }
.who { display: flex; flex-wrap: wrap; gap: 6px }
.role { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600 }
.menu .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; margin-right: 4px }
.menu b { color: var(--ink) }
.lead { font-size: 17.5px; max-width: 68ch }
.sec { margin-top: 30px }
.sec h3 { font-size: 24px; margin-bottom: 8px }
.sec > p { max-width: 68ch; margin: 6px 0 }

.steps { list-style: none; counter-reset: s; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px }
.steps > li { counter-increment: s; position: relative; padding-left: 44px; min-width: 0 }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 28px; height: 28px; border-radius: 50%; background: var(--saffron); color: #111;
  font: 700 15px/28px var(--f-display); text-align: center }
.steps > li > p { margin: 2px 0 0; max-width: 66ch }

.shot { margin: 12px 0 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: 0 8px 22px rgba(10, 22, 40, .08) }
.shot .bar { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 12px; background: var(--code); border-bottom: 1px solid var(--line) }
.dots { display: flex; gap: 6px } .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line) }
.addr { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 10px; border-radius: 6px; background: var(--surface); color: var(--muted);
  font: 500 12.5px var(--f-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.addr svg { width: 12px; height: 12px; fill: var(--ok); flex: none }
.shot img { display: block; width: 100%; height: auto; cursor: zoom-in }
.shot.hero { margin-top: 18px }
figcaption { font-size: 13.5px; color: var(--muted); margin: 8px 2px 0 }
.steps figcaption { margin-left: 2px }

.ref { display: grid; gap: 0; margin: 10px 0 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden }
.ref > div { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 16px; padding: 11px 16px; border-top: 1px solid var(--line) }
.ref > div:first-child { border-top: 0 }
.ref dt { font-weight: 700 } .ref dd { margin: 0; color: var(--ink) }

.note { display: flex; gap: 10px; align-items: baseline; padding: 11px 14px; border-radius: 10px; margin: 14px 0 0; max-width: 72ch; background: var(--saffron-wash) }
.note .lbl { font: 700 11.5px var(--f-body); text-transform: uppercase; letter-spacing: .08em; color: var(--saffron-ink); flex: none }
.note.warn { background: var(--warn-wash) } .note.warn .lbl { color: var(--warn) }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 2px } .faq summary { font-weight: 600; cursor: pointer }
.faq details p { margin: 8px 0 2px; max-width: 68ch }

.login-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden }
.login-table th, .login-table td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line) }
.tbl { overflow-x: auto }

footer.site { background: var(--navy); color: var(--on-navy-muted); font-size: 13.5px; border-top: 3px solid var(--saffron) }
footer.site .in { max-width: calc(var(--rail) + var(--col) + 120px); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-block: 22px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
footer.site b { color: var(--saffron) }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(4, 10, 20, .88); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); cursor: zoom-out }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff }

@media (max-width: 980px) {
  .wrap { grid-template-columns: minmax(0, 1fr) }
  .rail { position: fixed; z-index: 25; top: calc(var(--bar-h) + 3px + env(safe-area-inset-top, 0px)); left: 0; bottom: 0; width: min(320px, 86vw); height: auto;
    background: var(--paper); border-right: 1px solid var(--line); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; transform: translateX(-102%); transition: transform .2s }
  body.toc-open .rail { transform: none; box-shadow: 0 0 0 100vmax rgba(6, 15, 29, .4) }
  .toc-btn { display: inline-block }
  .brand span { display: none }
}
@media (max-width: 640px) {
  .cover { grid-template-columns: minmax(0, 1fr); padding: 24px 20px } .cover .school { width: auto; grid-template-columns: auto 1fr; justify-items: start; text-align: left }
  .cover .school img { width: 56px; height: 56px; grid-row: span 2 }
  .ref > div { grid-template-columns: minmax(0, 1fr); gap: 2px }
  .search { width: auto; flex: 1 } .bar-in .sp { display: none } .brand b { font-size: 18px }
  .steps > li { padding-left: 38px }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important } }

/* ── website edition extras ── */
.skip { position: absolute; left: -999px; top: 8px; z-index: 40; background: var(--saffron); color: #111; padding: 8px 12px; border-radius: 8px; font-weight: 700 }
.skip:focus { left: 12px }
a.icon-btn { display: inline-flex; align-items: center; text-decoration: none }
.rail-home { font-weight: 700; color: var(--saffron-ink) !important; margin-bottom: 4px }
.chapter { margin-top: 0 }
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px }
.pn a { display: block; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 16px; text-decoration: none; font-weight: 600 }
.pn a:hover { border-color: var(--saffron) }
.pn small { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700 }
.pn .next { text-align: right }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px }
.btn-s, .btn-o { display: inline-flex; align-items: center; height: 42px; padding: 0 18px; border-radius: 10px; font-weight: 700; text-decoration: none }
.btn-s { background: var(--saffron); color: #111 } .btn-o { border: 1px solid rgba(255,255,255,.35); color: #fff }
.toc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 18px; margin-top: 30px }
.toc-part { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px }
.toc-part h2 { font-size: 22px; color: var(--saffron-ink); margin-bottom: 6px }
.toc-part ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px }
.toc-part a { display: block; padding: 7px 8px; border-radius: 8px; text-decoration: none }
.toc-part a:hover { background: var(--saffron-wash) }
.toc-part b { display: block; font-size: 15px } .toc-part span { display: block; font-size: 13px; color: var(--muted); line-height: 1.45 }
footer.site a { color: inherit }
@media (max-width: 640px) { .pn { grid-template-columns: 1fr } .pn .next { text-align: left } .top-link { display: none } }
@media (max-width: 640px) { .bar-in .top-link { display: none !important } }
@media (max-width: 520px) { .brand b { display: none } .brand { flex: none } }
