/* Self-hosted fonts (card 2.2 - SPEC S11: basements offline, no CDN at runtime).
   Latin subset woff2, SIL OFL 1.1 (free). font-display: swap. */
@font-face {
  font-family: "Roboto Slab"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/fonts/roboto-slab-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 500;
  font-display: swap; src: url("/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("/fonts/inter-600.woff2") format("woff2");
}

/*
 * site.css - shared stylesheet for freddiechambers-site.
 *
 * Derived from design/mock-site/ shared CSS (consistency-verified byte-identical
 * across all pages, 11-08-26). Fonts self-hosted in card 2.2 - see @font-face above.
 *
 * Design system tokens and rules: design/SPEC.md (fixed schema - do not alter
 * without a design card). Visual truth: design/variants/g-fern.html +
 * g-projects-fern.html + design/mock-site/.
 */

:root {
  --page:   #F0F0F0;
  --card:   #FFFFFF;
  --ink:    #525252;
  --soft:   #6E6E6E;
  --line:   #E4E4E4;
  --accent: #4E9A6F;        /* large text (>=24px), UI elements, focus outlines */
  --accent-text: #3F7D58;   /* body-size accent TEXT - AA 4.9:1 (SPEC A8.3) */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.62 "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --- Slab helper (Roboto Slab for display headings) --- */
.slab { font-family: "Roboto Slab", Georgia, "Times New Roman", serif; }

/* --- White content card centred on stone background --- */
.card {
  background: var(--card);
  max-width: 1040px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 64px;
}

/* --- Persistent navigation --- */
nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 8px; /* SPEC A8.2: wrapped nav rows need real separation */
  align-items: baseline;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
nav .name {
  font-weight: 500;
  font-size: 16px;
  margin-right: auto;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-decoration: none;
  padding: 10px 0;
}
nav a:not(.name) {
  color: var(--soft);
  text-decoration: none;
  font-size: 14px;
  padding: 10px 5px;
  transition: color 150ms ease;
}
nav a:not(.name):hover { color: var(--accent-text); }
/* Active tab: accent-text #3F7D58 weight 500 - instant "where am I" */
nav a[aria-current="page"] { color: var(--accent-text); font-weight: 500; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --- Main flex fill --- */
main { flex: 1; }

/* --- Two-column open grid (rail + body) --- */
.open {
  display: grid;
  grid-template-columns: 210px 1fr;
  column-gap: 72px;
  padding: 56px 0 64px;
}

/* --- Person rail (pixel-locked, top-anchored, identical every page) --- */
.rail {
  border-right: 1px solid var(--line);
  padding-right: 40px;
  align-self: start;
}
.rail .who   { font-weight: 500; font-size: 16px; color: var(--ink); margin-bottom: 2px; }
.rail .what  { font-size: 14px;   color: var(--soft); margin-bottom: 22px; }
/* Subpage contextual rail (SPEC A1): uppercase fern page label + 2-3 context lines */
.rail .ctx-label {
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 10px;
}
.rail .ctx { font-size: 14px; color: var(--soft); line-height: 1.55; margin-bottom: 22px; }
.rail .where { font-size: 13.5px; color: var(--soft); margin-bottom: 22px; }
.rail .links { display: flex; flex-direction: column; }
.rail .links a {
  color: var(--accent-text);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 0;
  transition: color 150ms ease;
}
.rail .links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- h1 ramp (named classes, never inline styles) --- */
/* hero: 52px */
.h1-hero {
  font-weight: 400;
  font-size: 52px;
  line-height: 1.13;
  letter-spacing: -0.018em;
  max-width: 680px;
  margin-bottom: 26px;
  color: var(--ink);
}
/* content pages: 44px */
.body h1 {
  font-weight: 400;
  font-size: 44px;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
/* standfirst below h1 */
.body .standfirst {
  color: var(--soft);
  font-size: 18px;
  max-width: 520px;
  margin-bottom: 34px;
}

/* home lede */
.hero-lede {
  color: var(--soft);
  max-width: 480px;
  font-size: 18.5px;
  line-height: 1.56;
}
.hero-lede + .hero-lede { margin-top: 18px; }

/* --- List-page item containers --- */
.group {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  margin: 30px 0 12px;
}
.item {
  border-top: 1px solid var(--line);
  padding: 20px 0 26px;
}
.item h2 {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 5px;
}
.item h2 a {
  color: var(--ink);
  text-decoration: none;
  transition: color 150ms ease;
}
.item h2 a:hover { color: var(--accent-text); }
.item p {
  color: var(--soft);
  font-size: 15.5px;
  line-height: 1.55;
  max-width: 560px;
  margin-bottom: 7px;
}
.item .eg   { font-size: 14.5px; color: var(--soft); margin-top: 6px; max-width: 620px; }
.item .meta { font-size: 13.5px; color: var(--soft); }
.live { color: var(--accent-text); font-weight: 500; } /* status signal - works in metas AND detail standfirsts */
/* Meta-line links: accent 500, never browser-default blue (SPEC token rule) */
.item .meta a {
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease;
}
.item .meta a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Annotated-list row (learn, who-i-rate) --- */
.anno {
  border-top: 1px solid var(--line);
  padding: 15px 0;
  display: grid;
  grid-template-columns: 230px 1fr;
  column-gap: 32px;
  align-items: baseline;
}
.anno .aname { font-weight: 500; font-size: 16px; }
.anno .aname a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms ease;
}
.anno .aname a:hover { color: var(--accent-text); }
.anno .why { color: var(--soft); font-size: 15px; }

/* --- Learn page: 250px name column per SPEC A3 --- */
.learn-anno { grid-template-columns: 250px 1fr; }
/* .by: small author line under the title (13px soft, SPEC A3) */
.anno .by { font-size: 13px; color: var(--soft); margin-top: 2px; }
/* .ext: outbound arrow in accent-text (13px, SPEC A3) */
.ext { color: var(--accent-text); font-size: 13px; margin-left: 2px; }

/* --- Event row --- */
.event {
  display: grid;
  grid-template-columns: 150px 1fr 130px;
  column-gap: 32px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.event .date  { font-size: 14px; color: var(--soft); }
.event h2     { font-weight: 500; font-size: 18px; line-height: 1.35; }
.event h2 a   { color: var(--ink); text-decoration: none; transition: color 150ms ease; }
.event h2 a:hover { color: var(--accent-text); }
.event .venue { color: var(--soft); font-size: 14.5px; margin-top: 2px; }
.event .role  { font-size: 13.5px; color: var(--soft); text-align: right; }
.event .role .up { color: var(--accent-text); font-weight: 500; }

/* --- Empty state (shared, no box/illustration/accent) --- */
.empty {
  border-top: 1px solid var(--line);
  padding: 26px 0 8px;
  color: var(--soft);
  font-size: 15.5px;
}

/* --- Writing entry container (SPEC: Writing entry - list page) --- */
/* title Inter 500 18px links to the piece, hook soft 15px max 560px,
   tag/date meta 13.5px. Hairline top per the repeating-item pattern. */
.writing-entry {
  border-top: 1px solid var(--line);
  padding: 20px 0 26px;
}
.writing-title {
  font-weight: 500;
  font-size: 18px;
  line-height: 1.35;
  margin-bottom: 6px;
}
.writing-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 150ms ease;
}
.writing-title a:hover { color: var(--accent-text); }
.writing-hook {
  color: var(--soft);
  font-size: 15px;
  line-height: 1.55;
  max-width: 560px;
  margin-bottom: 6px;
}
.writing-meta {
  font-size: 13.5px;
  color: var(--soft);
}

/* --- Article h1 ramp (SPEC point 5 - named classes, never inline styles) --- */
/* article pages: 38px */
.body h1.h1-article {
  font-size: 38px;
  line-height: 1.14;
  letter-spacing: -0.014em;
  max-width: 640px;
}
/* detail pages: 36px */
.body h1.h1-detail {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  max-width: 640px;
}

/* --- Long-form prose column (article pages only - /writing/<slug>) --- */
/* SPEC: 17px/1.7 ink paragraphs max 620px, display 26px sub-heads,
   hairlines between major sections. Same chrome (nav, rail, footer). */
.prose {
  max-width: 620px;
}
.prose p {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 20px;
}
.prose h2 {
  font-family: "Roboto Slab", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
  color: var(--ink);
  margin: 40px 0 14px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
/* First section head has no top hairline - the standfirst already acts as a separator */
.prose h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
/* Article meta line (tag + date, below h1) */
.article-meta {
  font-size: 13.5px;
  color: var(--soft);
  margin-bottom: 32px;
}
/* Back link under prose */
.back-link {
  display: inline-block;
  margin-top: 40px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-text);
  text-decoration: none;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  width: 100%;
}
.back-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- Footer --- */
footer {
  color: var(--soft);
  font-size: 14px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Footer motif (approved variant C1) - the "AI / aye" serif card-flip wordmark
   at the far right of the footer. Pure CSS, aria-hidden ornament, no layout
   shift; hidden on mobile; static "AI." under reduced-motion. */
.motif { position: relative; height: 26px; min-width: 60px; perspective: 320px; }
.motif .word {
  position: absolute; right: 0; top: 50%; margin-top: -10px;
  font: 400 20px/1.2 "Roboto Slab", Georgia, serif; color: var(--ink);
  white-space: nowrap; transform-origin: 50% 50%;
  backface-visibility: hidden; transform: rotateX(90deg);
}
.motif .word i { font-style: normal; color: var(--accent); font-size: 1.18em; }
.motif .w1 { animation: ftw1 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
.motif .w2 { animation: ftw2 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
.motif .w3 { animation: ftw3 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
.motif .w4 { animation: ftw4 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
.motif .w5 { animation: ftw5 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
.motif .w6 { animation: ftw6 19.2s cubic-bezier(.45, 0, .2, 1) infinite; }
@keyframes ftw1 { 0% { transform: rotateX(90deg); } 2.5%, 13.67% { transform: rotateX(0); } 16.67%, 100% { transform: rotateX(-90deg); } }
@keyframes ftw2 { 0%, 16.67% { transform: rotateX(90deg); } 19.17%, 30.33% { transform: rotateX(0); } 33.33%, 100% { transform: rotateX(-90deg); } }
@keyframes ftw3 { 0%, 33.33% { transform: rotateX(90deg); } 35.83%, 47% { transform: rotateX(0); } 50%, 100% { transform: rotateX(-90deg); } }
@keyframes ftw4 { 0%, 50% { transform: rotateX(90deg); } 52.5%, 63.67% { transform: rotateX(0); } 66.67%, 100% { transform: rotateX(-90deg); } }
@keyframes ftw5 { 0%, 66.67% { transform: rotateX(90deg); } 69.17%, 80.33% { transform: rotateX(0); } 83.33%, 100% { transform: rotateX(-90deg); } }
@keyframes ftw6 { 0%, 83.33% { transform: rotateX(90deg); } 85.83%, 97% { transform: rotateX(0); } 100% { transform: rotateX(-90deg); } } 99%, 100% { transform: rotateX(-90deg); } }
@media (prefers-reduced-motion: reduce) {
  .motif .word { animation: none !important; }
  .motif .w1 { transform: rotateX(0); }
}
@media (max-width: 700px) { .motif { display: none; } }

/* --- Mobile (<=700px) --- */
@media (max-width: 700px) {
  .card  { padding: 0 24px; }
  .open  {
    grid-template-columns: 1fr;
    padding: 36px 0 44px;
    row-gap: 36px;
  }
  /* rail: hero first (order:1), rail below (order:2) */
  .rail {
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 28px 0 0;
    order: 2;
  }
  .rail .links {
    flex-direction: row;
    gap: 22px;
  }
  .rail .links a { padding: 12px 0; }
  .body  { order: 1; }
  .hero  { order: 1; }
  /* Mobile h1 ramp */
  .h1-hero   { font-size: 36px; }
  .body h1   { font-size: 32px; }
  .body h1.h1-article { font-size: 30px; }
  .body h1.h1-detail  { font-size: 28px; }
  .prose h2  { font-size: 22px; }
  /* Event + anno stacks */
  .event { grid-template-columns: 1fr; row-gap: 3px; }
  .event .role { text-align: left; }
  .anno, .learn-anno  { grid-template-columns: 1fr; row-gap: 2px; }
  /* Nav: tighter gaps, 44px tap targets via 11px vertical padding */
  nav { column-gap: 4px; }
  nav a:not(.name) { padding: 11px 6px; }
  nav .name { padding-top: 11px; padding-bottom: 11px; }
}

/* SPEC A8.3: iOS auto-zoom guard - any future input ships at >=16px */
input, textarea, select { font-size: 16px; }

/* --- Who I rate entries (SPEC A5 + A8.1) --- */
/*
 * .anno.wir-entry: overrides the base .anno two-column grid to add a 96px
 * side column per A5: grid 1fr / 96px. The left child (.wir-left) spans the
 * 1fr column; the right child (.wir-side) spans the 96px column.
 *
 * Padding: 22px top / 26px bottom per the mockup (slightly more breathing room
 * than the base .anno 15px).
 *
 * The .anno base rule already supplies border-top and baseline alignment.
 * We override grid and padding only.
 */
.anno.wir-entry {
  grid-template-columns: 1fr 96px;
  column-gap: 20px;
  padding: 22px 0 26px;
  align-items: start;
}

/* Name: Inter 500, 17px, ink, links out (hover to accent-text) */
.wir-entry .aname {
  font-weight: 500;
  font-size: 17px;
  margin-bottom: 5px;
}
.wir-entry .aname a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms ease;
}
.wir-entry .aname a:hover { color: var(--accent-text); }

/* Why: soft 15px, max 520px per A5 */
.wir-entry .why { max-width: 520px; }

/* Start with: 13-14px soft, link accent 500 */
.wir-start {
  font-size: 13.5px;
  color: var(--soft);
  margin-top: 8px;
}
.wir-start a {
  color: var(--accent-text);
  font-weight: 500;
  text-decoration: none;
  transition: color 150ms ease;
}
.wir-start a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Side column: QR + scan label + hidden agree pill */
.wir-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.wir-side img {
  width: 88px;
  height: 88px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px; /* SANCTIONED exception per SPEC A5 - QR tile only */
}
.wir-scan {
  font-size: 11px;
  color: var(--soft);
  display: block;
  margin-top: 5px;
}

/* Agree pill (SPEC A6) - hidden until 1.6b ships the Worker.
 * Styled but never displayed: hidden attribute keeps it out of the layout.
 * No JS, no API calls at this stage. */
.agree {
  display: none; /* hidden attribute + this rule - belt-and-braces */
  margin-top: 10px;
  font: 500 13px/1 "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 16px; /* SANCTIONED exception per SPEC A6 - interactive pill only */
  background: none;
  padding: 7px 12px;
  cursor: pointer;
  width: 88px;
}
.agree:hover { border-color: var(--accent); color: var(--accent-text); }
.agree.on    { border-color: var(--accent); color: var(--accent-text); background: #EFF7F2; }

/* Mobile follow link (A8.1): shown only on mobile, replaces QR */
.wir-follow-mobile { display: none; }

/* Mobile tap-to-follow link (A8.1): visible below 700px, 44px-class tap box */
@media (max-width: 700px) {
  .anno.wir-entry {
    grid-template-columns: 1fr; /* collapse to single column */
    row-gap: 0;
  }
  .wir-side { display: none; } /* hide QR + scan label on mobile */
  .wir-follow-mobile {
    display: inline-block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--accent-text);
    text-decoration: none;
    padding: 11px 0; /* >=44px tap height via line-height + padding */
    transition: color 150ms ease;
  }
  .wir-follow-mobile:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

/* Visually-hidden but accessible (SEO/screen-reader H1 on the home/About page) */
.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; }
