/* ==========================================================================
   weeks.charlessieg.com
   --------------------------------------------------------------------------
   One family with charlessieg.com and its other sites: the same
   graphite ground and type, with one green accent, the lit week of the Telltale wall (the --brass tokens keep
   their family name so the two stylesheets stay diffable), a serif display over a neutral sans
   body, and mono for every label that reads like an instrument.
   Every color is a token below, and every token is defined for light, for
   dark by preference, and for an explicit dark choice. Contrast targets
   WCAG 2.1 AA: body text 4.5:1 or better on every surface it sits on.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --ground: #eef1f3;
  --surface: #fbfcfd;
  --surface-2: #f5f7f9;
  --band: #e4e8eb;
  --ink: #11161b;
  --ink-2: #4b5661;
  --ink-3: #5d6873;
  --rule: #d2d8dc;
  --rule-2: #b3bcc3;
  --brass: #2c6b5b;
  --brass-hover: #1f5346;
  --brass-wash: #deebe6;
  --on-brass: #ffffff;
  --signal: #2c6b5b;
  --signal-wash: #deebe6;
  --moderate: #7a5a14;
  --moderate-wash: #f4ead2;
  --early: #4b5661;
  --early-wash: #e4e8eb;
  --mixed: #9a3b2e;
  --mixed-wash: #f6e4e0;
  --alert: #8a2f22;
  --alert-wash: #f8e6e2;
  --shadow: 0 1px 2px rgba(17, 22, 27, .05);
  --shadow-lift: 0 2px 10px rgba(17, 22, 27, .07);

  --f-display: "Newsreader", "Hoefler Text", "Iowan Old Style", Palatino, Georgia, serif;
  --f-body: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --t-xs: .75rem;
  --t-sm: .8125rem;
  --t-md: .9375rem;
  --t-base: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: 1.625rem;
  --t-2xl: 2.25rem;
  --t-3xl: 3.25rem;

  --wrap: 1440px;
  --measure: 70ch;
  --gutter: 1.25rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0e1216;
    --surface: #161b21;
    --surface-2: #12171c;
    --band: #1d242b;
    --ink: #e3e8ec;
    --ink-2: #a3afb9;
    --ink-3: #8f9ba5;
    --rule: #28313a;
    --rule-2: #3c4751;
    --brass: #5cb39a;
    --brass-hover: #7fcab3;
    --brass-wash: #14261f;
    --on-brass: #14191e;
    --signal: #5cb39a;
    --signal-wash: #14261f;
    --moderate: #d9b25e;
    --moderate-wash: #2a2312;
    --early: #a3afb9;
    --early-wash: #1d242b;
    --mixed: #e08a7a;
    --mixed-wash: #2b1714;
    --alert: #eb9a8b;
    --alert-wash: #2e1814;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lift: 0 2px 12px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  --ground: #0e1216;
  --surface: #161b21;
  --surface-2: #12171c;
  --band: #1d242b;
  --ink: #e3e8ec;
  --ink-2: #a3afb9;
  --ink-3: #8f9ba5;
  --rule: #28313a;
  --rule-2: #3c4751;
  --brass: #5cb39a;
  --brass-hover: #7fcab3;
  --brass-wash: #14261f;
  --on-brass: #14191e;
  --signal: #5cb39a;
  --signal-wash: #14261f;
  --moderate: #d9b25e;
  --moderate-wash: #2a2312;
  --early: #a3afb9;
  --early-wash: #1d242b;
  --mixed: #e08a7a;
  --mixed-wash: #2b1714;
  --alert: #eb9a8b;
  --alert-wash: #2e1814;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lift: 0 2px 12px rgba(0, 0, 0, .5);
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-base);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

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

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--brass-hover); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 400; line-height: 1.15; color: var(--ink); margin: 0; text-wrap: balance; }

p, ul, ol, table, blockquote { margin: 0 0 1.1rem; }

code, kbd, samp { font-family: var(--f-data); font-size: .9em; }

.skip {
  position: absolute; left: -999px; top: .5rem; z-index: 100;
  background: var(--surface); color: var(--ink); padding: .5rem .9rem; border-radius: 6px; box-shadow: var(--shadow-lift);
}
.skip:focus { left: .75rem; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-family: var(--f-data); font-size: var(--t-xs); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 .6rem;
}

/* 3. Header ---------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: 3.75rem; }
.brand {
  display: inline-flex; align-items: baseline; gap: .45rem; text-decoration: none; color: var(--ink);
  font-family: var(--f-display); font-size: 1.3rem; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand__mark { color: var(--brass); font-family: var(--f-data); font-size: .9rem; }
.brand__sub { font-family: var(--f-data); font-size: var(--t-xs); color: var(--ink-3); letter-spacing: .04em; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 .6rem;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: var(--t-sm); cursor: pointer; margin-left: auto;
}
.theme-toggle:hover { border-color: var(--rule-2); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (max-width: 420px) { .brand__sub { display: none; } }


/* 4. The page: facts beside the grid ---------------------------------------- */
/* On a wide screen the facts stand to the left of the grid and a year of age is a column. Under 900 pixels the
   facts lie above it and a year is a row (site.js draws the grid the other way at the same width). */
