/* ═══════════════════════════════════════════════════════════
   wg.css — the shared design language

   Loaded by every page built in the new style. The home page gets
   it inlined by inline-home-css.js; other page types link it as
   /css/wg.css. Page-specific rules live in that page's own file.

   White paper, black rule, marking red, squared paper, and the
   Name / Date / Score strip off the worksheets themselves. No
   rounded corners, no gradients, no emoji.
═══════════════════════════════════════════════════════════ */
:root {
  --h-ink:    #15161A;   /* body text, rules, inverted panels */
  --h-red:    #C8102E;   /* marking red — links on hover, eyebrows */
  --h-red-lt: #FF5A74;   /* the same red, legible on ink */
  --h-body:   #2C2F36;   /* lede */
  --h-grey:   #3A3E46;   /* card copy */
  --h-grey-2: #4A4E57;   /* section intros */
  --h-mono:   #6A6E78;   /* small mono labels */
  --h-hair:   #D4D6DB;   /* cell dividers */
  --h-faint:  #E4E6EA;   /* container edge */
  --h-graph:  #EEF1F6;   /* squared paper */
  --h-panel:  #F4F5F7;   /* editorial band */
  --h-wash:   #FFF6F7;   /* cell hover */
  --h-dim:    #B9BDC6;   /* copy on ink */
  --h-line:   #3A3E46;   /* dividers on ink */
  --h-pad:    44px;      /* section gutter, desktop */
}

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/archivo-latin-wght.woff2) format('woff2-variations'),
       url(/fonts/archivo-latin-wght.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
                 U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Everything from here to the end of this block applies only to pages
   that opt in with <body class="wg">. Pages that merely load this file
   for the shell — the nav and footer treatment and the tokens — keep
   their own background and headings, so an article or worksheet body
   is untouched. */

/* base.css paints the body #F8F9FF; an opted-in page is paper-white. */
body.wg {
  background: #fff;
  color: var(--h-ink);
  -webkit-font-smoothing: antialiased;
}

body.wg main { display: block; }

body.wg h1, body.wg h2, body.wg h3, .arch {
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  font-weight: 800;
}

/* System mono: the 12px uppercase labels do not justify a font download. */
.mono {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── Container ───────────────────────────────────────────── */
.wrap {
  max-width: 1320px;
  margin: 0 auto;
  border-left: 1px solid var(--h-faint);
  border-right: 1px solid var(--h-faint);
}

.rule { border: 0; border-top: 2px solid var(--h-ink); margin: 0; }

/* ── Spec strip, lifted off the worksheet masthead ───────── */
.spec {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--h-ink);
}
.spec > span {
  flex: 1 1 200px;
  padding: 10px var(--h-pad);
  color: var(--h-mono);
  border-right: 1px solid var(--h-hair);
}
.spec > span + span { padding-left: 20px; padding-right: 20px; }
.spec > span:last-child { border-right: 0; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: 66px var(--h-pad) 54px;
  background-color: #fff;
  background-image:
    linear-gradient(var(--h-graph) 1px, transparent 1px),
    linear-gradient(90deg, var(--h-graph) 1px, transparent 1px);
  background-size: 28px 28px;
}
/* Two columns: the copy keeps a readable measure on the left, and the
   counts panel fills the right instead of 650px of bare graph paper. */
.hero-grid { display: flex; flex-wrap: wrap; gap: 48px; align-items: stretch; }
.hero-in   { flex: 1 1 600px; max-width: 820px; min-width: 0; }

/* Stretches to the height of the copy beside it, so the rows share out
   whatever space is left rather than leaving a hole under the card. */
.hero-side {
  flex: 0 1 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 2px solid var(--h-ink);
}
.hero-side .lbl {
  margin: 0;
  padding: 11px 16px;
  background: var(--h-ink);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
}
.hero-side .lbl { flex: 0 0 auto; }
.hero-side a {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  color: var(--h-ink);
  text-decoration: none;
  border-bottom: 1px solid var(--h-hair);
}
.hero-side a:last-child { border-bottom: 0; }
.hero-side a:hover { background: var(--h-wash); color: var(--h-red); }
.hero-side .n {
  flex: 0 0 auto;
  min-width: 2.6em;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hero-side .t { font-size: .9375rem; line-height: 1.3; }

.eyebrow {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--h-red);
  margin: 0 0 14px;
}

.hero h1 {
  margin: 0 0 24px;
  font-size: clamp(2.1rem, 6.4vw, 3.875rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
}

.lede {
  margin: 0 0 16px;
  max-width: 660px;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--h-body);
}
.lede:last-of-type { margin-bottom: 32px; }
.lede b { font-weight: 700; color: var(--h-ink); }

/* ── Sections ────────────────────────────────────────────── */
.sec { padding: 58px var(--h-pad); }
.sec-tight { padding-bottom: 0; }
.sec-top { border-top: 2px solid var(--h-ink); }
.sec-bot { border-bottom: 2px solid var(--h-ink); }

.sec h2 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 3.4vw, 2.125rem);
  line-height: 1.08;
}
.intro {
  margin: 0 0 32px;
  max-width: 640px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--h-grey-2);
}

