/* ═══════════════════════════════════════════════════════════════
   NEPSE TRADING ACADEMY — shell, dashboard, module tree, lesson
   © 2026 Shital Ghimire. All rights reserved.

   Hairlines instead of boxes. One accent. Room to breathe.
   ═══════════════════════════════════════════════════════════════ */

.shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── header ────────────────────────────────────────────────── */
.chead {
  position: sticky; top: 0; z-index: 40;
  background: rgba(16, 15, 13, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: var(--hairline);
}
.chead__bar {
  display: flex; align-items: center; gap: var(--s5);
  height: 62px;
}
.chead__home {
  font-family: var(--f-data); font-size: var(--t-cap);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-4);
  white-space: nowrap; transition: color 160ms var(--ease);
}
.chead__home:hover { color: var(--paper-2); }

.wordmark {
  font-family: var(--f-display);
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.025em;
  white-space: nowrap; color: var(--paper);
}
/* crimson use 1 of 3 — the NEPSE wordmark */
.wordmark em { font-style: normal; color: var(--crimson); font-weight: 700; }

.chead__spacer { flex: 1; }

.chead__nav { display: flex; align-items: center; gap: var(--s2); }
.chead__nav a {
  font-family: var(--f-data); font-size: var(--t-cap);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper-4); padding: 6px var(--s3);
  border-radius: var(--radius);
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
  white-space: nowrap;
}
.chead__nav a:hover { color: var(--paper); background: var(--ink-800); }
.chead__nav a[aria-current="page"] { color: var(--gold); }

.chead__xp {
  font-family: var(--f-data); font-size: var(--t-cap);
  color: var(--paper-3); white-space: nowrap;
  padding-left: var(--s4); border-left: var(--hairline);
}
.chead__xp b { color: var(--gold); font-weight: 600; font-size: var(--t-sm); }
.chead__xp i { font-style: normal; letter-spacing: 0.12em; }

@media (max-width: 1080px) { .chead__nav a:nth-child(n+4) { display: none; } }
@media (max-width: 720px) {
  .chead__bar { height: 54px; gap: var(--s3); }
  .chead__home, .chead__nav { display: none; }
}

/* ── ticker: quiet, and it runs off both edges ─────────────── */
.ticker {
  overflow: hidden; border-bottom: var(--hairline);
  background: var(--ink-850);
  --tick-h: 30px; height: var(--tick-h);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker__run {
  display: flex; gap: var(--s6); align-items: center; height: var(--tick-h);
  width: max-content; animation: tickscroll 90s linear infinite;
}
.ticker:hover .ticker__run { animation-play-state: paused; }
@keyframes tickscroll { to { transform: translateX(-50%); } }
.tk {
  display: inline-flex; align-items: baseline; gap: var(--s2);
  font-family: var(--f-data); font-size: 0.625rem; letter-spacing: 0.04em;
  color: var(--paper-4); white-space: nowrap;
}
.tk b { color: var(--paper-2); font-weight: 500; letter-spacing: 0.1em; }
.up { color: var(--bull); } .down { color: var(--bear); }
.hi { color: var(--gold); } .dim { color: var(--paper-4); }

/* ── view + footer ─────────────────────────────────────────── */
.view { flex: 1; padding: var(--s8) 0 var(--s9); outline: none; }
@media (max-width: 720px) { .view { padding: var(--s6) 0 var(--s8); } }

.cfoot { border-top: var(--hairline); padding: var(--s6) 0; margin-top: auto; }
.cfoot__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s5); align-items: start;
}
.cfoot, .cfoot a { color: var(--paper-4); }
.cfoot p { font-family: var(--f-data); font-size: var(--t-cap); line-height: 1.8; }
.cfoot a:hover { color: var(--paper-2); }
.cfoot__disc { max-width: 46ch; }
.cfoot__own b { color: var(--paper-3); font-weight: 500; }

.asof {
  display: block; font-family: var(--f-data); font-size: var(--t-cap);
  color: var(--paper-4); margin-top: var(--s3); letter-spacing: 0.04em;
}

/* ── messages ──────────────────────────────────────────────── */
.msg { text-align: center; padding: var(--s8) var(--s4); max-width: 62ch; margin-inline: auto; }
.msg h2 { margin-bottom: var(--s4); }
.msg p { color: var(--paper-3); font-size: var(--t-sm); margin-bottom: var(--s3); }
.msg code {
  font-family: var(--f-data); font-size: var(--t-xs);
  background: var(--ink-800); padding: 3px 8px; border-radius: var(--radius);
  color: var(--gold);
}

