/* =========================================================================
   Delhi Noon Chart Archive — design system
   One stylesheet, no framework, no web fonts.
   Order: tokens → reset → layout → components → utilities → motion → print.
   ========================================================================= */

/* ---------- Tokens ------------------------------------------------------ */
:root {
  /* Surfaces: a cool near-black base with three lifted planes. Each step is a
     real elevation change, so cards read as stacked rather than outlined. */
  --bg:            #070b13;
  --bg-grad:       radial-gradient(1200px 680px at 50% -220px, #14203a 0%, #070b13 64%);
  --surface:       #0e1420;
  --surface-2:     #141c2b;
  --surface-3:     #1b2436;

  --border:        rgb(255 255 255 / 8%);
  --border-strong: rgb(255 255 255 / 16%);

  --text:          #e8edf7;
  --text-dim:      #9aa7bd;
  --text-faint:    #6c7b93;

  /* Two accents and no more. Indigo carries navigation and actions; teal is
     reserved for data — every recorded value on the site is teal, nothing
     else is, so the eye learns it in one screen. */
  --accent:        #7c9cff;
  --accent-2:      #2fe0c0;
  --accent-soft:   rgb(124 156 255 / 14%);
  --accent-ring:   rgb(124 156 255 / 38%);
  --data:          #2fe0c0;
  --data-soft:     rgb(47 224 192 / 12%);

  --ok:            #46d39a;
  --warn:          #ffb366;
  --idle:          #8b98b0;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 45%);
  --shadow-md: 0 10px 30px -14px rgb(0 0 0 / 75%);
  --shadow-lg: 0 28px 70px -28px rgb(0 0 0 / 88%);

  --shell:  1180px;
  --gutter: 16px;
  --header-h: 64px;

  /* System UI stack: zero network cost, no swap shift against LCP, and a
     correct Devanagari fallback on Indian devices. */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --step--1: clamp(.8rem, .78rem + .1vw, .86rem);
  --step-0:  clamp(.95rem, .92rem + .15vw, 1rem);
  --step-1:  clamp(1.08rem, 1.02rem + .3vw, 1.22rem);
  --step-2:  clamp(1.3rem, 1.18rem + .6vw, 1.65rem);
  --step-3:  clamp(1.65rem, 1.4rem + 1.15vw, 2.3rem);
  --step-4:  clamp(2rem, 1.55rem + 2.2vw, 3.2rem);

  color-scheme: dark;
}

@media (min-width: 640px) { :root { --gutter: 24px; --header-h: 72px; } }

/* ---------- Reset ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg) var(--bg-grad) no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  line-height: 1.18;
  letter-spacing: -.02em;
  font-weight: 700;
  text-wrap: balance;
}

h1 { font-size: var(--step-4); letter-spacing: -.035em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); }

p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #a8bcff; }

ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .4em; }

img, svg { max-width: 100%; height: auto; display: block; }

code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding: .1em .35em;
}

q { quotes: "\201C" "\201D"; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-ring); color: #fff; }

/* ---------- Layout ------------------------------------------------------ */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #06090f;
  font-weight: 700;
  padding: .7rem 1.1rem;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

.section { margin: clamp(2.75rem, 6vw, 4.5rem) 0; }

.section__head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section__head > div { max-width: 62ch; }
.section__head h2 { margin-bottom: .35em; }

.section > h2 { margin-bottom: .6em; }

.section__lede {
  color: var(--text-dim);
  font-size: var(--step-0);
  margin: 0;
  max-width: 62ch;
}

.section__link {
  flex-shrink: 0;
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent-ring);
}
.section__link:hover { border-bottom-color: var(--accent); }

