/*
  Minimal system
  - One typeface (Newsreader, self-hosted: no third-party requests).
  - Monochrome ink on paper, one accent (gold), plus functional status colors.
  - Swiss-style asymmetric grid on the home page: small labels in a left margin,
    a single readable column (~65 characters) for everything else.
  - Flush left, ragged right. Few sizes, large jumps. Hairlines only where they separate.
*/

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
}

:root {
  --paper: #fbfaf7;
  --ink: #161616;
  --muted: #6a6862;
  --hair: #e5e2db;
  --accent: #8f6212;
  --ok: #1f8a4c;
  --alert: #b3261e;

  --measure: 38rem;
  --label: 9.5rem;
  --gap: 2.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111110;
    --ink: #e8e5de;
    --muted: #9b978e;
    --hair: #2b2a27;
    --accent: #d9a441;
    --ok: #3ccf7c;
    --alert: #ff6b61;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-size: clamp(1.0625rem, 0.97rem + 0.35vw, 1.1875rem);
  line-height: 1.55;
  font-kerning: normal;
}

::selection { background: var(--accent); color: var(--paper); }

/* ---------- Links ---------- */

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--muted);
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }

/* ---------- Layout ---------- */

.wrap {
  max-width: calc(var(--measure) + 2.5rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.home .wrap { max-width: calc(var(--label) + var(--gap) + var(--measure) + 2.5rem); }

main { padding: 1rem 0 2rem; }

/* ---------- Type scale: few sizes, large jumps ---------- */

h1, h2, h3 { font-weight: 500; line-height: 1.15; margin: 0; }

h1 {
  font-size: clamp(2.1rem, 1.6rem + 2.2vw, 3rem);
  letter-spacing: -0.015em;
}
h2 { font-size: 1.4rem; margin: 3rem 0 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 2rem 0 0.5rem; }

p { margin: 0 0 1em; }

/* Small uppercase labels (letterspaced, per convention for all caps) */
.label, .home section > h2, .paper-meta {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Header & nav ---------- */

.site-header { padding: clamp(3rem, 8vw, 6rem) 0 1.5rem; }
.site-header h1 { max-width: 18ch; }
.site-header .alias {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.site-header .tagline {
  margin: 1rem 0 0;
  font-size: 1.15em;
  font-style: italic;
  color: var(--muted);
  max-width: 34rem;
}
.site-header h1 .ethos {
  font-size: 0.8rem;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.08em;
  vertical-align: 0.9em;
  text-decoration: none;
  color: var(--accent);
  white-space: nowrap;
}
.site-header h1 .ethos:hover { text-decoration: underline; }

.checkin {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.checkin .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--hair); flex: none; }
.checkin.ok .dot { background: var(--ok); }
.checkin.overdue { color: var(--alert); font-weight: 600; }
.checkin.overdue .dot { background: var(--alert); }

.site-nav .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hair);
}
.site-nav a { font-size: 0.95rem; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }

/* ---------- Home: asymmetric label grid ---------- */

.home section { padding: 3rem 0 0; }
.home section > h2 { margin: 0 0 1.25rem; }

@media (min-width: 54rem) {
  .home section {
    display: grid;
    grid-template-columns: var(--label) minmax(0, var(--measure));
    column-gap: var(--gap);
  }
  .home section > h2 { grid-column: 1; grid-row: 1 / span 40; padding-top: 0.45rem; margin: 0; }
  .home section > :not(h2) { grid-column: 2; }
  .home .site-nav .wrap { padding-left: calc(1.25rem + var(--label) + var(--gap)); }
  .home .site-header .wrap > * { margin-left: calc(var(--label) + var(--gap)); }
}

.closing { font-style: italic; }

.project-list { list-style: none; padding: 0; margin: 0; }
.project-list li { margin: 0 0 1.4rem; }
.project-list a { font-size: 1.1em; }
.project-list p { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--muted); }

#safety ul { padding-left: 1.1rem; margin: 0 0 1.5rem; }
#safety li { margin-bottom: 0.9rem; }

.note { font-size: 0.9rem; color: var(--muted); }

/* ---------- Welfare form ---------- */