/* ═══════════════ DASHBOARD ═══════════════ */

.dash__hero { max-width: 40ch; margin-bottom: var(--s7); }
.dash__hero .kicker { display: block; margin-bottom: var(--s5); }
.dash__title {
  font-size: var(--t-xxl);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.0;
  margin-bottom: var(--s5);
  color: var(--paper-3);
}
.dash__title em {
  display: block; font-style: normal; color: var(--paper);
  font-weight: 700;
}
.dash__hero p { font-family: var(--f-read); font-size: var(--t-md); line-height: 1.66; }

/* stat strip — hairline dividers, not boxes */
.statrow {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border-top: var(--hairline); border-bottom: var(--hairline);
}
.stat { padding: var(--s4) var(--s5) var(--s4) 0; border-right: var(--hairline); }
.stat:last-child { border-right: 0; }
.stat__l {
  display: block; font-family: var(--f-data); font-size: 0.625rem;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--paper-4);
  margin-bottom: var(--s2);
}
.stat__v {
  display: block; font-family: var(--f-data); font-variant-numeric: tabular-nums;
  font-size: 1.35rem; font-weight: 600; letter-spacing: -0.03em; color: var(--paper);
  line-height: 1;
}
.stat__s { display: block; font-family: var(--f-data); font-size: 0.625rem; color: var(--paper-4); margin-top: 5px; }
@media (max-width: 620px) {
  .statrow { grid-template-columns: repeat(2, 1fr); }
  .stat { border-bottom: var(--hairline); }
}

/* ── level heading ─────────────────────────────────────────── */
.level { margin-bottom: var(--s7); }
.level__head {
  display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap;
  padding-bottom: var(--s3); margin-bottom: var(--s2);
  border-bottom: 1px solid var(--ink-600);
}
.level__roman {
  font-family: var(--f-data); font-size: var(--t-cap); font-weight: 600;
  color: var(--gold); letter-spacing: 0.1em;
}
.level__name {
  font-family: var(--f-display); font-size: var(--t-lg);
  font-weight: 600; letter-spacing: -0.02em; color: var(--paper);
}
.level__focus {
  flex: 1 1 100%; font-family: var(--f-data); font-size: var(--t-cap);
  color: var(--paper-4); letter-spacing: 0.04em; margin-top: 2px;
}

/* ── module rows — the piece that looked cheapest ──────────── */
.mods { display: flex; flex-direction: column; }

.mod {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: var(--s4);
  align-items: start;
  padding: var(--s5) 0;
  border-bottom: var(--hairline);
  position: relative;
  transition: background-color 200ms var(--ease);
}
.mod::before {
  content: ''; position: absolute; left: -16px; top: 0; bottom: 0;
  width: 2px; background: transparent; transition: background-color 200ms var(--ease);
}
.mod:hover { background: linear-gradient(90deg, var(--ink-850), transparent 70%); }
.mod:hover::before { background: var(--ink-600); }
.mod--current::before { background: var(--gold); }

/* quiet, solid numerals — the outlined mega-digits read as a gimmick */
.mod__n {
  font-family: var(--f-data); font-size: 1.05rem; font-weight: 500;
  color: var(--paper-4); letter-spacing: -0.02em; padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.mod--current .mod__n { color: var(--gold); }
.mod--done .mod__n { color: var(--paper-3); }

.mod__body h3 {
  font-size: 1.16rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--paper); margin-bottom: 6px; line-height: 1.25;
}
.mod__meta {
  display: flex; gap: var(--s4); flex-wrap: wrap;
  font-family: var(--f-data); font-size: 0.625rem;
  color: var(--paper-4); letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: var(--s3);
}
.mod__blurb {
  font-family: var(--f-read); font-size: var(--t-sm); line-height: 1.6;
  color: var(--paper-3); max-width: 52ch;
}

.mod__right { text-align: right; min-width: 66px; padding-top: 3px; }
.mod__pct {
  display: block; font-family: var(--f-data); font-size: var(--t-xs);
  font-variant-numeric: tabular-nums; color: var(--paper-4); margin-bottom: 7px;
}
.mod--done .mod__pct { color: var(--bull); }
.mod__rail { width: 62px; margin-left: auto; }

@media (max-width: 620px) {
  .mod { grid-template-columns: 34px minmax(0, 1fr); padding: var(--s4) 0; }
  .mod__right { grid-column: 2; text-align: left; padding-top: var(--s2); }
  .mod__rail { margin-left: 0; }
}

