/* ===================================================================
   How-to-use guide.

   Every colour is a palette token. Nothing here is a hex value, so all
   five schemes and both light and dark keep working — a diagram drawn
   in fixed colours would be wrong in four palettes out of five.

   Motion is opt-out at the top, not bolted on at the bottom: the
   prefers-reduced-motion block below turns every figure to its finished
   state, and no information lives only in the movement.
   =================================================================== */

.guide { --gdur: .5s; }

/* ---- intro ------------------------------------------------------- */

.gintro { padding-block: clamp(2rem, 6vw, 3.4rem); }
.gintro h1 { margin: .2rem 0 .6rem; }
.gtime {
  margin: .9rem 0 0; font-size: .9375rem; color: var(--muted);
  border-inline-start: 3px solid var(--gold); padding-inline-start: .8rem;
}

/* ---- contents ---------------------------------------------------- */

.gtoc { margin-block: 1.6rem; }
.gtoc ol {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: .45rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  counter-reset: gtoc;
}
.gtoc li { counter-increment: gtoc; }
.gtoc a {
  display: flex; gap: .6rem; align-items: baseline;
  padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  font-size: .9375rem; line-height: 1.35;
}
.gtoc a::before {
  /* Devanagari numerals, matching the headings. A CSS counter defaults to
     Latin digits, so the contents list said 4 while the heading it pointed
     at said ४ — on a Marathi page that reads as a fault, not a style. */
  content: counter(gtoc, devanagari); font-variant-numeric: tabular-nums;
  color: var(--accent); font-weight: 700; flex: none;
}
.gtoc a:hover { border-color: var(--accent); background: var(--accent-soft); }
.gtoc a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- sections ---------------------------------------------------- */

.gbody { padding-bottom: 3rem; }
.gsec { padding-block: clamp(1.6rem, 4vw, 2.6rem); border-top: 1px solid var(--line); }
.gsec:first-child { border-top: 0; }
.gsec > h2 {
  display: flex; align-items: center; gap: .7rem;
  font-size: clamp(1.2rem, 3.2vw, 1.55rem); margin: 0 0 .7rem;
  scroll-margin-top: 1rem;
}
.gsec { scroll-margin-top: 1rem; }
.gk {
  flex: none; display: grid; place-items: center;
  width: 2.1em; height: 2.1em; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  font-size: .62em; font-weight: 700;
}
.gsec p { max-width: 62ch; line-height: 1.75; }

.gsteps { max-width: 62ch; line-height: 1.75; padding-inline-start: 1.3rem; }
.gsteps li { margin-block: .45rem; }
.glist { max-width: 62ch; line-height: 1.75; padding-inline-start: 1.1rem; }
.glist li { margin-block: .4rem; }

.gnote {
  background: var(--surface-2); border-radius: 9px;
  padding: .7rem .9rem; font-size: .9375rem; color: var(--muted);
  border-inline-start: 3px solid var(--line-strong);
}
.gcap { font-size: .875rem; color: var(--muted); text-align: center; }

/* ---- two-column blocks ------------------------------------------- */

.gsplit { display: grid; gap: 1.4rem; align-items: start; }
@media (min-width: 52rem) { .gsplit { grid-template-columns: 1fr 1fr; } }
.gaside h3 { margin: .2rem 0 .5rem; font-size: 1.05rem; }
.gaside ul { padding-inline-start: 1.1rem; line-height: 1.7; }
.gaside li { margin-block: .4rem; }

/* ---- figures ----------------------------------------------------- */

.gfig { margin: 1.2rem 0; }
.gsvg {
  width: 100%; height: auto; display: block;
  color: var(--line-strong);            /* arrow markers use currentColor */
  overflow: visible;
}
.gsvg.track { max-width: 26rem; }
.gsvg.sheetfig { max-width: 24rem; margin-inline: auto; }

