/* thomaspaulin.me — the whole design system. See DESIGN.md for rationale.
 *
 * This file is standalone: the theme's style.css is no longer loaded (its @import
 * 400'd, so Merriweather never arrived and the site rendered in Times). Everything
 * the theme used to provide is re-stated here, on purpose.
 *
 * The one rule that is easy to break: --accent is 3.23:1 on --paper. It is legal
 * only as a field or as display type >=24px. Never a link, never body text. If you
 * need orange at text size, use --accent-ink.
 */

:root {
  /* Every ratio below is measured against --paper. Change --paper and they ALL move:
     that is how --accent-ink got here (#D64300 passes on pure white but fails at
     4.41:1 on this warm ground). */
  --paper:      #FFFCFA; /* warm off-white: stops #FE5000 vibrating, still reads white */
  --rime:       #EEF3F4; /* surface: code beds, board header */
  --ink:        #10262E; /* 15.36:1 — teal-black, never #000 */
  --ink-muted:  #4E6A73; /* 5.66:1  — meta, captions */
  --link:       #006470; /* 6.72:1  — links, and only links */
  --accent:     #FE5000; /* Pantone 021 C. 3.23:1 = DISPLAY AND FIELDS ONLY. */
  --accent-ink: #CE4100; /* 4.69:1  — the only orange allowed at text size */
  --marzipan:   #F8DF9E; /* 11.98:1 with ink — tint, table heads, mark */
  --glacier:    #9FD8E0; /* 9.99:1 on ink — reserved, currently unused */

  --grot:  'Archivo', system-ui, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --mono:  'Fira Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* rail + text + breakout + 2 gaps = 1344 content, + 2*20 padding = 1384 page.
     If --page is smaller than that sum, the text column silently shrinks and the
     measure quietly stops being the measure. */
  --page:  1384px;
  --text:  680px; /* ~69 CPL at 19px Source Serif 4 — measured. Set to the face. */
  --rail:  220px;

  /* The flap grid. A board is a fixed grid of physical cells, so EVERY column that sits
     on it must be monospaced at ONE size — a proportional face or a second size can
     never land in the cells. That is the whole constraint.
     Fira Mono's advance is exactly 0.6 x font-size (measured), so 16px => 9.6px.
     --flap-h is the row pitch; the board's line-height must equal it or the hinge stops
     landing mid-character. Change one of these four, change all four. */
  --flap-mono: 16px;
  --flap-w:    9.6px;  /* 16 * 0.6 */
  --flap-h:    26px;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 19px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* The orange spine. The accent's loudest appearance, and it is 6px tall. */
body::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--accent);
}

.container {
  max-width: var(--page);
  width: auto;
  margin: 0 auto;
  padding: 0 20px;
  line-height: inherit;
}

/* ---------- typography ---------- */

p { margin: 0 0 1.15em; overflow-wrap: break-word; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--grot);
  color: var(--ink);
  /* The theme shipped line-height 1.65 here — body leading on headings, which is
     why they read flabby. Display type wants ~1.1. */
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 2.2rem 0 0.7rem;
}
h1 { font-size: 39px; font-weight: 700; font-stretch: 87.5%; line-height: 1.08; }
h2 { font-size: 33px; font-weight: 600; }
h3 { font-size: 27px; font-weight: 600; }
h4 { font-size: 21px; font-weight: 600; }
h5, h6 { font-size: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

small, .text_small { font-size: 0.833em; }

/* Lists. The browser default is a 40px indent, which compounds on nested lists and
   overflows a narrow column (the Hire Me page nests two deep). em-based indent keeps
   the marker attached to the text at any size. */
ul, ol { margin: 0 0 1.15em; padding-left: 1.3em; }
li { margin-bottom: 0.35em; }
li > ul, li > ol { margin: 0.4em 0 0.6em; padding-left: 1.1em; }
li::marker { color: var(--ink-muted); }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px;
    text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 3px; }
a:visited { text-decoration-style: dotted; }

/* The accent is the focus ring: 3.23:1 clears the 3:1 non-text bar. */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

b, strong { color: var(--ink); font-weight: 700; }
img { max-width: 100%; height: auto; }
mark { background: var(--marzipan); color: var(--ink); padding: 0 .15em; }
hr { border: 0; border-top: 2px solid var(--ink); margin: 2.5rem 0; }