/* ── progress rail ─────────────────────────────────────────── */
.rail { height: 2px; background: var(--ink-700); overflow: hidden; border-radius: 999px; }
.rail__fill { height: 100%; background: var(--gold); transition: width 400ms var(--ease); }
.railrow { display: flex; align-items: center; gap: var(--s3); }
.railrow .rail { flex: 1; }
.pct {
  font-family: var(--f-data); font-size: var(--t-xs);
  font-variant-numeric: tabular-nums; color: var(--paper-3); min-width: 40px; text-align: right;
}

/* ── panels ────────────────────────────────────────────────── */
.panel {
  background: var(--ink-850);
  border: var(--hairline);
  border-radius: var(--radius);
  padding: var(--s5);
}

.rank { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.rank__name {
  font-family: var(--f-display); font-size: var(--t-lg);
  font-weight: 700; letter-spacing: -0.02em; color: var(--gold);
}

/* streak: seven small candles */
.streak { display: flex; gap: 5px; align-items: flex-end; height: 22px; }
.streak i { width: 8px; background: var(--ink-700); display: block; border-radius: 1px; }
.streak i.on { background: var(--gold); }

/* ── badges ────────────────────────────────────────────────── */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: var(--s4); }
.badge { text-align: center; }
.badge__hex {
  width: 46px; height: 52px; margin: 0 auto var(--s2);
  display: grid; place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--ink-750); color: var(--paper-4); font-size: 1rem;
  border: 0;
}
.badge--got .badge__hex { background: var(--gold-wash); color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold-dim); }
.badge--locked { opacity: .38; }
.badge__n {
  font-family: var(--f-data); font-size: 0.625rem; line-height: 1.4;
  color: var(--paper-2); letter-spacing: 0.02em;
}
.badge__c { display: block; color: var(--paper-4); margin-top: 3px; font-size: 0.5625rem; line-height: 1.35; }

/* ═══════════════ MODULE + LESSON ═══════════════ */

.head { margin-bottom: var(--s7); max-width: 62ch; }
.head__kicker { display: block; margin-bottom: var(--s4); }
.head h1 { margin-bottom: var(--s4); }
.head p { font-family: var(--f-read); color: var(--paper-3); font-size: var(--t-md); line-height: 1.65; }

/* lesson list rows */
.lessons { display: flex; flex-direction: column; }
.lrow {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: var(--s4); align-items: center;
  padding: var(--s4) var(--s3) var(--s4) 0;
  border-bottom: var(--hairline);
  transition: background-color 180ms var(--ease), padding-left 180ms var(--ease);
}
.lrow:hover { background: var(--ink-850); padding-left: var(--s3); }
.lrow__n {
  font-family: var(--f-data); font-size: var(--t-xs);
  color: var(--paper-4); font-variant-numeric: tabular-nums;
}
.lrow__t { font-size: var(--t-sm); color: var(--paper-2); line-height: 1.4; }
.lrow:hover .lrow__t { color: var(--paper); }
.lrow__m { font-family: var(--f-data); font-size: 0.625rem; color: var(--paper-4); white-space: nowrap; }
.lrow--done .lrow__n { color: var(--bull); }
.lrow__tick { font-family: var(--f-data); font-size: 0.625rem; color: var(--bull); white-space: nowrap; }

/* the lesson itself */
.lesson__nav { position: sticky; top: 108px; }
@media (max-width: 900px) { .lesson__nav { position: static; margin-bottom: var(--s6); } }

.lesson__num {
  font-family: var(--f-data);
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  font-weight: 200;
  letter-spacing: -0.05em;
  color: var(--ink-700);
  line-height: 1; margin-bottom: var(--s3);
}
.lesson__title {
  font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.03em;
  line-height: 1.08; margin-bottom: var(--s4); max-width: 22ch;
}
.lesson__meta { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s7); }

/* ── the seven blocks ──────────────────────────────────────── */
.block { margin-bottom: var(--s7); }
.block__label {
  display: flex; align-items: center; gap: var(--s2);
  font-family: var(--f-data); font-size: var(--t-cap);
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--paper-4); margin-bottom: var(--s4);
}
.block__label i { font-style: normal; color: var(--gold); font-size: 0.9rem; }