/* ---------- Masthead ---------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(7 11 19 / 82%);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: var(--text);
  margin-right: auto;
}
.brand__mark { display: flex; flex-shrink: 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 1.02rem; letter-spacing: -.02em; }
.brand__text span { font-size: .72rem; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; }

.nav__list {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__list a {
  display: block;
  padding: .5rem .7rem;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav__list a:hover { color: var(--text); background: var(--surface-2); }
.nav__list a[aria-current="page"] { color: var(--text); background: var(--accent-soft); }

.nav__cta a {
  border: 1px solid var(--border-strong);
  margin-left: .3rem;
}

.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 17px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { content: ""; position: absolute; top: -6px; }
.nav-toggle__bars::after  { content: ""; position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after  { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 899px) {
  .nav-toggle { display: flex; }
  .nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: none;
    padding: .5rem var(--gutter) 1rem;
  }
  .nav.is-open { display: block; }
  .nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .nav__list a { padding: .8rem .7rem; font-size: 1rem; border-radius: var(--r-sm); }
  .nav__cta a { margin: .5rem 0 0; text-align: center; }
}

/* ---------- Notice bar -------------------------------------------------- */
.notice-bar {
  background: linear-gradient(90deg, rgb(255 179 102 / 14%), rgb(255 179 102 / 6%));
  border-bottom: 1px solid rgb(255 179 102 / 28%);
  color: #ffd9b0;
  font-size: var(--step--1);
  padding: .65rem 0;
}
.notice-bar strong { color: var(--warn); }
.notice-bar code { background: rgb(255 179 102 / 12%); border-color: rgb(255 179 102 / 24%); color: inherit; }

/* ---------- Breadcrumbs ------------------------------------------------- */
.crumbs { padding: .9rem 0 0; font-size: var(--step--1); }
.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .55rem;
  list-style: none;
  margin: 0; padding: 0;
  color: var(--text-faint);
}
.crumbs li { margin: 0; display: flex; align-items: center; gap: .55rem; }
.crumbs li + li::before { content: "/"; color: rgb(255 255 255 / 20%); }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--text); }

/* ---------- Hero -------------------------------------------------------- */
.hero { padding: clamp(2.25rem, 6vw, 4.25rem) 0 0; }

.hero__inner {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
@media (min-width: 980px) {
  .hero__inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); }
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--step--1);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .8rem;
  margin: 0 0 1.25rem;
}
.hero__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--data);
  box-shadow: 0 0 0 4px var(--data-soft);
}

.hero__title { margin-bottom: .45em; }