.welfare label { display: block; margin: 0 0 1rem; font-size: 0.9rem; color: var(--muted); }
.welfare input, .welfare textarea {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 2px;
}
.welfare input:focus, .welfare textarea:focus { border-color: var(--ink); outline: none; }
.welfare button {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 1.3rem;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.welfare button:hover { background: transparent; color: var(--ink); }
.welfare button:disabled { opacity: 0.5; cursor: default; }
.form-result { margin-top: 0.75rem; font-size: 0.9rem; }

/* ---------- Footer ---------- */

.site-footer { margin-top: 3rem; }
.site-footer .wrap {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--hair);
  font-size: 0.85rem;
  color: var(--muted);
}
.home .site-footer .wrap { padding-left: 1.25rem; }
@media (min-width: 54rem) {
  .home .site-footer p { margin-left: calc(var(--label) + var(--gap)); }
}

/* ---------- Article pages ---------- */

.crumb { margin: 0 0 2.5rem; font-size: 0.9rem; }
.crumb a { text-decoration: none; color: var(--muted); }
.crumb a:hover { color: var(--accent); }
.site-header .label { margin: 0 0 0.75rem; }

.article h2 { font-size: 1.4rem; font-weight: 500; margin: 3rem 0 1rem; }
.article h3 { font-size: 1.1rem; }

.hero { margin: 0 0 2.5rem; }
.hero img { display: block; width: 100%; height: auto; }

.article blockquote {
  margin: 0 0 2rem;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}

.article pre, code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.article pre {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  font-size: 0.78rem;
  line-height: 1.55;
}
code { font-size: 0.85em; }

.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; }
.article table { width: 100%; border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; }
.article th, .article td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--hair);
}
.article th { font-weight: 600; color: var(--muted); }

.article hr { border: 0; border-top: 1px solid var(--hair); margin: 3rem 0 1.25rem; }
.article ul { padding-left: 1.1rem; }
.article li { margin-bottom: 0.5rem; }

/* Portrait byline */
.byline { display: flex; align-items: center; gap: 1rem; margin: 0 0 2rem; }
.byline img { width: 3.5rem; height: 3.5rem; border-radius: 50%; flex: none; }
.byline p { margin: 0; font-size: 0.9rem; color: var(--muted); line-height: 1.4; }
.byline strong { display: block; color: var(--ink); font-weight: 600; font-size: 1rem; }

/* Reading list */
.paths { margin: 1.5rem 0 0.5rem; font-size: 0.95rem; }
.paths p { margin: 0.25rem 0; }
.papers { list-style: none; padding: 0; margin: 0; }
.papers li { padding: 1.4rem 0; border-bottom: 1px solid var(--hair); margin: 0; }
.papers li:last-child { border-bottom: 0; }
.papers h3 { margin: 0.3rem 0 0.6rem; font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.papers h3 a { text-decoration: none; }
.papers h3 a:hover { text-decoration: underline; }
.papers p { margin: 0 0 0.6rem; }
.lens { font-size: 0.95rem; font-style: italic; color: var(--muted); }
.lens span { font-style: normal; font-weight: 600; color: var(--accent); }

@media print {
  .site-nav, .checkin, .welfare { display: none; }
  body { background: #fff; color: #000; }
}

/* =========================================================
   Story pages — Medium-style reading
   Sans headline + large serif body, ~680px measure,
   author line, wide images, "· · ·" section breaks.
   ========================================================= */

.story {
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --measure: 42.5rem;
}
.story .wrap { max-width: calc(var(--measure) + 2.5rem); }

.story .site-header { padding: clamp(1.5rem, 4vw, 2.5rem) 0 0; }
.story .crumb { font-family: var(--sans); font-size: 0.85rem; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.story .site-header .label { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.12em; margin-bottom: 0.9rem; }

.story .site-header h1 {
  max-width: none;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
}
.story .site-header .tagline {
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  line-height: 1.4;
  color: var(--muted);
}
.story .site-header .tagline em { font-style: normal; }

.author {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 2rem 0 0;
  padding: 1rem 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  font-family: var(--sans);
}
.author img { width: 2.75rem; height: 2.75rem; border-radius: 50%; flex: none; }
.author p { margin: 0; font-size: 0.9rem; line-height: 1.35; }
.author a { text-decoration: none; font-weight: 600; display: block; }
.author span { color: var(--muted); }

.story main { padding-top: 2.5rem; }

/* Body: large serif, generous leading */
.story .article {
  font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.3125rem);
  line-height: 1.62;
  letter-spacing: -0.003em;
}
.story .article p { margin: 0 0 1.45em; }

/* Headings inside stories: sans, bold, tight */
.story .article h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 2.6em 0 0.6em;
}
.story .article h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 2em 0 0.5em;
}