/* the hook is set larger and in the serif — it is the invitation */
.block--hook .prose p {
  font-family: var(--f-read); font-size: 1.18rem; line-height: 1.62;
  color: var(--paper); max-width: 54ch;
}
.block--core .prose p,
.block--example .prose p { font-family: var(--f-read); line-height: 1.72; }
.block--core .prose h3 {
  font-family: var(--f-display); font-size: var(--t-md);
  letter-spacing: 0.02em; text-transform: none; color: var(--paper);
}

/* takeaway — exactly three bullets */
.takeaway {
  border-top: 1px solid var(--ink-600);
  padding-top: var(--s4);
}
.takeaway li {
  font-family: var(--f-read); font-size: var(--t-sm); line-height: 1.6;
  color: var(--paper-2); padding: var(--s3) 0 var(--s3) var(--s5);
  position: relative; border-bottom: var(--hairline);
}
.takeaway li:last-child { border-bottom: 0; }
.takeaway li::before {
  content: '→'; position: absolute; left: 0; top: var(--s3);
  color: var(--gold); font-family: var(--f-data); font-size: var(--t-xs);
}

/* ── callouts ──────────────────────────────────────────────── */
.callout {
  border-left: 2px solid var(--ink-600);
  padding: var(--s4) 0 var(--s4) var(--s5);
  margin: var(--s5) 0;
}
.callout p { font-family: var(--f-read); font-size: var(--t-sm); line-height: 1.68; color: var(--paper-2); }
.callout p + p { margin-top: var(--s3); }
.callout__l {
  display: block; font-family: var(--f-data); font-size: var(--t-cap);
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--paper-3); margin-bottom: var(--s2);
}
.callout--info  { border-left-color: var(--ink-500); }
.callout--warn  { border-left-color: var(--gold); }
.callout--warn .callout__l { color: var(--gold); }
.callout--danger{ border-left-color: var(--bear); }
.callout--danger .callout__l { color: var(--bear); }
/* crimson use 3 of 3 — the Nepal-specific rule marker */
.callout--nepse { border-left-color: var(--crimson); }
.callout--nepse .callout__l { color: var(--crimson); }

/* ── tables ────────────────────────────────────────────────── */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: var(--t-xs); }
.table caption {
  caption-side: bottom; text-align: left; padding-top: var(--s3);
  font-family: var(--f-data); font-size: var(--t-cap); color: var(--paper-4); line-height: 1.6;
}
.table th {
  text-align: left; padding: var(--s2) var(--s4) var(--s2) 0;
  font-family: var(--f-data); font-size: 0.625rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--paper-4);
  border-bottom: 1px solid var(--ink-600); white-space: nowrap;
}
.table td {
  padding: var(--s3) var(--s4) var(--s3) 0;
  border-bottom: var(--hairline); color: var(--paper-2);
  font-family: var(--f-read); line-height: 1.45;
}
.table td.n, .table th.n {
  text-align: right; font-family: var(--f-data);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  white-space: nowrap;   /* a rupee figure must never wrap mid-number */
}
.table tbody tr:hover td { background: var(--ink-850); }

/* worked-example calculation block */
.calc { border-top: 1px solid var(--ink-600); }
.calc__row {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4);
  padding: var(--s3) 0; border-bottom: var(--hairline);
  font-family: var(--f-data); font-size: var(--t-xs);
}
.calc__row span { color: var(--paper-3); }
.calc__row b {
  color: var(--paper-2); font-weight: 500; text-align: right;
  font-variant-numeric: tabular-nums;
  /* not nowrap: some worked-example values are sentences, and forcing them
     onto one line pushed the page wider than a 360px screen. Rupee figures
     are protected instead by a non-breaking space inside rs(). */
}
.calc__row--total { border-bottom: 0; border-top: 1px solid var(--ink-600); margin-top: -1px; }
.calc__row--total span { color: var(--paper-2); }
.calc__row--total b { color: var(--gold); font-weight: 600; font-size: var(--t-sm); }