.hero__lede {
  font-size: var(--step-1);
  color: var(--text-dim);
  max-width: 54ch;
  margin-bottom: 1.85rem;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 2rem; }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  list-style: none;
  margin: 0; padding: 1.5rem 0 0;
  border-top: 1px solid var(--border);
}
.hero__meta li { display: flex; flex-direction: column; margin: 0; }
.hero__meta b {
  font-family: var(--mono);
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.hero__meta span { font-size: var(--step--1); color: var(--text-faint); }

/* ---------- Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.45rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 650;
  font-size: var(--step-0);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #5f7ff0);
  color: #060912;
  box-shadow: 0 8px 24px -12px var(--accent-ring);
}
.btn--primary:hover { background: linear-gradient(135deg, #93adff, #7c9cff); color: #060912; }

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-3); border-color: var(--accent-ring); color: var(--text); }

.link { font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

.muted-link { color: var(--text-dim); text-decoration: none; }
.muted-link:hover { color: var(--accent); }

/* ---------- Cards ------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: var(--shadow-md);
}

.card--latest { position: relative; overflow: hidden; }
.card--latest::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--data));
}

.card__head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}
.card__title { font-size: var(--step-1); margin: 0 0 .25em; }
.card__sub { font-size: var(--step--1); color: var(--text-faint); margin: 0; }

.card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: var(--step--1);
  color: var(--text-faint);
}

/* ---------- Pills & tags ------------------------------------------------ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  flex-shrink: 0;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .02em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
}
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.is-live    { color: var(--ok);   border-color: rgb(70 211 154 / 32%); background: rgb(70 211 154 / 10%); }
.pill.is-live .pill__dot { animation: pulse 2.4s ease-in-out infinite; }
.pill.is-waiting { color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft); }
.pill.is-idle    { color: var(--idle); }

.tag {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  border: 1px solid var(--border);
}
.tag--live { color: var(--ok); border-color: rgb(70 211 154 / 32%); background: rgb(70 211 154 / 10%); }
.tag--done { color: var(--text-faint); }

/* ---------- Latest record ----------------------------------------------- */
.latest { text-align: center; padding: 1rem 0 1.4rem; }
.latest__label { font-size: var(--step--1); color: var(--text-faint); margin: 0 0 .4rem; }
.latest__value {
  font-family: var(--mono);
  font-size: clamp(3.4rem, 12vw, 5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  color: var(--data);
  font-variant-numeric: tabular-nums;
  margin: 0 0 .5rem;
  text-shadow: 0 0 44px rgb(47 224 192 / 28%);
}
.latest__note {
  font-size: var(--step--1);
  color: var(--text-dim);
  margin: 0 auto;
  max-width: 42ch;
}

/* ---------- Fact grid --------------------------------------------------- */
/* Two columns at every width. The card this sits in is narrow even on a wide
   screen, and a four-across layout wraps "1 Jan 2023" onto two lines there —
   a container problem a viewport media query cannot see. */
.factgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.factgrid__item { background: var(--surface-2); padding: .9rem 1rem; }
.factgrid__item dt { font-size: .72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.factgrid__item dd {
  margin: .25rem 0 .15rem;
  font-family: var(--mono);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.factgrid__item p { font-size: .74rem; color: var(--text-faint); margin: 0; line-height: 1.4; }

/* ---------- Direct answer ----------------------------------------------- */
.answer {
  position: relative;
  background: linear-gradient(135deg, rgb(124 156 255 / 9%), rgb(47 224 192 / 5%));
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-md);
  padding: 1.15rem 1.35rem;
  margin: 2rem 0;
  max-width: 78ch;
}
.answer__label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .4rem;
}
.answer__text { margin: 0; font-size: var(--step-1); line-height: 1.6; color: var(--text); }

/* ---------- Key facts --------------------------------------------------- */
.keyfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  margin: 0 0 2rem;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.keyfacts__row { background: var(--surface); padding: 1rem 1.15rem; }
.keyfacts__row dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); }
.keyfacts__row dd {
  margin: .3rem 0 .2rem;
  font-size: var(--step-1);
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.keyfacts__row p { margin: 0; font-size: .76rem; color: var(--text-faint); line-height: 1.45; }

/* ---------- Page head --------------------------------------------------- */
.pagehead { padding: clamp(1.75rem, 5vw, 3rem) 0 .5rem; max-width: 72ch; }
.pagehead h1 { font-size: var(--step-3); margin-bottom: .4em; }
.pagehead__lede { font-size: var(--step-1); color: var(--text-dim); margin: 0; }

.pagehead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}
.pagehead__meta li {
  margin: 0;
  font-size: var(--step--1);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .28rem .75rem;
  font-variant-numeric: tabular-nums;
}

.pagehead--404 { text-align: center; margin-inline: auto; padding-top: clamp(2.5rem, 8vw, 5rem); }
.pagehead--404 .pagehead__lede { margin-inline: auto; }
.pagehead__code {
  font-family: var(--mono);
  font-size: clamp(3rem, 14vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.05em;
  background: linear-gradient(135deg, var(--accent), var(--data));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0 .3rem;
}

/* ---------- Card grids -------------------------------------------------- */
.cardgrid { display: grid; gap: clamp(.9rem, 2vw, 1.25rem); }
.cardgrid--2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.cardgrid--3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.cardgrid--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* ---------- Tile -------------------------------------------------------- */
.tile, .panel, .article, .monthcard {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.35rem;
  text-decoration: none;
  color: var(--text);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.tile:hover, .panel:hover, .article:hover, .monthcard:hover {
  transform: translateY(-3px);
  border-color: var(--accent-ring);
  background: var(--surface-2);
  color: var(--text);
}

.tile__icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
}
.tile__icon svg { width: 17px; height: 17px; }
.tile h3 { font-size: var(--step-0); color: var(--text-dim); font-weight: 600; margin: .85rem 0 .35rem; }
.tile__value {
  font-family: var(--mono);
  font-size: var(--step-2);
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 0 0 .5rem;
}
.tile__note { font-size: var(--step--1); color: var(--text-faint); line-height: 1.5; margin: 0 0 1.1rem; }
/* Pushed to the bottom so the call to action sits on one baseline across a
   row of cards whose body copy is different lengths. */
.tile__go, .panel__go, .article__go {
  display: block;
  margin-top: auto;
  font-size: var(--step--1);
  font-weight: 650;
  color: var(--accent);
}
.tile__go::after, .panel__go::after, .article__go::after { content: " \2192"; }

/* ---------- Panel ------------------------------------------------------- */
.panel__kicker {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--data);
  margin: 0 0 .5rem;
  font-weight: 700;
}
.panel h3 { font-size: var(--step-1); margin: 0 0 .5rem; }
.panel__body { font-size: var(--step--1); color: var(--text-dim); line-height: 1.55; margin: 0 0 1.1rem; }

