/* ============================================================
   granadilla.design — stage 0
   Every value is chosen for a functional reason (noted inline).
   Nothing here asserts a visual point of view. A later visual
   direction should mostly mean editing this :root block.
   ============================================================ */

:root {
  /* Near-black on near-white: pure #000/#fff causes halation.
     ~15:1 contrast (AAA). */
  --paper:      #fcfcfa;
  --ink:        #1b1b19;
  --ink-muted:  #5a5a55;   /* ~7:1 on paper, AAA at body size */
  --rule:       #ddddd6;
  --accent:     #1c4fd8;   /* interactive states + focus only */
  --surface:    #f2f2ee;

  /* System stack: zero network cost, no typeface chosen. */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Fluid 1.2 scale. */
  --t--1: clamp(0.82rem, 0.80rem + 0.10vw, 0.88rem);
  --t-0:  clamp(1.0625rem, 1.03rem + 0.18vw, 1.15rem);
  --t-1:  clamp(1.28rem, 1.22rem + 0.30vw, 1.45rem);
  --t-2:  clamp(1.55rem, 1.43rem + 0.58vw, 1.95rem);
  --t-3:  clamp(1.9rem, 1.68rem + 1.05vw, 2.7rem);

  /* One spacing ramp, so gaps are never arbitrary. */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2.5rem;
  --s-5: 4rem;
  --s-6: 6rem;

  --measure: 38rem;   /* prose: lands text in the 60–75ch band */
  --column:  44rem;   /* stream + entry media: a 4:3 cover fits the first viewport */
  --wide:    64rem;   /* wide figures and page frame */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #141414;
    --ink:       #e8e8e4;
    --ink-muted: #a3a39c;
    --rule:      #333330;
    --accent:    #8fb0ff;
    --surface:   #1e1e1d;
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;   /* long addresses/URLs never force sideways scroll */
}

/* Every <img> carries width/height; this keeps the ratio while
   fluid, so nothing shifts as images load. */
img, video, canvas, svg, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s-1) var(--s-2);
  z-index: 10;
}
.skip:focus { left: var(--s-2); top: var(--s-2); }

/* ---------- frame ---------- */

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--s-3);   /* 24px gutter holds at 320px */
}

.column  { max-width: var(--column); }
.prose   { max-width: var(--measure); }

/* ---------- header ---------- */

.site-head {
  padding-block: var(--s-3);
  margin-bottom: var(--s-4);
}

.site-head > .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  font-weight: 600;
  margin: 0;
}
.wordmark a { color: inherit; text-decoration: none; display: inline-block; padding-block: 0.55rem; }
.wordmark a:hover { text-decoration: underline; }

.site-nav { display: flex; gap: var(--s-3); }

.site-nav a {
  display: inline-block;
  padding-block: 0.55rem;      /* 44px touch target */
  color: var(--ink-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* ---------- type ---------- */

h1, h2, h3 {
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 var(--s-2);
  text-wrap: balance;
}
h1 { font-size: var(--t-3); }
h2 { font-size: var(--t-2); margin-top: var(--s-5); }
h3 { font-size: var(--t-1); margin-top: var(--s-4); }

p, ul, ol, dl { margin: 0 0 var(--s-2); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }

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

.label {
  font-size: var(--t--1);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- stream (home) ---------- */

.stream {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-5);
}

.entry > a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.entry__cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--rule);
  margin-bottom: var(--s-2);
}

.entry__meta { margin: 0 0 0.3rem; }

.entry__title {
  font-size: var(--t-1);
  margin: 0;
}

.entry > a:hover .entry__title { text-decoration: underline; }
.entry > a:hover .entry__cover { border-color: var(--ink-muted); }

.entry__excerpt { color: var(--ink-muted); margin: 0.35rem 0 0; }

/* ---------- entry page ---------- */

.entry-head { margin-bottom: var(--s-4); }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  margin: 0;
}
.facts div { display: flex; gap: 0.5em; align-items: baseline; }
.facts dt { font-size: var(--t--1); color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { margin: 0; }

figure { margin: 0 0 var(--s-5); }

figure img, figure video {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--surface);
}

figcaption {
  font-size: var(--t--1);
  color: var(--ink-muted);
  margin-top: var(--s-1);
}

.figure-narrow { max-width: 22rem; }
.figure-wide   { max-width: var(--wide); }

/* Images with their own silhouette (transparent edges) get no frame,
   or the frame would hide the shape. */
.figure-bare img { border: 0; background: none; }

/* Text beside a tall image: pairs them so a portrait image doesn't
   cost a full screen of scrolling on its own. Stacks on narrow screens. */
.split { margin-bottom: var(--s-5); }
.split > .prose { margin-bottom: var(--s-4); }
.split > figure { max-width: 16rem; margin-bottom: 0; }

@media (min-width: 52rem) {
  .split {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) 16rem;
    gap: var(--s-5);
    align-items: start;
  }
  .split > .prose { margin-bottom: 0; }
}

.back {
  margin-top: var(--s-5);
  font-size: var(--t--1);
}

/* Small-text links still get a 44px touch target (WCAG 2.5.5). */
.back a,
.site-foot a {
  display: inline-block;
  padding-block: 0.75rem;
}

/* ---------- facts list (about) ---------- */

.fact-list { margin: 0; }
.fact-list div {
  padding-block: var(--s-2);
  border-top: 1px solid var(--rule);
}
.fact-list div:last-child { border-bottom: 1px solid var(--rule); }
.fact-list dt { margin-bottom: 0.2rem; }
.fact-list dd { margin: 0; }
/* Bigger hit area without changing the row's visual rhythm. */
.fact-list dd a { display: inline-block; padding-block: 0.6rem; margin-block: -0.6rem; }

@media (min-width: 34rem) {
  .fact-list div { display: grid; grid-template-columns: 9rem 1fr; gap: var(--s-3); }
  .fact-list dt { margin: 0; }
}

/* ---------- footer ---------- */

.site-foot {
  margin-top: var(--s-6);
  padding-block: var(--s-3) var(--s-5);
  font-size: var(--t--1);
  color: var(--ink-muted);
}
.site-foot a { color: inherit; }

/* ---------- motion / print ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

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