/* Wide hero image, breaking out of the text column */
.story .hero {
  width: min(100vw - 2.5rem, 60rem);
  margin: 0 0 3rem 50%;
  transform: translateX(-50%);
}

/* Quotes: a single bold rule, italic */
.story .article blockquote {
  margin: 0 0 1.6em;
  padding: 0 0 0 1.4rem;
  border-left: 3px solid var(--ink);
  color: var(--ink);
  font-style: italic;
}

/* Section breaks: · · · */
.story .article hr {
  border: 0;
  height: auto;
  margin: 2.6em 0;
  text-align: center;
}
.story .article hr::before {
  content: "· · ·";
  font-size: 1.5rem;
  letter-spacing: 0.6em;
  color: var(--muted);
}

/* Supporting text returns to a quieter size */
.story .article .note,
.story .article .paper-meta,
.story .article .table-scroll,
.story .article pre { font-size: 0.8rem; }
.story .article .note { font-family: var(--sans); font-size: 0.88rem; line-height: 1.5; }
.story .article .table-scroll { font-size: 0.9rem; }
.story .article .closing { font-style: italic; }
.story .article .lens { font-size: 0.95em; }
.story .article .papers h3 { font-size: 1.15rem; }
.story .article .paths { font-family: var(--sans); font-size: 0.95rem; }
.story .byline { font-family: var(--sans); }

.story .site-footer .wrap { font-family: var(--sans); }

/* Story figures: wide stills and side-by-side pairs */
.story .article figure.wide {
  width: min(100vw - 2.5rem, 60rem);
  margin: 2.2em 0 2.2em 50%;
  transform: translateX(-50%);
}
.story .article figure img { display: block; width: 100%; height: auto; }
.story .article figcaption {
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.story .article figure.pair { display: grid; gap: 0.75rem; }
@media (min-width: 40rem) {
  .story .article figure.pair { grid-template-columns: 1fr 1fr; }
}

/* Home portrait: opening frame under the nav */
.portrait { margin: 2.5rem 0 0; }
.portrait img { display: block; width: 100%; height: auto; }
.portrait figcaption {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.portrait figcaption span { color: var(--accent); margin-right: 0.6rem; }
@media (min-width: 54rem) {
  .home .portrait figcaption { margin-left: calc(var(--label) + var(--gap)); }
}

/* Support list */
.support-list { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.support-list li { margin: 0 0 0.7rem; }
.support-list span { display: block; font-size: 0.9rem; color: var(--muted); }

/* Lightning option */
.lightning { display: flex; gap: 1.25rem; align-items: flex-start; margin: 0.5rem 0 1.25rem; }
.lightning img { width: 9rem; height: 9rem; flex: none; background: #fff; padding: 0.35rem; border: 1px solid var(--hair); }
.lightning p { margin: 0; }
@media (max-width: 30rem) { .lightning { flex-direction: column; } }

/* =========================================================
   Bold section headings (3×) and ZORRO to match
   ========================================================= */
.home section > h2 {
  font-size: 2.34rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  line-height: 1.05;
  margin: 0 0 1.5rem;
}
@media (min-width: 54rem) {
  .home section > h2 { grid-column: 1 / -1; grid-row: auto; padding-top: 0; margin: 0 0 1.5rem; }
}
.site-header .alias {
  margin: 0.5rem 0 0;
  font-size: 2.34rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.05;
}

/* Translate menu */
.translate {
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--hair);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
  cursor: pointer;
}
.site-nav .translate { margin-left: auto; }
.story .crumb { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.story .crumb .translate { font-family: var(--sans); font-size: 0.8rem; }

/* Cash App steps */
.cashapp { margin: 0.5rem 0 1.25rem; }
.cashapp p { margin: 0 0 0.4rem; }
.cashapp ol { margin: 0; padding-left: 1.3rem; }
.cashapp li { margin-bottom: 0.3rem; }
