/*
  chemwithvikee HSC: ChaiUI layer (the chaicode.com look), loaded after style.css.
  Dark by default (html.dark), light on request. Neutral near-black, white type,
  one cream highlight, warm hairline cards with no shadow, orange only in the logo,
  link hovers and the badge glint. Right/wrong colours are text and thin outlines only.
*/
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --text: #0a0a0a;
  --muted: #525252;
  --line: #e5e5e5;
  --good: #15803d;
  --good-bg: transparent;
  --bad: #b91c1c;
  --bad-bg: transparent;
  --focus: #a3a3a3;
  --orange-ink: #854d0e;            /* highlight: yellow-800 */
  --orange-soft: #f5f5f5;
  --shadow-sm: none;
  --shadow: none;
  --font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;

  --c-display: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --c-brand-font: "Onest", "Manrope", sans-serif;
  --c-primary: #171717;
  --c-on-primary: #fafafa;
  --c-highlight: #854d0e;
  --c-edge: rgb(120 53 15 / .15);
  --c-edge-hover: rgb(120 53 15 / .28);
  --c-fill: rgb(255 255 255 / .7);
  --c-seg-on: #ffedd5;              /* orange-100 */
  --c-seg-on-fg: #7c2d12;           /* orange-900 */
  --c-brand: #ea580c;
}
.dark {
  --bg: #0a0a0a;
  --surface: #0f0f0f;
  --surface-2: #1a1a1a;
  --text: #fafafa;
  --muted: #a3a3a3;
  --line: rgb(255 255 255 / .1);
  --good: #4ade80;
  --bad: #f87171;
  --focus: #737373;
  --orange-ink: #ffedd5;
  --orange-soft: #1a1a1a;

  --c-primary: #e5e5e5;
  --c-on-primary: #171717;
  --c-highlight: #ffedd5;           /* orange-100 */
  --c-edge: rgb(255 247 237 / .15);
  --c-edge-hover: rgb(255 247 237 / .3);
  --c-fill: rgb(0 0 0 / .1);
  --c-seg-on: rgb(124 45 18 / .4);  /* orange-900/40 */
  --c-seg-on-fg: #ffedd5;
  --c-brand: #fb923c;
}