blockquote {
  margin: 1.6em 0;
  padding: 0 0 0 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-muted);
  font-style: italic;
}

/* ---------- code ---------- */

code, pre, kbd, samp, tt, .chroma { font-family: var(--mono); }
:not(pre) > code {
  background: var(--rime);
  padding: 0.15em 0.4em;
  font-size: 0.85em;
  overflow-wrap: break-word;
}
pre, div.highlight {
  background: var(--rime);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 15px;
  line-height: 1.5;
}
div.highlight pre { border: 0; padding: 0; background: none; }
.highlight pre, pre.chroma { white-space: pre-wrap; word-break: break-word; }

/* ---------- imprint (site header) ---------- */
/* The author's name is a 13px colophon, not a masthead. Covers don't put the
   editor at 100px; that's portfolio grammar. */

header.imprint {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0 0;
  font-family: var(--grot);
  font-size: 13px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
header.imprint .wordmark { color: var(--ink); text-decoration: none; }
header.imprint nav { display: flex; flex-wrap: wrap; column-gap: 20px; row-gap: 6px; }
header.imprint nav a { color: var(--ink); text-decoration: none; }
header.imprint nav a:hover { color: var(--link); text-decoration: underline; }

/* ---------- poster cover (home) ---------- */

/* Cover line and plate share a row, and the plate's bottom sits on the cover line's
   last line. Giving the cover line the full width instead bought poster scale but
   orphaned the plate in ~960px of empty white with nothing to align to, and pushed
   the type to 120px/526px tall — it ate the viewport. The narrower column is the
   point: it caps the type at a size that reads as confident rather than shouting. */
.cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 32px;
  /* stretch, not end: the cover line and the plate are one group, so the plate is a
     full-height column beside the type rather than a block hanging off its baseline. */
  align-items: stretch;
  padding: 44px 0 8px;
}
/* The clamp max is set by the longest word in the tagline fitting its column, and the
   min by that word fitting a phone. Both measured, not chosen. Re-measure if the
   tagline changes. */
.coverline {
  grid-column: 1;
  margin: 0;
  font-family: var(--grot);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(28px, 5.6vw, 78px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}
.plate {
  grid-column: 2;
  background: var(--accent);
  color: var(--ink);
  padding: 26px 24px;
  /* eyebrow at the top, meta pinned to the bottom, title between: the plate now has a
     height to fill, so its contents distribute instead of bunching at the top. */
  display: flex;
  flex-direction: column;
}
.plate .eyebrow {
  font-family: var(--grot);
  font-size: 12px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.12em; text-transform: uppercase;
  margin-bottom: 14px;
}
.plate h2 {
  margin: 0;
  font-size: 31px; font-weight: 700; font-stretch: 87.5%;
  line-height: 1.06;
}
.plate a { color: var(--ink); text-decoration: none; }
.plate a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.plate .foot {
  margin-top: auto; /* pinned to the bottom of the plate, not trailing the title */
  padding-top: 20px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 10px;
}

/* ---------- prose pages (about, hire-me, tag lists, /posts/ intro) ---------- */
/* Everything that is running prose gets the measure. Without this they inherit the
   1384px page and run to ~140 CPL, which is unreadable — the theme's 800px container
   used to hide this. */
#main,
main.posts .posts-intro,
main > article {
  max-width: var(--text);
  padding-top: 40px;
}
#main h1#title,
main.posts .posts-intro h1,
main > article h1 {
  margin-top: 0;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
  font-size: clamp(31px, 4.2vw, 47px);
  line-height: 1.05;
}
/* The board is not prose: it spans the page even though /posts/ intro doesn't. */
main.posts .boardhead, main.posts table.board { max-width: none; }

/* ---------- the departure board ---------- */
/* A Solari board: dark field, marzipan headers, white flap characters. Three columns,
   because date / title / duration is the whole fork a reader needs.
   It does not animate. A real board flips only when the information changes; an
   index that flips on load is a toy, and toys are not editorial authority. */

.boardhead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  border-top: 2px solid var(--ink);
  margin-top: 8px; padding-top: 10px;
  font-family: var(--grot);
  font-size: 13px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.10em; text-transform: uppercase;
}