/* ── glossary term popover ─────────────────────────────────── */
.term {
  border-bottom: 1px dotted var(--paper-4);
  color: inherit; font: inherit; padding: 0;
  cursor: help; transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.term:hover { color: var(--gold-soft); border-bottom-color: var(--gold); }
.pop {
  position: absolute; z-index: 60; max-width: 320px;
  background: var(--ink-750); border: 1px solid var(--ink-600);
  border-radius: var(--radius); padding: var(--s4);
  box-shadow: 0 10px 34px rgba(0,0,0,.55);
  font-family: var(--f-display); font-size: var(--t-xs); line-height: 1.6; color: var(--paper-2);
}
.pop__t { font-weight: 650; color: var(--paper); margin-bottom: 3px; }
.pop__np { font-family: var(--f-np); color: var(--gold); margin-bottom: var(--s2); }
.pop__lesson {
  display: block; margin-top: var(--s3); font-family: var(--f-data);
  font-size: var(--t-cap); color: var(--paper-4);
}
.pop__lesson:hover { color: var(--gold); }

/* ── lesson nav footer ─────────────────────────────────────── */
.lnav {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  margin-top: var(--s8); padding-top: var(--s5);
  border-top: 1px solid var(--ink-600); flex-wrap: wrap;
}

/* ── games grid ────────────────────────────────────────────── */
.gamegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s4); }
.gcard {
  display: block; padding: var(--s5);
  background: var(--ink-850); border: var(--hairline); border-radius: var(--radius);
  transition: border-color 200ms var(--ease), background-color 200ms var(--ease), transform 200ms var(--ease);
}
.gcard:hover { border-color: var(--gold-dim); background: var(--ink-800); transform: translateY(-2px); }
.gcard h3 { font-size: var(--t-lg); margin-bottom: 6px; }
.gcard p { font-family: var(--f-read); font-size: var(--t-sm); color: var(--paper-3); line-height: 1.55; }
.gcard__best {
  margin-top: var(--s4); padding-top: var(--s3); border-top: var(--hairline);
  font-family: var(--f-data); font-size: 0.625rem; color: var(--paper-4); letter-spacing: 0.04em;
}
.kbd {
  font-family: var(--f-data); font-size: 0.625rem;
  border: 1px solid var(--ink-600); border-bottom-width: 2px;
  border-radius: 3px; padding: 2px 6px; color: var(--paper-3); background: var(--ink-800);
}

/* ── glossary ──────────────────────────────────────────────── */
.gsearch {
  width: 100%; background: var(--ink-850); border: var(--hairline);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  font-family: var(--f-display); font-size: var(--t-md); color: var(--paper);
}
.gsearch::placeholder { color: var(--paper-4); }
.gsearch:focus { border-color: var(--gold-dim); }
.glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0; }
.gitem { padding: var(--s5) var(--s5) var(--s5) 0; border-bottom: var(--hairline); }
.gitem h3 { font-size: var(--t-md); margin-bottom: 4px; }
.gitem__np { font-family: var(--f-np); color: var(--gold); font-size: 1.02rem; }
.gitem__rom { font-family: var(--f-data); font-size: 0.625rem; color: var(--paper-4); }
.gitem p { font-family: var(--f-read); font-size: var(--t-xs); color: var(--paper-3); margin-top: var(--s3); line-height: 1.6; }
.gitem a { font-family: var(--f-data); font-size: var(--t-cap); color: var(--paper-4); display: inline-block; margin-top: var(--s3); }
.gitem a:hover { color: var(--gold); }

/* ── settings ──────────────────────────────────────────────── */
.setrow {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s5);
  padding: var(--s4) 0; border-bottom: var(--hairline);
}
.setrow:last-child { border-bottom: 0; }
.setrow__t { font-size: var(--t-sm); color: var(--paper); margin-bottom: 4px; }
.setrow__d { font-family: var(--f-read); font-size: var(--t-xs); color: var(--paper-4); max-width: 54ch; line-height: 1.55; }
.toggle {
  flex: none; width: 46px; height: 26px; border-radius: 999px;
  background: var(--ink-700); position: relative; transition: background-color 200ms var(--ease);
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 999px; background: var(--paper-3); transition: transform 200ms var(--ease), background-color 200ms var(--ease);
}
.toggle[aria-pressed="true"] { background: var(--gold-dim); }
.toggle[aria-pressed="true"]::after { transform: translateX(20px); background: var(--gold); }

/* Dashboard rail: the narrow column carries the curve, rank and badges;
   the module tree gets the wide one. */
.split--wide { grid-template-columns: minmax(0, 34fr) minmax(0, 66fr); }
@media (max-width: 900px) { .split--wide { grid-template-columns: minmax(0, 1fr); } }
.split--wide > :first-child { position: sticky; top: 108px; }
@media (max-width: 900px) { .split--wide > :first-child { position: static; } }

/* Boss quiz: gold is the accent, so solid gold is reserved for the one
   primary action per view. These are outlined instead. */
.btn--boss {
  background: transparent;
  border-color: var(--gold-dim);
  color: var(--gold);
}
.btn--boss:hover:not(:disabled) { background: var(--gold-wash); border-color: var(--gold); }