/* ---------- base ---------- */
body { position: relative; isolation: isolate; overflow-x: clip; font-family: var(--font); background: var(--bg); color: var(--text); }
h1, h2, h3, h4 { font-family: var(--font); font-weight: 600; letter-spacing: -0.02em; }
a { color: var(--text); text-underline-offset: 3px; transition: color .2s; }
a:hover { color: var(--c-brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link { background: var(--c-primary); color: var(--c-on-primary); }
.mono { font-family: var(--mono); }

/* the highlight phrase: one per paragraph */
.hl, .hero .lead .hl, .page-hero .hl, .tip .hl, .cta-band .hl {
  background: none; padding: 0; font-family: var(--c-display); font-weight: 500;
  letter-spacing: -0.025em; text-transform: capitalize; color: var(--c-highlight);
}

/* the chaicode background, centred at the top and fading out */
.chai-backdrop {
  position: absolute; top: 0; left: 50%; width: 2842px; max-width: none; height: auto;
  transform: translateX(-50%); z-index: -50; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
html:not(.dark) .chai-backdrop { filter: invert(1) hue-rotate(180deg); }

/* ---------- header: sticky, transparent, blurs only after scrolling ---------- */
.site-header { background: transparent; color: var(--text); border-bottom: 1px solid transparent; box-shadow: none; transition: background-color .3s, backdrop-filter .3s, border-color .3s; }
.site-header.scrolled { background: color-mix(in srgb, var(--bg) 60%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom-color: var(--line); box-shadow: none; }
.logo { color: var(--text); }
.wordmark { font-family: var(--c-brand-font); font-weight: 600; letter-spacing: -0.02em; }
.wordmark .w { color: var(--muted); }
.hsc-tag { background: transparent; color: var(--muted); border: 1px solid var(--line); font-family: var(--mono); font-weight: 500; letter-spacing: .04em; border-radius: 6px; }
.nav a { color: var(--muted); font-weight: 600; border-radius: 0; background: transparent; }
.nav a:hover { background: transparent; color: var(--c-brand); }
.nav a.active { background: transparent; color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
.nav a.nav-ext { border: 0; }
.icon-btn { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 10px 0 10px 0; }
.icon-btn:hover { background: transparent; border-color: var(--c-edge-hover); }
/* half-circle theme switcher: one icon for both themes */
[data-theme-toggle] svg { display: none; }
[data-theme-toggle]::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%); transition: transform .3s;
}
html:not(.dark) [data-theme-toggle]::before { transform: rotate(180deg); }
@media (max-width: 760px) {
  .nav { background: color-mix(in srgb, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid var(--line); box-shadow: none; }
  .nav a.active { box-shadow: none; background: var(--surface-2); border-radius: 8px; }
}

/* ---------- buttons ---------- */
.btn { font-family: var(--font); font-weight: 600; font-size: .92rem; min-height: 40px; box-shadow: none; }
.btn-solid { background: var(--c-primary); color: var(--c-on-primary); border-radius: 0 10px 0 10px; box-shadow: none; }
.btn-solid:hover { background: #000; color: #fff; }
.dark .btn-solid:hover { background: #d4d4d4; color: #0a0a0a; }
.btn-outline, .hero .btn-outline, .page-hero .btn-outline, .cta-band .btn-outline { background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 10px 0 10px 0; }
.btn-outline:hover, .hero .btn-outline:hover, .cta-band .btn-outline:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
/* on cards: the shadcn default */
.btn-soft, .dark .btn-soft { background: var(--c-primary); color: var(--c-on-primary); border-radius: 8px; }
.btn-soft:hover, .dark .btn-soft:hover { background: color-mix(in srgb, var(--c-primary) 88%, var(--bg)); color: var(--c-on-primary); }
.btn-muted { background: var(--surface-2); color: var(--text); border-radius: 8px; }
.btn-muted:hover { background: color-mix(in srgb, var(--text) 10%, var(--bg)); color: var(--text); }
.btn-ghost { border-radius: 8px; }

/* ---------- hero: one central element ---------- */
.hero { background: transparent; color: var(--text); overflow: visible; }
.hero::before { display: none; }
.hero .wrap { display: block; padding-block: 72px 56px; }
.hero-main { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-width: 54rem; }
.hero h1 { font-size: 42px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; margin: 20px 0 12px; color: var(--text); }
@media (min-width: 768px) { .hero h1 { font-size: 60px; } }
@media (min-width: 1024px) { .hero h1 { font-size: 72px; } }
.hero .lead { font-size: 1rem; color: var(--muted); max-width: 46rem; margin: 8px 0 28px; }
@media (min-width: 768px) { .hero .lead { font-size: 1.25rem; } }
html:not(.dark) .hero .lead { color: #404040; }

/* animated badge: a 1px orange glint travelling round the border */
.abadge { position: relative; display: inline-flex; width: fit-content; overflow: hidden; border-radius: 999px; padding: 1px; background: var(--line); }
.abadge-glint { position: absolute; top: 50%; left: 50%; width: 300px; height: 20px; border-radius: 999px; transform: translate(-50%, -50%); background: linear-gradient(90deg, transparent, transparent, #f97316); animation: chai-spin 4s linear infinite; }
.abadge-in { position: relative; z-index: 1; border-radius: 999px; padding: 8px 16px; font-size: .88rem; font-weight: 500; background: #fafafa; color: #262626; }
.dark .abadge-in { background: #1c1917; color: #f5f5f5; }
@keyframes chai-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- stats ---------- */
.stat-strip { margin-top: 0; }
.stat-strip > div { background: var(--c-fill); border: 1px solid var(--c-edge); box-shadow: none; border-radius: 14px; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.stat-strip .s-ico { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; }
.stat-strip b { font-family: var(--c-display); font-weight: 600; }

/* ---------- sections and cards ---------- */
.eyebrow { text-transform: none; letter-spacing: -0.01em; font-family: var(--c-display); font-weight: 500; font-size: .98rem; color: var(--c-highlight); }
.section-head h2 { font-size: 1.5rem; font-weight: 500; }
@media (min-width: 640px) { .section-head h2 { font-size: 30px; } }
.section-head p { color: var(--muted); }
.card {
  background: var(--c-fill); border: 1px solid var(--c-edge); border-radius: 14px; box-shadow: none;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); transition: border-color .3s, opacity .3s;
}
.card:hover { border-color: var(--c-edge-hover); }
@media (min-width: 640px) {
  .class-card, .step, .contact-item, .num-band { opacity: .9; }
  .class-card:hover, .step:hover, .contact-item:hover, .num-band:hover, .class-card:focus-within, .num-band:focus-within { opacity: 1; }
}
.chip { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }

/* class cards */
.class-card .cc-head, .class-card.matric .cc-head { background: transparent; color: var(--text); border-bottom: 1px solid var(--c-edge); }
.class-card .cc-head::after { color: color-mix(in srgb, var(--text) 6%, transparent); font-family: var(--c-display); }
.class-card .cc-head .chip { background: transparent; color: var(--muted); }
.class-card h3 { font-family: var(--c-display); font-weight: 600; }
.chapter-list a { font-weight: 500; }
.chapter-list a:hover { background: var(--surface-2); color: var(--text); }

/* chapter tiles: neutral, the symbol carries it */
.tile, .dark .tile {
  background: transparent; border: 1px solid var(--c-edge-hover); color: var(--text);
  font-family: var(--c-display); font-weight: 600;
}
.tile small { color: var(--muted); opacity: 1; }

/* numericals band */
.num-band { background: var(--c-fill); border: 1px solid var(--c-edge); box-shadow: none; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.num-band::before { display: none; }
.num-chapters a { color: var(--text); }
.num-chapters a:hover { background: var(--surface-2); }
.num-chapters small { color: var(--muted); }

/* steps and call to action */
.step .num { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; font-family: var(--c-display); font-weight: 600; }
.cta-band { background: var(--c-fill); color: var(--text); border: 1px solid var(--c-edge); box-shadow: none; }
.cta-band::before, .cta-band::after { display: none; }
.cta-band h2 { color: var(--text); font-weight: 500; }
.cta-band p { color: var(--muted); }

/* contact */
.contact-item .ci-icon { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; }
.input { background: transparent; border-color: var(--line); color: var(--text); }
.input:focus { border-color: var(--muted); box-shadow: none; }

/* footer with the 10% warm hairline */
.site-footer { position: relative; background: transparent; color: var(--muted); font-family: var(--c-display); border-top: 0; }
.site-footer::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 100%; max-width: 1440px; height: 1px; transform: translateX(-50%);
  background: #d97706; opacity: .1; -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 40%, #000 60%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0%, #000 40%, #000 60%, transparent 100%);
}
.dark .site-footer::before { background: #fdba74; }
.site-footer .logo, .site-footer nav a { color: var(--text); }
.site-footer nav a:hover, .site-footer .tagline a:hover { color: var(--c-brand); }
.site-footer .tagline a { color: var(--text); }

/* ---------- inner pages: centred page title ---------- */
.page-hero { background: transparent; color: var(--text); text-align: center; }
.page-hero::before, .page-hero::after { display: none; }
.page-hero .wrap { padding-block: 48px 24px; }
.page-hero h1 { font-size: 1.5rem; font-weight: 500; margin: 6px 0 12px; }
@media (min-width: 640px) { .page-hero h1 { font-size: 1.875rem; } }
.page-hero p { color: var(--muted); max-width: 48rem; margin-inline: auto; font-size: 1rem; }
@media (min-width: 768px) { .page-hero p { font-size: 1.2rem; } }
.page-hero .eyebrow { color: var(--c-highlight); }

/* segmented control (Part I / Part II, review filter) */
.seg { padding: 0; gap: 0; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.dark .seg { background: rgb(0 0 0 / .5); }
.seg button { border-radius: 0; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--c-seg-on); color: var(--c-seg-on-fg); box-shadow: none; }

/* notes */
.ch-nav, .note { background: var(--c-fill); border: 1px solid var(--c-edge); box-shadow: none; }
.ch-list button { color: var(--text); font-weight: 500; }
.ch-list button:hover { background: var(--surface-2); }
.ch-list button.on { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--text); }
.note-top { background: transparent; border-bottom-color: var(--c-edge); }
.note-top h2 { font-weight: 600; }
.note h3 { font-weight: 600; }
.note h3::before { background: var(--muted); width: 6px; height: 6px; border-radius: 1px; }
.note li::marker { color: var(--muted); }
.def { background: var(--surface-2); border-left: 0; border: 1px solid var(--line); }
.def b { color: var(--text); }
.eq, .dark .eq { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.solved { border: 1px dashed var(--line); background: transparent; }
.solved .q { color: var(--text); }
.tip { background: transparent; color: var(--text); border: 1px solid var(--c-edge); }
.tip::before { background: transparent; color: var(--c-highlight); border: 1px solid var(--c-edge-hover); }
table th { background: var(--surface-2); color: var(--text); }
.table-wrap { border-color: var(--line); }

/* ---------- MCQ test ---------- */
.setup, .q-card, .result-hero, .review-item { background: var(--c-fill); border-color: var(--c-edge); box-shadow: none; }
.hint { background: transparent; }
#s-hint { background: transparent; border: 1px solid var(--line); border-left-width: 1px; color: var(--muted); }
.check input { accent-color: var(--text); }
.timer { background: transparent; border-color: var(--line); color: var(--text); }
.timer.low { background: transparent; }
.progress { background: var(--surface-2); }
.progress div { background: var(--text); }
.q-meta { background: transparent; border: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-weight: 500; }
.opt { background: transparent; border-color: var(--line); color: var(--text); }
.opt:hover:not(:disabled) { border-color: var(--c-edge-hover); background: var(--surface-2); }
.opt .key { background: var(--surface-2); color: var(--text); font-family: var(--mono); }
.opt.sel, .dark .opt.sel { border-color: var(--text); background: var(--surface-2); }
.opt.sel .key, .dark .opt.sel .key { background: var(--text); color: var(--bg); }
.opt.right { background: transparent; border-color: var(--good); }
.opt.right .key { background: transparent; color: var(--good); border: 1px solid var(--good); }
.opt.wrong { background: transparent; border-color: var(--bad); }
.opt.wrong .key { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.explain { background: var(--surface-2); border-color: var(--line); }
.palette button { background: transparent; border-color: var(--line); color: var(--muted); }
.palette button.done { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.palette button.cur { border-color: var(--text); color: var(--text); box-shadow: none; }
.result-hero.great { background: var(--c-fill); }
.confetti { display: none; }
.grade-pill, .dark .grade-pill { background: transparent; border: 1px solid var(--c-edge-hover); color: var(--c-highlight); font-family: var(--c-display); font-weight: 600; }
.stat { background: transparent; border: 1px solid var(--line); }
.badge, .badge.ok, .badge.no, .badge.skip { background: transparent; border: 1px solid currentColor; text-transform: none; letter-spacing: 0; }
.history li { border-color: var(--line); }

/* ---------- numericals ---------- */
.method li { background: var(--c-fill); border-color: var(--c-edge); box-shadow: none; }
.method b { background: transparent; color: var(--text); border: 1px solid var(--line); font-family: var(--c-display); }
.formula { background: var(--surface-2); border-top: 1px solid var(--line); border: 1px solid var(--line); }
.qno, .dark .qno { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.worked, .practice { border-color: var(--line); background: transparent; }
.wsteps li { background: var(--surface-2); }
.wsteps li::before { background: transparent; color: var(--text); border: 1px solid var(--line); }
.answer-box { background: transparent; color: var(--text); border: 1px solid var(--c-edge-hover); }
.answer-box span { background: transparent; color: var(--c-highlight); border: 1px solid var(--c-edge-hover); }
.hint, .solution { background: var(--surface-2); border-left: 0; border: 1px solid var(--line); }
.practice-score { background: transparent; border: 1px solid currentColor; }
.practice.is-done .qno { border-color: var(--good); }

@media (prefers-reduced-motion: reduce) {
  .abadge-glint { animation: none; }
}
@media print {
  .chai-backdrop { display: none; }
}