table.board {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 40px;
  background: var(--ink);
  /* The board is a physical object: hard shadow, zero blur. Blurred shadows are
     startup grammar; a hard offset is how a real panel photographs. */
  box-shadow: 0 4px 0 rgba(16, 38, 46, .28);
}
table.board th {
  font-family: var(--grot);
  font-size: 12px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.14em; text-transform: uppercase;
  text-align: left;
  color: var(--marzipan);              /* 11.98:1 on ink — the reference's yellow header */
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}
/* One face, one size, one line-height across every cell — that is what makes the grid a
   grid. line-height must equal --flap-h so each text line fills exactly one flap row. */
table.board td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
  vertical-align: top;
  color: #FFFFFF;                      /* 15.69:1 on ink */
  font-family: var(--mono);
  font-size: var(--flap-mono);
  line-height: var(--flap-h);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
table.board tbody tr:last-child td { border-bottom: 0; }
table.board tbody tr:hover td { background: rgba(255, 255, 255, .05); }

/* The flaps run across the WHOLE board, not just under the text: a real board is a
   physical grid of flaps and the empty ones are still there. Each cell's grid is
   anchored to its own content box (background-origin), which is also what the reference
   shows — every column is its own run of flaps with a gap between columns.
   Kept subtle on purpose: at higher contrast the tiles read louder than the dates.
   The gap is `transparent` so it shows the board itself; painting a colour there means
   two values to change when --ink moves. */
table.board tbody td {
  /* All three matter together:
     origin  — the grid starts at the content box, i.e. exactly where the text starts,
               so a mono character lands in each tile.
     clip    — paint ONLY in the content box. Left at the border-box default the browser
               sizes the tile image to the content box and then tiles THAT across the
               padding; 100px content / 9px pitch isn't whole, so the pattern restarts
               out of phase and the flaps visibly misalign.
     repeat  — no-repeat, for the same reason: one image, one phase.
     The upshot is a clean run of flaps per column with a dark gap between columns,
     which is what the reference board does anyway. */
  background-origin: content-box;
  background-clip: content-box;
  background-repeat: no-repeat;
  background-image:
    /* the hinge, mid-way down every flap row — repeating, so a title that wraps to two
       lines gets a hinge per line instead of one line through the middle of the cell */
    repeating-linear-gradient(to bottom,
      transparent 0 calc(var(--flap-h) / 2 - 1px),
      rgba(0, 0, 0, .30) calc(var(--flap-h) / 2 - 1px) calc(var(--flap-h) / 2),
      transparent calc(var(--flap-h) / 2) var(--flap-h)),
    /* the tiles, one per character */
    repeating-linear-gradient(to right,
      rgba(255, 255, 255, .055) 0 calc(var(--flap-w) - 1px),
      transparent calc(var(--flap-w) - 1px) var(--flap-w));
}
table.board tbody tr:hover td { background-color: rgba(255, 255, 255, .05); }

/* A year rule is a break in the board, not a row on it. No flaps. */
table.board tbody td.yearrule {
  background-image: none;
}

table.board td.date, table.board td.min { white-space: nowrap; }
/* Left-aligned, like the reference's TIME column. Right-aligning it would float the
   characters off the flap grid, which is anchored to the content box's left edge. */
table.board td.min, table.board th.c-min { text-align: left; width: 106px; }
table.board td.date, table.board th.c-date { width: 134px; }

/* The title sits on the same grid as everything else — same face, same size. It used to
   be Archivo 20px, which is proportional and a different size, so its letters could not
   land in the flaps no matter how the grid was tuned. A board is monospaced everywhere;
   that is why every character has a cell.
   Sentence case stays: a real board is caps only because its flaps carry one physical
   alphabet, and a 90-character title in caps is a wall. */
table.board td.title { padding-right: 24px; }
table.board td.title a { color: #FFFFFF; text-decoration: none; }
table.board td.title a:hover { color: var(--marzipan); text-decoration: underline; }

/* The newest departure gets the orange bar — the accent as a field, at the one place
   on the board where it means something. */
tr.newest td { border-bottom-color: rgba(255, 255, 255, .18); }
tr.newest td.date { position: relative; }
tr.newest td.date::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--accent);
}