/* ---------- Article card ------------------------------------------------ */
.article__kicker {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin: 0 0 .5rem;
  font-weight: 650;
}
.article h3 { font-size: var(--step-1); margin: 0 0 .5rem; }
.article p { font-size: var(--step--1); color: var(--text-dim); line-height: 1.6; margin: 0 0 1.1rem; }

/* ---------- Note -------------------------------------------------------- */
.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.35rem;
}
.note h2, .note h3 { font-size: var(--step-0); margin: 0 0 .6rem; color: var(--text); }
.note p { font-size: var(--step--1); color: var(--text-dim); line-height: 1.6; }

/* ---------- Year & month cards ------------------------------------------ */
.yearcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.35rem;
}
.yearcard__head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.yearcard__head h3 { font-size: var(--step-1); margin: 0 0 .25rem; }
.yearcard__head h3 a { color: var(--text); text-decoration: none; }
.yearcard__head h3 a:hover { color: var(--accent); }
.yearcard__sub { font-size: var(--step--1); color: var(--text-faint); margin: 0; }
.yearcard__foot { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: var(--step--1); }

.monthcard { display: flex; flex-direction: column; }
.monthcard__abbr {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.monthcard h3 { font-size: var(--step-0); margin: .45rem 0 .6rem; }
.monthcard__count {
  font-family: var(--mono);
  font-size: var(--step-1);
  font-weight: 650;
  color: var(--data);
  margin: 0 0 .3rem;
  font-variant-numeric: tabular-nums;
}
.monthcard__count span { font-family: var(--sans); font-size: .72rem; color: var(--text-faint); font-weight: 400; }
.monthcard__state { font-size: .74rem; color: var(--text-faint); margin: 0; }

/* ---------- Chips ------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }
.chips__item {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  padding: .4rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: var(--step--1);
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease, background .18s ease;
}
.chips__item:hover { color: var(--text); border-color: var(--accent-ring); background: var(--surface-3); }
.chips__item b {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  color: var(--data);
  font-variant-numeric: tabular-nums;
}
.chips__item.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ---------- Tables ------------------------------------------------------ */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }

caption {
  caption-side: top;
  text-align: left;
  padding: .95rem 1.1rem;
  font-size: var(--step--1);
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.rectable th, .rectable td {
  padding: .7rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: var(--step-0);
}
.rectable thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-weight: 650;
  background: var(--surface-2);
}
.rectable tbody tr:last-child th,
.rectable tbody tr:last-child td { border-bottom: 0; }
.rectable tbody tr:hover { background: var(--surface-2); }
.rectable tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.rectable__day { color: var(--text-faint); font-size: var(--step--1); }
.rectable__value {
  font-family: var(--mono);
  font-size: var(--step-1);
  font-weight: 700;
  color: var(--data);
  letter-spacing: .02em;
}
.rectable__pos { color: var(--text-faint); font-size: var(--step--1); white-space: nowrap; }
.rectable--wide td, .rectable--wide th { white-space: nowrap; }

.tablenote {
  font-size: var(--step--1);
  color: var(--text-faint);
  margin: .85rem 0 0;
  max-width: 70ch;
  line-height: 1.55;
}

.empty {
  padding: 2rem 1.1rem;
  text-align: center;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  margin: 0;
}

/* ---------- Year grid chart --------------------------------------------- */
.tablewrap--grid { overflow-x: auto; }

.gridchart { min-width: 620px; }
.gridchart caption { position: sticky; left: 0; max-width: 100vw; }

