/* ============================================================
   Class XII Macroeconomics — Presentation Deck
   Shared stylesheet · Solarized Light
   ============================================================ */

:root {
  /* Solarized base tones */
  --bg:        #fdf6e3;  /* base3  — page */
  --bg-2:      #f7f0dd;  /* between base3 and base2 */
  --panel:     #eee8d5;  /* base2  — cards, boxes */
  --panel-2:   #e4dcc4;  /* deeper panel, table heads */
  --line:      #d9d0b6;  /* borders */
  --ink:       #52666d;  /* base01 — body text */
  --ink-strong:#073642;  /* base02 — headings, emphasis */
  --ink-dim:   #556a71;  /* base00 — secondary text */
  --ink-faint: #5b6966;  /* base1  — captions, axes */

  /* Solarized accents */
  --amber:  #a17a00;  /* yellow  — highlight, optimum, key point */
  --teal:   #748500;  /* green   — examples, answers */
  --blue:   #1f7ab8;  /* blue    — definitions, demand */
  --rose:   #c62b28;  /* red     — warnings, loss, excess */
  --violet: #6c71c4;  /* violet  — insight, shifted curves */
  --cyan:   #238b84;  /* cyan    — forward/back links to other chapters */

  /* text tier — darker, for labels and tags (WCAG AA on panel) */
  --amber-t:  #755900;
  --teal-t:   #586600;
  --blue-t:   #175f90;
  --rose-t:   #b02522;
  --violet-t: #5055a0;
  --cyan-t:   #196b65;

  --radius: 14px;
  --maxw: 1240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(18px, 1.28vw, 23px);
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */
#bar {
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.2rem;
  background: rgba(253,246,227,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 50;
}
#bar .brand {
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
  color: var(--amber-t); white-space: nowrap;
}
#bar .sect {
  font-size: 13px; color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1;
}
#bar .sect::before { content: "› "; color: var(--ink-faint); }
#bar .tools { display: flex; align-items: center; gap: .45rem; }
#bar button {
  background: var(--panel); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 8px;
  padding: .32rem .6rem; font-size: 12px; cursor: pointer;
  font-family: inherit;
}
#bar button:hover { background: var(--panel-2); color: var(--ink-strong); }
#counter {
  font-variant-numeric: tabular-nums; font-size: 13px;
  color: var(--ink-dim); white-space: nowrap;
}

#progress {
  position: fixed; top: 52px; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--teal));
  z-index: 51; transition: width .25s ease;
}

/* ---------- Slide area ---------- */
#stage {
  position: fixed; top: 55px; bottom: 0; left: 0; right: 0;
  overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth;
}

.slide {
  display: none;
  min-height: 100%;
  padding: 30px 46px 60px;
  max-width: var(--maxw);
  margin: 0 auto;
  animation: fade .28s ease;
}
.slide.on { display: flex; flex-direction: column; justify-content: center; }

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

/* ---------- Typography ---------- */
h1 {
  font-size: clamp(2.3rem, 3.9vw, 3.05rem); line-height: 1.12;
  margin: 0 0 .6rem; font-weight: 750; letter-spacing: -.02em;
  color: var(--ink-strong);
}
h2 {
  font-size: clamp(1.65rem, 2.7vw, 2.12rem); line-height: 1.2;
  margin: 0 0 1.1rem; font-weight: 700; letter-spacing: -.015em;
  color: var(--ink-strong);
}
h2 .num {
  display: inline-block; font-size: .5em; font-weight: 700;
  color: var(--bg); background: var(--amber-t);
  border-radius: 6px; padding: .12em .5em; vertical-align: middle;
  margin-right: .6rem; letter-spacing: .04em;
}
h3 {
  font-size: 1.10rem; margin: 1.3rem 0 .5rem; font-weight: 700;
  color: var(--amber-t); letter-spacing: .01em;
}
p { margin: 0 0 .75rem; }
ul, ol { margin: .2rem 0 .8rem; padding-left: 1.35rem; }
li { margin: .3rem 0; }
b, strong { color: var(--ink-strong); font-weight: 650; }
em { color: var(--amber-t); font-style: normal; font-weight: 650; }
code, .mono {
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: .93em; background: rgba(38,139,210,.10);
  padding: .1em .38em; border-radius: 5px; color: var(--blue-t);
}
.lead { font-size: 1.15em; color: var(--ink-dim); }
.small { font-size: .88em; color: var(--ink-dim); }
.center { text-align: center; }

