/* ==========================================================================
   MODULES — a slot-together grid for a personal site
   --------------------------------------------------------------------------
   One stylesheet, shared by every page. Change it here, every page follows.

   The whole system in one breath:
     <main class="board">        a 5-column grid (3 on tablets, 2 on phones)
       <section class="m">       a module: one cell, 233px tall minimum
       class="m w2 / w3 / w4"    span 2, 3 or 4 columns
       class="m full"            span the full width
       class="m tall"            span 2 rows
       class="m signal"          accent fill
       class="m dark"            black fill
       class="m slot"            grey image placeholder
       class="m photo"           an <img> that fills the module
       class="m ghost"           an empty, outlined cell (decor for sparse pages)
       <article class="m prose"> plain HTML for long writing — no classes inside

   Fonts load from Google Fonts in each page's <head>. To self-host later,
   swap that <link> for @font-face rules here; the names below stay the same.
   ========================================================================== */


/* ---------- Settings: change these first ---------- */

:root {
  --accent: #FF4F00;          /* the one colour: dot, signal modules, focus ring */

  --ground: #E6E6E2;          /* page background */
  --panel: #F7F7F5;           /* module background */
  --ink: #121212;             /* text */
  --muted: #55554F;           /* labels, secondary text */
  --faint: #626259;           /* ghost-cell labels */
  --line: #CFCFC9;            /* ghost-cell outline, rules */
  --slot: #D4D4CF;            /* image placeholder */
  --dark: #121212;
  --on-dark: #F7F7F5;
  --on-dark-muted: #B5B5AE;

  --serif: 'Instrument Serif', Georgia, serif;   /* headlines */
  --text: 'Newsreader', Georgia, serif;          /* reading text */
  --mono: 'IBM Plex Mono', ui-monospace, monospace; /* labels */

  --cols: 5;                  /* grid columns on wide screens */
  --row: 233px;               /* minimum module height */
  --gap: 7px;                 /* space between modules */
  --pad: 17px;                /* space inside modules */
  --radius: 5px;
}


/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  padding: clamp(16px, 3vw, 43px);
  background: var(--ground);
  color: var(--ink);
  font-family: var(--text);
  font-size: 19px;
  line-height: 1.5;
}

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

a { color: inherit; }
a:hover { color: var(--muted); }

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


/* ---------- Top bar ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 13px;
  padding-bottom: 23px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.top a { text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 23px; }
.top nav a[aria-current="page"] { color: var(--ink); }

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
}


/* ---------- The board ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: minmax(var(--row), auto);
  grid-auto-flow: dense;      /* small modules fill gaps left by big ones */
  gap: var(--gap);
}


/* ---------- Modules ---------- */

.m {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;   /* label at top, content at bottom */
  gap: var(--pad);
  padding: var(--pad);
  background: var(--panel);
  border-radius: var(--radius);
}
.m > * { margin: 0; }

/* sizes */
.w2   { grid-column: span 2; }
.w3   { grid-column: span 3; }
.w4   { grid-column: span 4; padding: 23px; }
.full { grid-column: 1 / -1; }
.tall { grid-row: span 2; }

/* tones */
.signal { background: var(--accent); color: var(--ink); }
.signal .label { color: var(--ink); }

.dark { background: var(--dark); color: var(--on-dark); }
.dark .label { color: var(--on-dark-muted); }
.dark a:hover { color: var(--on-dark-muted); }

.slot {
  background: var(--slot);
  font-family: var(--mono);
  font-size: 12px;
  color: #3F3F3A;
}

.photo { padding: 0; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  justify-content: flex-start;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}

/* a whole module can be a link */
a.m { text-decoration: none; transition: background-color 0.15s; }
a.m:hover { color: inherit; background: #FFFFFF; }
a.m.dark:hover { color: var(--on-dark); background: #2A2A28; }


/* ---------- Type pieces (use inside modules) ---------- */

.label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.display {                     /* homepage / note headline */
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(53px, 8.6vw, 131px);
  line-height: 0.92;
  letter-spacing: -0.02em;
}

.title {                       /* article headline, a touch smaller */
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 7.3vw, 107px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.heading {                     /* titles inside link modules, cards */
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(29px, 2.9vw, 41px);
  line-height: 1.05;
}

.number {                      /* one big figure or word */
  font-family: var(--serif);
  font-size: 61px;
  line-height: 1;
}

.quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 31px;
  line-height: 1.1;
}

.list {                        /* small mono link lists */
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
}
.list a { text-decoration: none; }
.list a:hover { text-decoration: underline; }

.specs {                       /* key / value pairs */
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 23px;
  font-family: var(--mono);
  font-size: 13px;
}
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }


/* ---------- Article layout: left rail · prose · right rail ---------- */

.rail {
  align-self: start;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.rail.left  { grid-column: 1 / span 1; }
.rail.right { grid-column: 5 / span 1; }
.rail > .m { justify-content: flex-start; }
.rail > .ghost,
.rail > .dark { min-height: var(--row); }
.rail > .dark { justify-content: space-between; }


/* ---------- Prose: plain HTML, styled automatically ---------- */

.prose {
  grid-column: 2 / span 3;
  display: block;
  padding: clamp(23px, 4vw, 59px);
  font-size: 20px;
  line-height: 1.6;
}

.prose > * { max-width: 640px; margin: 0 0 23px; }
.prose > :last-child { margin-bottom: 0; }

.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 47px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 61px 0 23px;
  scroll-margin-top: 23px;
}
.prose > h2:first-child { margin-top: 0; }

.prose h3 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 41px 0 13px;
}

.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }

.prose ul,
.prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 7px; }

.prose blockquote {
  margin: 41px 0;
  padding: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 31px;
  line-height: 1.2;
}

.prose figure { max-width: none; margin: 41px 0; }   /* figures may run wider than text */
.prose figure img { width: 100%; border-radius: 3px; background: var(--slot); }
.prose figcaption {
  margin-top: 11px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--ground);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
.prose pre {
  max-width: none;
  overflow-x: auto;
  padding: var(--pad);
  background: var(--ground);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}
.prose pre code { background: none; padding: 0; }

.prose hr { border: 0; border-top: 1px solid var(--line); margin: 41px 0; }


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

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 13px;
  padding-top: 23px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.foot a { text-decoration: none; }


/* ---------- Tablet: 3 columns ---------- */

@media (max-width: 1100px) {
  :root { --cols: 3; }
  .w4 { grid-column: 1 / -1; }
  .rail.left, .rail.right, .prose { grid-column: 1 / -1; }
  .rail { flex-direction: row; flex-wrap: wrap; }
  .rail > * { flex: 1 1 220px; }
}


/* ---------- Phone: 2 columns ---------- */

@media (max-width: 720px) {
  :root { --cols: 2; --row: 173px; }
  body { font-size: 18px; }
  .w3, .w4 { grid-column: 1 / -1; }
  .ghost { display: none; }
  .prose { font-size: 18px; }
  .prose h2 { font-size: 36px; }
  .prose blockquote { font-size: 26px; }
}