/* ── Directory, drawn as a mark sheet ────────────────────── */
.dir {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--h-ink);
}
.dir > div { border-right: 1px solid var(--h-ink); min-width: 0; }
.dir > div:last-child { border-right: 0; }

.dir h3 {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  background: var(--h-ink);
  color: #fff;
}

.cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  font-size: .9375rem;
  color: var(--h-ink);
  text-decoration: none;
  border-right: 1px solid var(--h-hair);
  border-bottom: 1px solid var(--h-hair);
}
.dir > div > .cell:last-child { border-bottom: 0; }
.cell:hover { background: var(--h-wash); color: var(--h-red); }
.cell em {
  flex: 0 0 auto;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  font-style: normal;
  font-size: .75rem;
  color: var(--h-mono);
}
.cell:hover em { color: var(--h-red); }

/* ── Boxed cards: what's inside, FAQ ─────────────────────── */
.boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 1080px;
  border-top: 1px solid var(--h-hair);
  border-left: 1px solid var(--h-hair);
}
.boxes > article {
  padding: 25px 28px;
  border-right: 1px solid var(--h-hair);
  border-bottom: 1px solid var(--h-hair);
}
.boxes h3 {
  margin: 0 0 10px;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.boxes p { margin: 0; font-size: .97rem; line-height: 1.68; color: var(--h-grey); }

/* FAQ headings are questions, so they keep sentence case. */
/* ── Inverted panel: interactives ────────────────────────── */
.inverse {
  padding: 56px var(--h-pad);
  background: var(--h-ink);
  color: #fff;
}
.inverse h2 { color: #fff; }
.inverse .eyebrow { color: var(--h-red-lt); }
.inverse p { margin: 0 0 24px; max-width: 46em; font-size: 1.03rem; line-height: 1.68; color: var(--h-dim); }
.inverse-in { display: flex; flex-wrap: wrap; gap: 44px; align-items: flex-start; }
.inverse-in > div { flex: 1 1 380px; min-width: 0; }

.int-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--h-line);
  border-left: 1px solid var(--h-line);
}
.int-grid a {
  display: block;
  padding: 16px;
  font-size: .9rem;
  line-height: 1.45;
  color: #fff;
  text-decoration: none;
  border-right: 1px solid var(--h-line);
  border-bottom: 1px solid var(--h-line);
}
.int-grid a:hover { background: var(--h-red); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn, .btn-o, .btn-w, .btn-wo {
  display: inline-block;
  padding: 13px 26px;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: .9375rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--h-ink);
}
.btn    { background: var(--h-ink); color: #fff; }
.btn:hover { background: var(--h-red); border-color: var(--h-red); color: #fff; }
.btn-o  { background: #fff; color: var(--h-ink); }
.btn-o:hover { border-color: var(--h-red); color: var(--h-red); }
.btn-w  { background: #fff; color: var(--h-ink); border-color: #fff; }
.btn-w:hover { background: var(--h-red-lt); border-color: var(--h-red-lt); color: var(--h-ink); }
.btn-wo { background: transparent; color: #fff; border-color: var(--h-line); }
.btn-wo:hover { border-color: #fff; }

/* ── Tool tags ───────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block;
  padding: 9px 15px;
  font-size: .875rem;
  color: var(--h-ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--h-ink);
}
.tag:hover { background: var(--h-ink); color: #fff; }

/* ── Close ───────────────────────────────────────────────── */
.close {
  padding: 46px var(--h-pad);
  background: var(--h-ink);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.close > div:first-child { flex: 1 1 400px; min-width: 0; }
.close h2 { margin: 0 0 9px; font-size: 1.625rem; color: #fff; letter-spacing: -0.02em; }
.close p { margin: 0; font-size: .97rem; line-height: 1.6; color: var(--h-dim); }
.close-btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* ═══ Shared furniture, overridden for this page only ═════ */

/* The nav's styling now lives in header.js, so every page gets it and this
   page overrides nothing. Only the footer colour is local. */
footer { background: var(--h-ink); }
footer .ft-logo .spark { color: var(--h-red-lt); }

/* ── Narrow screens ──────────────────────────────────────── */
@media (max-width: 1000px) {
  .dir { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dir > div:nth-child(2) { border-right: 0; }
  .dir > div:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--h-ink); }
}

@media (max-width: 760px) {
  :root { --h-pad: 16px; }
  .wrap { border-left: 0; border-right: 0; }
  .hero { padding-top: 44px; padding-bottom: 40px; }
  .hero-grid { gap: 32px; }
  .hero-side { flex: 1 1 100%; }
  .sec { padding-top: 42px; padding-bottom: 42px; }
  .dir, .boxes, .int-grid { grid-template-columns: minmax(0, 1fr); }
  .dir > div, .dir > div:nth-child(2) { border-right: 0; }
  .dir > div + div { border-top: 1px solid var(--h-ink); }
  .dir > div:nth-child(3) { grid-column: auto; }
  .cell { border-right: 0; }
  .boxes > article { border-right: 0; padding: 22px 18px; }
  .int-grid a { border-right: 0; }
  .inverse-in { gap: 32px; }
  .spec > span { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--h-hair); }
  .spec > span + span { padding-left: var(--h-pad); padding-right: var(--h-pad); }
  .spec > span:last-child { border-bottom: 0; }
  .close { padding: 36px var(--h-pad); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* The frame pieces on a body-HTML page are each their own container,
   because the body between them sets its own width. */
.crumbs.wrap, .spec.wrap, .close.wrap, .sec.wrap { margin-left: auto; margin-right: auto; }
.sec.wrap { border-left: 0; border-right: 0; }

/* Shared with the body-HTML pages, which do not load gradepage.css. */
/* ── Breadcrumb ──────────────────────────────────────────── */
.crumbs {
  padding: 11px var(--h-pad);
  border-bottom: 1px solid var(--h-hair);
  color: var(--h-mono);
}
.crumbs a { color: var(--h-mono); text-decoration: none; }
.crumbs a:hover { color: var(--h-red); }
.crumbs span { color: var(--h-hair); padding: 0 4px; }
.crumbs > span:last-child { color: var(--h-ink); padding-left: 0; }

/* ── Dense link lists ────────────────────────────────────── */
.rows {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  border-top: 1px solid var(--h-ink);
  border-left: 1px solid var(--h-hair);
}
.rows .cell { border-right: 1px solid var(--h-hair); border-bottom: 1px solid var(--h-hair); }

.more { margin: 22px 0 0; }