.gbox { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.gbox.strong { fill: var(--accent-soft); stroke: var(--accent); }
.gnum { fill: var(--accent); }
.gnumt { fill: var(--on-accent); font-size: 15px; font-weight: 700; text-anchor: middle; }
.gh { fill: var(--ink); font-size: 17px; font-weight: 700; }
.gh.mid { text-anchor: middle; }
.gh.sm { font-size: 14px; }
.gsub { fill: var(--muted); font-size: 13px; }
.gsub.mid { text-anchor: middle; }
.gsub.start { text-anchor: start; }
.gh.start { text-anchor: start; }
.grail { stroke: var(--line); stroke-width: 2; }
.garrow, .gwire { stroke: var(--line-strong); stroke-width: 2; fill: none; }
.gphone { fill: var(--surface); stroke: var(--line-strong); stroke-width: 2; }
.gnotch { fill: var(--line-strong); }
.gph { fill: var(--ink); font-size: 14px; font-weight: 700; text-anchor: middle; }
.gpsub { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.gline { fill: var(--line); }

.gsheet { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.gmargin { stroke: var(--rule); stroke-width: 2; }
.gstamp { fill: var(--gold); }
.gtext { fill: var(--accent); opacity: .5; }
.gdim { stroke: var(--muted); stroke-width: 1.2; }
.garrowhead { fill: var(--line-strong); }
.gdimt { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.gsign { fill: var(--gold-soft); stroke: var(--gold); stroke-width: 1.2; }
.gsignt { fill: var(--gold); font-size: 11px; text-anchor: middle; }

/* ---- the reveal --------------------------------------------------
   Figures start hidden ONLY once the script has marked the page as able
   to animate. Without that class everything is visible, so a reader with
   JavaScript off or a script that failed still sees every diagram. */

.gready .gfig .gstep { opacity: 0; transform: translateY(8px); }
.gready .gfig .garrow,
.gready .gfig .gwire { stroke-dasharray: 200; stroke-dashoffset: 200; }

.gready .gfig.on .gstep {
  animation: gIn var(--gdur) cubic-bezier(.22,.7,.3,1) forwards;
  animation-delay: var(--d, 0s);
}
.gready .gfig.on .garrow,
.gready .gfig.on .gwire {
  animation: gDraw .55s ease forwards;
  animation-delay: var(--d, .15s);
}
@keyframes gIn  { to { opacity: 1; transform: none; } }
@keyframes gDraw { to { stroke-dashoffset: 0; } }

.greplay {
  display: inline-flex; align-items: center; gap: .4rem;
  margin-top: .6rem; font: inherit; font-size: .875rem;
  padding: .45rem .9rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer; min-height: 40px;
}
.greplay:hover { border-color: var(--accent); background: var(--accent-soft); }
.greplay:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- the typing demo --------------------------------------------- */

.gtype {
  margin: 1.1rem 0; padding: 1.1rem 1.2rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  max-width: 34rem;
}
.gtyperow { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.gtypelab { font-size: .8125rem; color: var(--muted); flex: none; min-width: 7.5em; }
.gtypein {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(1.15rem, 4vw, 1.5rem); color: var(--muted);
  letter-spacing: .04em;
}
.gtypeout {
  font-family: var(--deva, inherit);
  font-size: clamp(1.4rem, 5vw, 1.9rem); font-weight: 700; color: var(--accent);
}
.gtypein::after {
  content: ''; display: inline-block; width: .55ch; height: 1.05em;
  background: var(--accent); margin-inline-start: .12em;
  vertical-align: -.15em; animation: gCaret 1s steps(1) infinite;
}
.gtype.done .gtypein::after { animation: none; opacity: 0; }
@keyframes gCaret { 50% { opacity: 0; } }
.gtypearrow { color: var(--muted); font-size: 1.3rem; margin: .35rem 0 .35rem 8.3em; }

/* ---- the examples table ------------------------------------------ */

.gtable { border-collapse: collapse; margin: 1.1rem 0; font-size: .9375rem; }
.gtable caption { text-align: start; color: var(--muted); font-size: .875rem; padding-bottom: .4rem; }
.gtable th, .gtable td { text-align: start; padding: .5rem .9rem; border-bottom: 1px solid var(--line); }
.gtable th { color: var(--muted); font-weight: 600; font-size: .8125rem; }
.gtable td:first-child { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.gtable td:last-child { font-family: var(--deva, inherit); font-weight: 600; }

.gend { text-align: center; }
.gend .acts { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

/* ---- motion off --------------------------------------------------
   Not a courtesy. Vestibular disorders are real, and this audience is
   not young. Everything lands in its finished state, instantly. */

@media (prefers-reduced-motion: reduce) {
  .gready .gfig .gstep { opacity: 1; transform: none; animation: none; }
  .gready .gfig .garrow,
  .gready .gfig .gwire { stroke-dashoffset: 0; animation: none; }
  .gtypein::after { animation: none; }
  .greplay { display: none; }
}