.yearrule {
  font-family: var(--grot);
  font-size: 11px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.5em; text-align: center;
  color: var(--marzipan);
  background: rgba(255, 255, 255, .04);
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}

/* ---------- article ---------- */

/* The text column is FIXED, not minmax: with two flexible tracks the browser shrinks
   them together and the measure collapsed to 496px (~50 CPL) between 1100 and 1384.
   Fixed text + flexible breakout means the channel absorbs every loss and the measure
   is always the measure. Below 1025 the whole grid collapses (see responsive). */
.article {
  display: grid;
  grid-template-columns: var(--rail) var(--text) minmax(0, 380px);
  gap: 32px;
  padding-top: 40px;
}
.article > * { grid-column: 2; }
/* #content is a subgrid so that tables and figures nested inside Hugo's .Content
   blob can still break out of the measure into the right channel. Without this they
   inherit #content's 680px and the breakout silently never happens — the grid-column
   rule below only reaches DIRECT children of .article, and .Content wraps everything.
   Subgrid makes the channel adaptive: no hard-coded 412px that overflows at 1100px. */
.article #content {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: subgrid;
}
.article #content > * { grid-column: 1; }
.article #content > .table-wrap,
.article #content > figure { grid-column: 1 / -1; }
.article .rail {
  grid-column: 1; grid-row: 1 / span 3;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink-muted); line-height: 1.9;
  align-self: start; position: sticky; top: 24px;
}
.article .rail .tags { display: block; margin-top: 10px; }
.article .rail .tags a { color: var(--link); display: block; }
/* Same voice as the index cover line: Archivo 800 at wdth 125, same tracking. It was
   700/87.5 (condensed) — a different face at a glance, which made the article page read
   as a different site. Sentence case is kept: the cover line is one fixed 7-word tagline,
   article titles run to 90 characters and uppercase at this width is unreadable. */
h1#title {
  grid-column: 2;
  margin: 0 0 16px;
  font-family: var(--grot); font-weight: 800; font-stretch: 125%;
  font-size: clamp(28px, 3.2vw, 46px); line-height: 0.98; letter-spacing: -0.03em;
  border-bottom: 2px solid var(--ink); padding-bottom: 18px;
}
.article #content > p:first-of-type {
  font-size: 23px; line-height: 1.45; color: var(--ink-muted);
}
/* Figures and wide tables break out of the measure into the right channel. */
.article .table-wrap, .article figure {
  grid-column: 2 / -1;
  width: auto;
}

/* Related posts. Styling lived inline in posts/single.html before the redesign;
   it belongs with the rest of the system. */
.related {
  grid-column: 2;
  margin-top: 3.5em;
  padding-top: 1.4em;
  border-top: 2px solid var(--ink);
}
.related h2 {
  margin: 0 0 0.9em;
  font-size: 13px; font-weight: 600; font-stretch: 112%;
  letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--ink-muted);
}
.related ul { margin: 0; padding: 0; list-style: none; }
.related li {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid rgba(16, 38, 46, .14);
}
.related li a {
  font-family: var(--grot); font-weight: 600; font-stretch: 87.5%;
  font-size: 17px; color: var(--ink); text-decoration: none;
}
.related li a:hover { color: var(--link); text-decoration: underline; }

/* ---------- tables ---------- */
/* The table is an infrastructure magazine's native object. Marzipan header wash,
   2px rule under the head, hairlines between rows. */

.table-wrap { overflow-x: auto; margin: 1.75rem 0; -webkit-overflow-scrolling: touch; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 16px; line-height: 1.45; }
.table-wrap th, .table-wrap td { text-align: left; padding: 0.55rem 0.9rem 0.55rem 0; vertical-align: top; }
.table-wrap thead { background: var(--marzipan); }
.table-wrap th {
  font-family: var(--grot);
  font-size: 12px; font-weight: 600; font-stretch: 87.5%;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink);
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.9rem 0.5rem 0.6rem;
  white-space: nowrap;
}
.table-wrap thead th:first-child { padding-left: 0.6rem; }
.table-wrap td { border-bottom: 1px solid rgba(16, 38, 46, .14); font-variant-numeric: tabular-nums; }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: var(--rime); }
/* The first column names the row, so let it read as the row's label. */
.table-wrap td:first-child { font-weight: 700; padding-right: 1.25rem; padding-left: 0.6rem; }
/* Auto layout balances every column, so short labels ("45+ seconds") wrap while a
   prose column hogs the width. Column position can't tell us which is which, so the
   render hook marks cells by content length; only genuinely short ones refuse to wrap. */