/* ---------- Title slide ---------- */
.title-slide { text-align: center; align-items: center; }
.title-slide .kicker {
  font-size: .9rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--amber-t); font-weight: 700; margin-bottom: 1rem;
}
.title-slide .sub { font-size: 1.2rem; color: var(--ink-dim); max-width: 44rem; margin: .4rem auto 0; }
.title-slide .rule {
  width: 90px; height: 4px; border-radius: 2px; margin: 1.6rem auto;
  background: linear-gradient(90deg, var(--amber), var(--rose));
}

/* ---------- Content boxes ---------- */
.box {
  border-radius: var(--radius);
  padding: 1.05rem 1.3rem;
  margin: .85rem 0;
  border-left: 5px solid var(--line);
  background: var(--panel);
}
.box .tag {
  display: block; font-size: .7rem; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: .45rem; color: var(--ink-faint);
}
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }

.defn   { border-left-color: var(--blue);   background: linear-gradient(90deg, rgba(38,139,210,.12), var(--panel) 60%); }
.defn   .tag { color: var(--blue-t); }
.defn   .term { color: var(--ink-strong); font-weight: 750; }

.eg     { border-left-color: var(--teal);   background: linear-gradient(90deg, rgba(133,153,0,.14), var(--panel) 60%); }
.eg     .tag { color: var(--teal-t); }

.insight{ border-left-color: var(--violet); background: linear-gradient(90deg, rgba(108,113,196,.13), var(--panel) 60%); }
.insight .tag { color: var(--violet-t); }

.warn   { border-left-color: var(--rose);   background: linear-gradient(90deg, rgba(220,50,47,.10), var(--panel) 60%); }
.warn   .tag { color: var(--rose-t); }

.bridge { border-left-color: var(--cyan);   background: linear-gradient(90deg, rgba(42,161,152,.13), var(--panel) 60%); }
.bridge .tag { color: var(--cyan-t); }

.note   { border-left-color: var(--ink-faint); }

/* ---------- Question / Answer machinery ---------- */
.qcard {
  border-radius: var(--radius); padding: 1.1rem 1.35rem; margin: .7rem 0;
  background: linear-gradient(90deg, rgba(181,137,0,.15), var(--panel) 65%);
  border-left: 5px solid var(--amber);
}
.qcard .tag {
  display: block; font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--amber-t); margin-bottom: .45rem;
}
.qcard p:last-child, .qcard ol:last-child, .qcard ul:last-child { margin-bottom: 0; }

.ready {
  text-align: center; padding: 1.1rem; margin: 1.1rem 0;
  font-size: 1.35rem; font-weight: 700; color: var(--amber-t);
  border: 2px dashed rgba(181,137,0,.55); border-radius: var(--radius);
  background: rgba(181,137,0,.08);
  animation: pulse 1.9s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.72} 50%{opacity:1} }

.answer {
  border-radius: var(--radius); padding: 1.1rem 1.35rem; margin: .7rem 0;
  background: linear-gradient(90deg, rgba(133,153,0,.18), var(--panel) 65%);
  border-left: 5px solid var(--teal);
}
.answer .tag {
  display: block; font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--teal-t); margin-bottom: .45rem;
}
.answer p:last-child, .answer ul:last-child, .answer ol:last-child { margin-bottom: 0; }

/* Challenge question — one per section, deeper than the routine checks */
.challenge {
  border-radius: var(--radius); padding: 1.1rem 1.35rem; margin: .7rem 0;
  background: linear-gradient(90deg, rgba(108,113,196,.16), var(--panel) 65%);
  border-left: 5px solid var(--violet);
}
.challenge .tag {
  display: block; font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--violet-t); margin-bottom: .45rem;
}
.challenge .tag::before { content: "★ "; }
.challenge p:last-child, .challenge ol:last-child, .challenge ul:last-child { margin-bottom: 0; }

.reveal { display: none; }
.reveal.shown { display: block; animation: fade .3s ease; }

/* ---------- Layout helpers ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: .9rem; align-items: start; }
.split { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1.6rem; align-items: center; }
@media (max-width: 900px) {
  .grid2, .grid3, .split { grid-template-columns: 1fr; }
  .slide { padding: 20px 16px 56px; }
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .95rem 1.1rem;
}
.card h4 {
  margin: 0 0 .4rem; font-size: 1rem; color: var(--amber-t); font-weight: 700;
}
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

/* ---------- Tables ---------- */
table {
  border-collapse: collapse; width: 100%; margin: .8rem 0;
  font-variant-numeric: tabular-nums; font-size: .95em;
}
th, td {
  border: 1px solid var(--line); padding: .45rem .7rem; text-align: center;
}
th {
  background: var(--panel-2); color: var(--amber-t);
  font-weight: 700; font-size: .85em; letter-spacing: .03em;
}
td { background: rgba(238,232,213,.6); }
tr:hover td { background: rgba(228,220,196,.85); }
td.lbl, th.lbl { text-align: left; }
.hi  { background: rgba(181,137,0,.22) !important; color: var(--ink-strong); font-weight: 650; }
.hi2 { background: rgba(133,153,0,.22) !important; color: var(--ink-strong); font-weight: 650; }
caption { caption-side: bottom; font-size: .82em; color: var(--ink-faint); padding-top: .5rem; }