.life {
  display: grid; grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr); gap: 2.5rem; align-items: center;
  padding-top: 2.5rem; padding-bottom: 2.5rem;
}
.facts h1 { font-size: clamp(2rem, 4.2vw, 2.75rem); letter-spacing: -.01em; }
.facts__lede { color: var(--ink-2); margin: .8rem 0 1.5rem; line-height: 1.5; }
.life[data-state="filled"] .facts__prompt { display: none; }
.facts__note { color: var(--ink-2); font-size: var(--t-md); margin: 0 0 1rem; }

.age { display: flex; flex-direction: column; gap: .35rem; margin: 0 0 1.5rem; }
.age > div { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: .7rem; }
.age dd {
  margin: 0; min-width: 1.3em; font-family: var(--f-display); font-size: clamp(3.5rem, 6vw, 4.75rem); font-weight: 400;
  line-height: 1; font-variant-numeric: tabular-nums lining-nums; color: var(--ink);
}
.age dt { font-size: var(--t-lg); color: var(--ink-2); }

.counts { list-style: none; margin: 0 0 1.25rem; padding: 0; color: var(--ink-2); line-height: 1.6; }
.counts b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; margin-right: .3em; }

.key { margin: 1.5rem 0 0; font-size: var(--t-sm); line-height: 1.5; color: var(--ink-2); }
.key__now { display: inline-block; width: .7rem; height: .7rem; margin-right: .35rem; background: var(--brass); vertical-align: -.05em; }

.grid-box { min-width: 0; }
.grid { display: block; width: 100%; height: auto; }
.grid-lived { fill: var(--ink); fill-opacity: .82; }
.grid-ahead { fill: var(--ink); fill-opacity: .13; }
.grid-now { fill: var(--brass); stroke: var(--brass); stroke-width: 3; }
.grid-mark { font-family: var(--f-data); font-variant-numeric: tabular-nums; fill: var(--ink-3); }

@media (max-width: 899px) {
  .life { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; padding-top: 1.75rem; }
  .age { flex-direction: row; flex-wrap: wrap; gap: .5rem 1.75rem; }
  .age dd { min-width: 0; }
  .counts { display: flex; flex-wrap: wrap; gap: .1rem 1.5rem; }
  .grid { max-width: 35rem; margin: 0 auto; }
}

/* 5. The birthday form ------------------------------------------------------ */
.birthday fieldset { border: 0; margin: 0 0 .9rem; padding: 0; min-width: 0; }
.birthday legend { padding: 0; margin: 0 0 .7rem; font-family: var(--f-display); font-size: var(--t-xl); color: var(--ink); }
.birthday__fields { display: grid; grid-template-columns: minmax(0, 1fr) 4.25rem 5.5rem; gap: .6rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > span { font-family: var(--f-data); font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.field input, .field select {
  width: 100%; min-height: 2.75rem; padding: 0 .7rem; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule-2); border-radius: 8px;
}
.field input::placeholder { color: var(--ink-3); opacity: .75; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--alert); box-shadow: 0 0 0 1px var(--alert); }
.birthday__error { margin: 0 0 .9rem; color: var(--alert); font-size: var(--t-md); font-weight: 500; }
.birthday__privacy { margin: 1rem 0 0; font-size: var(--t-sm); color: var(--ink-2); line-height: 1.5; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0 1.1rem;
  border: 1px solid var(--brass); border-radius: 8px; background: var(--brass); color: var(--on-brass);
  font: inherit; font-size: var(--t-md); font-weight: 600; cursor: pointer;
}
.button:hover { background: var(--brass-hover); border-color: var(--brass-hover); }
.button--quiet { background: var(--surface); color: var(--ink); border-color: var(--rule-2); font-weight: 500; }
.button--quiet:hover { background: var(--band); border-color: var(--rule-2); }
[hidden] { display: none !important; }

/* 6. The words under the grid, and the missing page ------------------------- */
.about { padding-top: 1rem; padding-bottom: 2rem; }
.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--t-xl); margin: 2rem 0 .7rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0 0 .45rem; }
.prose strong { font-weight: 600; }
.about .prose { color: var(--ink-2); }
.missing { padding-top: 3.5rem; padding-bottom: 3rem; }
.missing h1 { font-size: clamp(2.1rem, 6vw, var(--t-3xl)); }

/* 7. Footer ----------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); background: var(--surface-2); margin-top: 2rem; padding: 2.25rem 0 2.5rem; font-size: var(--t-sm); color: var(--ink-2); }
.disclaimer {
  border: 1px solid color-mix(in srgb, var(--signal) 40%, var(--rule)); background: var(--signal-wash);
  border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1.75rem; color: var(--ink);
}
.disclaimer h2 { font-family: var(--f-body); font-size: var(--t-md); font-weight: 700; margin: 0 0 .35rem; color: var(--signal); letter-spacing: .01em; }
.disclaimer p { margin: 0; font-size: var(--t-sm); line-height: 1.55; max-width: 80ch; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1.5rem; }
.footer-grid h2 { font-family: var(--f-data); font-size: var(--t-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 500; margin: 0 0 .6rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 0 0 .4rem; }
.footer-grid a { color: var(--ink-2); }
.footer-grid a:hover { color: var(--brass); }
.footer-fine { margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: var(--t-xs); color: var(--ink-3); }
.footer-fine p { margin: 0 0 .4rem; }

/* 8. Small screens and paper ------------------------------------------------ */
@media (max-width: 640px) {
  :root { --gutter: 1rem; }
  body { font-size: 1rem; }
}

@media print {
  .site-header, .theme-toggle, .birthday, .actions, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