.gridchart th, .gridchart td {
  padding: .4rem .3rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: .82rem;
}
.gridchart thead th, .gridchart tfoot th {
  background: var(--surface-2);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  font-weight: 650;
  padding-block: .55rem;
}
.gridchart tfoot th { border-bottom: 0; border-top: 1px solid var(--border); }
.gridchart thead th a { color: var(--text-dim); text-decoration: none; }
.gridchart thead th a:hover { color: var(--accent); }
.gridchart .is-muted { opacity: .45; }

.gridchart__corner,
.gridchart__day {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--text-faint);
  font-weight: 600;
  min-width: 42px;
}

.gridchart tbody td {
  font-family: var(--mono);
  font-weight: 650;
  color: var(--data);
  letter-spacing: .02em;
  min-width: 42px;
}
.gridchart tbody tr:nth-child(even) td { background: rgb(255 255 255 / 1.8%); }
.gridchart tbody tr:hover td { background: var(--accent-soft); }
.gridchart td.is-empty { color: rgb(255 255 255 / 14%); font-weight: 400; }
.gridchart td.is-today {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  background: var(--accent-soft) !important;
  color: var(--text);
}

/* ---------- Heat grid --------------------------------------------------- */
.heatgrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
@media (min-width: 640px) { .heatgrid { grid-template-columns: repeat(10, minmax(0, 1fr)); } }

.heatgrid__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  aspect-ratio: 1;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: .2rem;
}
.heatgrid__cell b {
  font-family: var(--mono);
  font-size: .86rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.heatgrid__cell span { font-size: .64rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.heatgrid__cell[data-heat="0"] { background: var(--surface); }
.heatgrid__cell[data-heat="1"] { background: rgb(47 224 192 / 8%);  border-color: rgb(47 224 192 / 16%); }
.heatgrid__cell[data-heat="2"] { background: rgb(47 224 192 / 16%); border-color: rgb(47 224 192 / 26%); }
.heatgrid__cell[data-heat="3"] { background: rgb(47 224 192 / 26%); border-color: rgb(47 224 192 / 38%); }
.heatgrid__cell[data-heat="4"] { background: rgb(47 224 192 / 38%); border-color: rgb(47 224 192 / 52%); }
.heatgrid__cell[data-heat="3"] span,
.heatgrid__cell[data-heat="4"] span { color: rgb(232 237 247 / 78%); }

/* ---------- Bars -------------------------------------------------------- */
.bars { display: flex; flex-direction: column; gap: .6rem; }
.bars__row { display: grid; grid-template-columns: 62px 1fr auto; gap: .75rem; align-items: center; }
.bars__label {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 650;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.bars__track {
  display: block;
  height: 9px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bars__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--data));
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}
.bars__value {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--text-faint);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bars__value i { font-style: normal; opacity: .72; }

/* Quantised widths keep the page valid under a strict CSP: no inline styles. */
.bars__fill[data-bar="0"]  { width: 2%;   }
.bars__fill[data-bar="1"]  { width: 5%;   }
.bars__fill[data-bar="2"]  { width: 10%;  }
.bars__fill[data-bar="3"]  { width: 15%;  }
.bars__fill[data-bar="4"]  { width: 20%;  }
.bars__fill[data-bar="5"]  { width: 25%;  }
.bars__fill[data-bar="6"]  { width: 30%;  }
.bars__fill[data-bar="7"]  { width: 35%;  }
.bars__fill[data-bar="8"]  { width: 40%;  }
.bars__fill[data-bar="9"]  { width: 45%;  }
.bars__fill[data-bar="10"] { width: 50%;  }
.bars__fill[data-bar="11"] { width: 55%;  }
.bars__fill[data-bar="12"] { width: 60%;  }
.bars__fill[data-bar="13"] { width: 65%;  }
.bars__fill[data-bar="14"] { width: 70%;  }
.bars__fill[data-bar="15"] { width: 75%;  }
.bars__fill[data-bar="16"] { width: 80%;  }
.bars__fill[data-bar="17"] { width: 85%;  }
.bars__fill[data-bar="18"] { width: 90%;  }
.bars__fill[data-bar="19"] { width: 95%;  }
.bars__fill[data-bar="20"] { width: 100%; }

/* ---------- Steps ------------------------------------------------------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.steps > li {
  counter-increment: step;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.15rem 1.35rem 1.15rem 3.5rem;
  margin: 0;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 1.15rem;
  top: 1.15rem;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  color: var(--accent);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
}
.steps h3 { font-size: var(--step-0); margin: 0 0 .4rem; }
.steps p { font-size: var(--step--1); color: var(--text-dim); margin: 0; line-height: 1.6; }

/* ---------- FAQ --------------------------------------------------------- */
.faq { display: grid; gap: .6rem; }

.faq__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.faq__item[open] { border-color: var(--accent-ring); }

.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary h3 { font-size: var(--step-0); margin: 0; font-weight: 600; }
.faq__item summary::after {
  content: "+";
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: transform .2s ease;
}
.faq__item[open] summary::after { content: "\2212"; }
.faq__item summary:hover { background: var(--surface-2); }

.faq__answer { padding: 0 1.25rem 1.15rem; }
.faq__answer p { color: var(--text-dim); margin: 0; max-width: 78ch; }

/* ---------- Article layout & prose -------------------------------------- */
.articlelayout { display: grid; gap: 2rem; align-items: start; margin-top: 1.5rem; }
@media (min-width: 1000px) {
  .articlelayout { grid-template-columns: 230px minmax(0, 1fr); gap: 3rem; }
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.1rem 1.25rem;
}
@media (min-width: 1000px) { .toc { position: sticky; top: calc(var(--header-h) + 16px); } }
.toc__title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 700;
  margin: 0 0 .7rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0 0 .1rem; counter-increment: toc; }