/* ---------- Formula ---------- */
.formula {
  text-align: center; font-size: 1.3rem; padding: 1rem 1.2rem; margin: .9rem 0;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink-strong); letter-spacing: .01em;
}
.formula .frac {
  display: inline-flex; flex-direction: column; vertical-align: middle;
  text-align: center; margin: 0 .35rem; font-size: .78em;
}
.formula .frac > span:first-child { border-bottom: 2px solid var(--ink-dim); padding: 0 .5rem .12rem; }
.formula .frac > span:last-child { padding: .12rem .5rem 0; }

/* ---------- Steps ---------- */
.steps { counter-reset: s; list-style: none; padding-left: 0; }
.steps > li {
  counter-increment: s; position: relative; padding-left: 2.5rem; margin: .7rem 0;
}
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: .05em;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--amber-t); color: var(--bg);
  font-weight: 800; font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Diagrams ---------- */
figure { margin: .8rem 0; text-align: center; }
figure svg { max-width: 100%; height: auto; }
figcaption { font-size: .84em; color: var(--ink-faint); margin-top: .45rem; }
.axis  { stroke: #75837f; stroke-width: 2; }
.grid  { stroke: #e4dcc4; stroke-width: 1; }
.curve { fill: none; stroke-width: 3; stroke-linecap: round; }
.c-amber { stroke: var(--amber); } .c-teal { stroke: var(--teal); }
.c-blue  { stroke: var(--blue); }  .c-rose { stroke: var(--rose); }
.c-violet{ stroke: var(--violet);} .c-cyan { stroke: var(--cyan); }
.dash { stroke-dasharray: 6 5; stroke-width: 2; fill: none; }
svg text { fill: var(--ink-dim); font-size: 15px; font-family: inherit; }
svg text.lab { fill: var(--ink-strong); font-weight: 700; font-size: 16px; }
svg text.sm  { font-size: 13px; }
svg .pt { fill: var(--amber); stroke: var(--bg); stroke-width: 2; }

/* Arrowhead fills. A <marker> cannot inherit the referencing path's stroke,
   so each coloured arrow names its own marker and the marker's path takes
   one of these classes. Keeps every arrowhead on a palette token. */
.mk-amber  { fill: var(--amber); }
.mk-teal   { fill: var(--teal); }
.mk-blue   { fill: var(--blue); }
.mk-rose   { fill: var(--rose); }
.mk-violet { fill: var(--violet); }
.mk-cyan   { fill: var(--cyan); }
.mk-ink    { fill: #75837f; }

/* Labelled boxes inside a diagram — sectors in the circular flow, nodes of the
   budget tree, aggregates in the conversion chain. */
svg .dbox  { fill: var(--panel); stroke: #75837f; stroke-width: 2; }
svg .dbox2 { fill: var(--panel-2); stroke: #75837f; stroke-width: 2; }
svg .fill-amber  { fill: rgba(181,137,0,.30); stroke: var(--amber);  stroke-width: 2; }
svg .fill-teal   { fill: rgba(133,153,0,.30); stroke: var(--teal);   stroke-width: 2; }
svg .fill-blue   { fill: rgba(38,139,210,.26); stroke: var(--blue);  stroke-width: 2; }
svg .fill-rose   { fill: rgba(220,50,47,.26);  stroke: var(--rose);  stroke-width: 2; }
svg .fill-violet { fill: rgba(108,113,196,.26);stroke: var(--violet);stroke-width: 2; }
svg .band-rose   { fill: rgba(220,50,47,.18);  stroke: none; }
svg .band-teal   { fill: rgba(133,153,0,.16);  stroke: none; }

/* ---------- Information button ---------- */
/* Sized in rem, never em: the button is the same small disc whether it sits in
   an h2, a table cell or a .small caption. Sized from the root, so it still
   scales with the projector. Raised like a trademark mark so it rides above
   the top-right of the word instead of shouldering the line apart. */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: .95rem; height: .95rem; margin: 0 .08em 0 .18em; padding: 0;
  border-radius: 50%; border: 1px solid var(--blue);
  background: rgba(38,139,210,.12); color: var(--blue-t);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic; font-weight: 700; font-size: .68rem; line-height: 1;
  cursor: pointer;
  /* Raised in the button's OWN em, not the parent's — `vertical-align: super`
     would scale the lift with the heading and reintroduce the inconsistency. */
  vertical-align: baseline; position: relative; top: -.3em;
  transition: background .15s ease, color .15s ease;
}.info:hover,
.info[aria-expanded="true"] { background: var(--blue); color: var(--bg); }
.info:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.infopanel {
  display: none;
  margin: .9rem 0 .2rem; padding: 1rem 1.25rem;
  border-radius: var(--radius); border-left: 5px solid var(--blue);
  background: linear-gradient(90deg, rgba(38,139,210,.14), var(--panel-2) 70%);
  font-size: .95em;
}
.infopanel.open { display: block; animation: fade .25s ease; }
.infopanel .tag {
  display: block; font-size: .7rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--blue-t); margin-bottom: .5rem;
}
.infopanel p:last-child, .infopanel ul:last-child { margin-bottom: 0; }
.infopanel .q {
  border-left: 3px solid var(--line); padding-left: .9rem; margin: .6rem 0;
  color: var(--ink-dim);
}

/* ---------- Recap chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.chip {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: .35rem .9rem; font-size: .88rem; color: var(--ink);
}
.chip.k { border-color: rgba(181,137,0,.55); color: var(--amber-t); background: rgba(181,137,0,.09); }

/* ---------- Menu overlay ---------- */
#menu {
  position: fixed; inset: 0; background: rgba(253,246,227,.98);
  z-index: 100; display: none; overflow-y: auto; padding: 3.5rem 2rem;
}
#menu.on { display: block; }
#menu h3 { margin-top: 0; text-align: center; color: var(--ink-strong); font-size: 22px; }
#menu .mlist { max-width: 780px; margin: 1.5rem auto; }
#menu .mgroup {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber-t); font-weight: 800; margin: 1.4rem 0 .5rem;
  border-bottom: 1px solid var(--line); padding-bottom: .35rem;
}
#menu a {
  display: flex; gap: .8rem; padding: .45rem .7rem; border-radius: 8px;
  color: var(--ink-dim); text-decoration: none; font-size: 15px;
}
#menu a:hover { background: var(--panel); color: var(--ink-strong); }
#menu a .n { color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 2.4rem; }
#menu .hint { text-align: center; color: var(--ink-faint); font-size: 13px; }