.table-wrap .nowrap { white-space: nowrap; }

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

footer, .footer {
  border-top: 2px solid var(--ink);
  margin-top: 3.5em;
  padding-top: 1.25em;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
}

/* ---------- responsive ---------- */

/* 220 rail + 680 text + 64 gaps = 964. Below ~1025 inner width there is no room for
   a rail AND the measure, so the rail becomes a strip and the column centres. Doing
   this in one step (rather than degrading the measure first) keeps CPL in range at
   every width. */
@media screen and (max-width: 1024px) {
  .article {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    max-width: var(--text);
    margin: 0 auto;
  }
  .article > *, h1#title, .related { grid-column: 1; }
  /* subgrid off: with one column there is no channel to break out into, and wide
     tables fall back to the scroll container they already had. */
  .article #content { grid-column: 1; display: block; }
  .article .rail {
    grid-column: 1; grid-row: auto; position: static;
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 16px;
  }
}

@media screen and (max-width: 900px) {
  /* .plate must release grid-column:2 or it conjures a second track and the page
     scrolls sideways. */
  .cover { grid-template-columns: minmax(0, 1fr); }
  .coverline, .plate { grid-column: 1; }
  table.board td.title { font-size: 17px; }
}

@media screen and (max-width: 620px) {
  body { font-size: 18px; }
  /* imprint + nav can't share a row at phone width; nav sizes to max-content as a
     flex item and refuses to wrap, which overflows at 320px. */
  header.imprint { flex-direction: column; align-items: stretch; gap: 12px; }
  /* Narrow the letterforms rather than only shrinking the type: at wdth 100 the same
     word fits ~20% more type, so the cover still reads as a poster on a phone. */
  .coverline { font-stretch: 100%; font-size: clamp(24px, 8.6vw, 120px); }
  .plate h2 { font-size: 26px; }

  /* The board is 3 columns of tabular data; below this it stops being a board and
     becomes 2 rows per dispatch. Same information, no truncation, no side-scroll. */
  table.board thead { display: none; }
  table.board, table.board tbody, table.board tr { display: block; }
  table.board tr {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
  }
  table.board tr.yearrow { padding: 0; border: 0; }
  table.board td { display: inline; border: 0; padding: 0; }
  table.board td.title { display: block; margin-top: 8px; font-size: 17px; padding-right: 0; }
  table.board td.min { float: right; }
  table.board td.min::after { content: " MIN"; }
  tr.newest td.date::before { left: -14px; }
  .yearrule { padding: 8px 0; }

  /* Tables: no box-sizing is set site-wide by the theme, and width:100% + padding
     would overflow. Block boxes fill on their own with padding inside. */
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    border: 1px solid rgba(16, 38, 46, .18);
    padding: 0.75rem 0.9rem; margin-bottom: 0.85rem; background: var(--paper);
  }
  .table-wrap td {
    border-bottom: none; padding: 0.2rem 0;
    text-align: left !important; /* column alignment is meaningless once stacked */
  }
  .table-wrap td:empty { display: none; } /* an empty cell carries nothing without its column */
  .table-wrap td:first-child {
    font-size: 1.05rem; padding: 0 0 0.4rem; margin-bottom: 0.4rem;
    border-bottom: 1px solid rgba(16, 38, 46, .14);
  }
  .table-wrap td:not(:first-child)::before {
    content: attr(data-label);
    display: inline-block; min-width: 5.5rem;
    font-family: var(--grot);
    font-weight: 600; font-size: 0.72rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--ink-muted);
  }
  .table-wrap td[data-label="Notes"]::before { display: block; margin-top: 0.25rem; }
}

/* Two motions exist site-wide, both ~120ms, both gated. */
@media (prefers-reduced-motion: no-preference) {
  a { transition: text-decoration-thickness 120ms ease-out; }
  table.board tbody tr { transition: background 120ms ease-out; }
}