.toc a {
  display: block;
  padding: .35rem .5rem;
  border-radius: var(--r-xs);
  font-size: var(--step--1);
  color: var(--text-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a.is-current { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

.prose { max-width: 72ch; }
.prose h2 {
  font-size: var(--step-2);
  margin: 2.5rem 0 .7em;
  padding-top: .4rem;
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h2:first-of-type { margin-top: 1.5rem; }
.prose h3 { font-size: var(--step-1); margin: 1.8rem 0 .5em; }
.prose p, .prose li { color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .55em; }

/* ---------- Callouts ---------------------------------------------------- */
.callout {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 1.1rem 1.35rem;
  margin: 1.75rem 0;
}
.callout h2, .callout h3 { font-size: var(--step-0); margin: 0 0 .5rem; color: var(--text); }
.callout p { margin: 0 0 .6rem; font-size: var(--step--1); color: var(--text-dim); }
.callout p:last-child { margin: 0; }

.callout--warn { border-left-color: var(--warn); background: rgb(255 179 102 / 7%); border-color: rgb(255 179 102 / 24%); }
.callout--warn h2, .callout--warn h3 { color: var(--warn); }
.callout--ok { border-left-color: var(--ok); background: rgb(70 211 154 / 7%); border-color: rgb(70 211 154 / 24%); }
.callout--ok h2, .callout--ok h3 { color: var(--ok); }

/* ---------- Forms ------------------------------------------------------- */
.contactlayout { display: grid; gap: 2rem; align-items: start; margin-top: 1.5rem; }
@media (min-width: 1000px) {
  .contactlayout { grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: 2.5rem; }
}
.contactlayout__side { display: grid; gap: 1rem; }

.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__row { margin-bottom: 1.25rem; }
.form__row label {
  display: block;
  font-size: var(--step--1);
  font-weight: 650;
  margin-bottom: .4rem;
  color: var(--text);
}

.form input[type="text"],
.form input[type="email"],
.form select,
.form textarea {
  width: 100%;
  padding: .7rem .85rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: var(--step-0);
  line-height: 1.5;
}
.form textarea { resize: vertical; min-height: 9rem; }
.form input:focus, .form select:focus, .form textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-ring);
  outline-offset: 1px;
}
.form [aria-invalid="true"] { border-color: var(--warn); }

.form__hint { font-size: .76rem; color: var(--text-faint); margin: .4rem 0 0; }
.form__error { font-size: .78rem; color: var(--warn); margin: .4rem 0 0; font-weight: 600; }
.form__legal { font-size: .76rem; color: var(--text-faint); margin: 1.1rem 0 0; line-height: 1.55; }

.ticks { list-style: none; padding: 0; margin: 0 0 .9rem; }
.ticks li {
  position: relative;
  padding-left: 1.4rem;
  font-size: var(--step--1);
  color: var(--text-dim);
  margin-bottom: .45em;
}
.ticks li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--data);
  font-weight: 700;
}