/* ---------- Nav arrows ---------- */
.nav {
  position: fixed; bottom: 1.1rem; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); cursor: pointer;
  font-size: 20px; line-height: 1; display: flex;
  align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(88,110,117,.12);
}
.nav:hover { background: var(--amber); color: #fdf6e3; border-color: var(--amber); }
#prev { right: 4.6rem; } #next { right: 1.1rem; }
.nav:disabled { opacity: .35; cursor: default; }
.nav:disabled:hover { background: var(--panel); color: var(--ink); border-color: var(--line); }

/* ---------- Home page (index) ---------- */
.home { max-width: 900px; margin: 0 auto; padding: 3rem 2rem; }
.home h1 { text-align: center; }
.home .sub { text-align: center; color: var(--ink-dim); font-size: 1.15rem; margin-bottom: 2.5rem; }
.chapters { display: grid; gap: 1rem; }
.chapters a {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: var(--radius); padding: 1.2rem 1.4rem;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.chapters a:hover {
  transform: translateX(5px); border-color: var(--amber);
  box-shadow: 0 2px 8px rgba(88,110,117,.10);
}
.chapters a.soon { border-left-color: var(--line); opacity: .55; }
.chapters .cn {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber-t); font-weight: 800;
}
.chapters .ct { font-size: 1.35rem; font-weight: 700; color: var(--ink-strong); margin: .2rem 0 .35rem; }
.chapters .cd { color: var(--ink-dim); font-size: .95rem; margin: 0; }
.chapters .cmeta { color: var(--ink-faint); font-size: .82rem; margin-top: .5rem; }
/* The decks lock scrolling on html+body (they use a fixed #stage instead).
   The course home page is an ordinary document, so it must release BOTH locks —
   overriding body alone leaves html:overflow:hidden still clipping the page. */
html.homepage,
html.homepage body { overflow: auto; height: auto; }