/* ---------- Prev / next ------------------------------------------------- */
.prevnext {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .9rem;
  margin: 2.5rem 0;
}
.prevnext__item {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: border-color .18s ease, background .18s ease;
}
.prevnext__item:hover { border-color: var(--accent-ring); background: var(--surface-2); }
.prevnext__item span { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.prevnext__item b { font-size: var(--step-0); color: var(--text); font-weight: 650; }
.prevnext__item--next { text-align: right; }

/* ---------- Link grid --------------------------------------------------- */
.linkgrid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.linkgrid h3 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin: 0 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.linkgrid ul { list-style: none; margin: 0; padding: 0; }
.linkgrid li { margin-bottom: .45em; }
.linkgrid a { font-size: var(--step--1); color: var(--text-dim); text-decoration: none; }
.linkgrid a:hover { color: var(--accent); }

/* ---------- Byline ------------------------------------------------------ */
.byline {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 2rem 0;
}
.byline__avatar {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--data));
  color: #060912;
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: -.02em;
}
.byline__name { font-weight: 650; margin: 0 0 .1rem; font-size: var(--step-0); }
.byline__meta { font-size: .76rem; color: var(--text-faint); margin: 0; line-height: 1.5; }
.byline__meta a { color: var(--text-dim); }

/* ---------- Scope note -------------------------------------------------- */
.scopenote {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--data);
  border-radius: var(--r-md);
  padding: 1.35rem 1.5rem;
  margin: 2.5rem 0;
}
.scopenote h2 { font-size: var(--step-1); margin: 0 0 .6rem; }
.scopenote p { font-size: var(--step--1); color: var(--text-dim); max-width: 80ch; }
.scopenote strong { color: var(--text); }

/* ---------- Footer ------------------------------------------------------ */
.footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: clamp(2.5rem, 6vw, 4rem) 0 2rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 2.5rem;
}
@media (min-width: 900px) { .footer__grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
@media (min-width: 1100px) { .footer__grid { grid-template-columns: 1.7fr 1fr 1fr 1fr 1fr; } }

.footer__logo { font-size: var(--step-1); margin: 0 0 .7rem; letter-spacing: -.02em; color: var(--text-dim); }
.footer__logo strong { color: var(--text); }
.footer__blurb { font-size: var(--step--1); color: var(--text-faint); max-width: 44ch; line-height: 1.65; }
.footer__source { font-size: .76rem; color: var(--text-faint); margin: .9rem 0 0; }

.footer__col h2 {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  margin: 0 0 .85rem;
}
.footer__col ul { list-style: none; margin: 0; padding: 0; }
.footer__col li { margin-bottom: .5em; }
.footer__col a { font-size: var(--step--1); color: var(--text-dim); text-decoration: none; }
.footer__col a:hover { color: var(--accent); }

.footer__legal {
  border-top: 1px solid var(--border);
  padding-top: 1.75rem;
}
.footer__legal p { font-size: .76rem; color: var(--text-faint); line-height: 1.7; max-width: 92ch; }
.footer__legal strong { color: var(--text-dim); }
.footer__copy { margin-top: 1rem; font-variant-numeric: tabular-nums; }

/* ---------- Back to top ------------------------------------------------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.to-top:hover { background: var(--surface-3); border-color: var(--accent-ring); }
.to-top[hidden] { display: none; }

/* ---------- Motion ------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Print ------------------------------------------------------- */
@media print {
  .masthead, .nav, .to-top, .notice-bar, .crumbs, .linkgrid, .prevnext, .toc { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .note, .tablewrap, .faq__item { border-color: #999; box-shadow: none; }
  .gridchart tbody td, .rectable__value, .latest__value { color: #000; text-shadow: none; }
  a { color: #000; text-decoration: underline; }
  .tablewrap { overflow: visible; }
}
