/* ==========================================================================
   tomassetti.me — Layer 2: typography, layout, primitives (book §10, §11)

   Everything is scoped under .tm26. This is not stylistic preference: on this
   install Elementor's global kit stiles bare elements with selectors of the
   form `.elementor-kit-N h1`, which beat a single class. Scoping every rule as
   `.tm26 .tm26-thing` keeps us ahead of it. Same trap already paid for on
   strumenta.com — see redesign/wp/README.md.
   ========================================================================== */

/* --- reset, only what we need ------------------------------------------- */
.tm26 *, .tm26 *::before, .tm26 *::after { box-sizing: border-box; }

.tm26 {
  background: var(--page);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17.5px;
  line-height: 1.76;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Body text never below 17.5px desktop / 16px mobile — §22 accessibility.
   No text below 11px anywhere — §10. */
@media (max-width: 899px) { .tm26 { font-size: 16px; } }

/* --- shell -------------------------------------------------------------- */
.tm26 .tm26-shell {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
@media (max-width: 899px) { .tm26 .tm26-shell { padding-inline: 20px; } }

/* The reading column. Never wider, whatever the viewport — §11. */
.tm26 .tm26-measure { max-width: var(--measure); }

/* --- headings ----------------------------------------------------------- */
/* Sentence case everywhere except Plex Mono labels. Italic is Spectral's job;
   Plex Sans never italicises. Headlines balance, body pretty — §10. */
.tm26 .tm26-h,
.tm26 .tm26-title,
.tm26 .tm26-section-title,
.tm26 .tm26-list-title,
.tm26 .tm26-statement {
  font-family: var(--serif);
  font-weight: 400;
  font-style: normal;
  color: var(--ink);
  text-wrap: balance;
  margin: 0;
}

.tm26 .tm26-title         { font-size: 40px;   line-height: 1.14; letter-spacing: -0.014em; }
.tm26 .tm26-statement     { font-size: 29px;   line-height: 1.30; }
.tm26 .tm26-section-title { font-size: 30px;   line-height: 1.14; }
.tm26 .tm26-list-title    { font-size: 24px;   line-height: 1.30; }

/* Article title: mobile 30px, max 9 words (editorial rule, not enforceable
   in CSS — it lives in the editor guidance). */
@media (max-width: 899px) { .tm26 .tm26-title { font-size: 30px; } }

/* --- dek, body, meta ---------------------------------------------------- */
.tm26 .tm26-dek {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 19px;
  line-height: 1.60;
  color: var(--quiet);
  text-wrap: pretty;
  margin: 0;
}

/*
 * Vertical rhythm in the body.
 *
 * This was broken and it is worth recording why: the rule below used to be
 *   .tm26 .tm26-body > * + * { margin-top: var(--s6); }
 *   .tm26 .tm26-body p       { margin: 0; }
 * and the second one wins — two classes plus an element (0,2,1) beats two
 * classes plus universal selectors (0,2,0) — so every paragraph rendered with
 * margin-top: 0 and the text ran together in one block. Third time the same
 * specificity trap has bitten on this build.
 */
.tm26 .tm26-body > * { margin-block: 0; }
.tm26 .tm26-body > * + * { margin-top: var(--s7); }

/* Tighter after a heading: the heading already carries the separation. */
.tm26 .tm26-body > :is(h2, h3, h4) + * { margin-top: var(--s5); }

/*
 * Justified, on Federico's preference (2026-08-21).
 *
 * hyphens:auto is not optional here: justifying a 720px measure full of long
 * technical words (implementation, transformation, ANTLR grammar names) without
 * hyphenation opens rivers of white space between words. `text-wrap: pretty`
 * is dropped on justified text — it optimises ragged-right endings, which do
 * not exist here.
 */
.tm26 .tm26-body > p,
.tm26 .tm26-body > ul,
.tm26 .tm26-body > ol {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
/* Never justify short lines: a two-word paragraph stretched to full width is
   the ugliest thing justification does. */
.tm26 .tm26-body > p:has(> img),
.tm26 .tm26-body > p:empty { text-align: left; }

.tm26 .tm26-meta {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.68;
  color: var(--quiet);
}

/* Label: place · date · territory — §10. The only uppercase in the system. */
.tm26 .tm26-label {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  line-height: 1.70;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- links -------------------------------------------------------------- */
.tm26 a { color: var(--sage); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.tm26 a:hover { text-decoration-thickness: 2px; }

/* Amber is never used for body links — §09. */

/* Visible focus rings in sage — §22 accessibility. */
.tm26 :focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

/* --- rules and edges ---------------------------------------------------- */
/* 1px hairlines to separate; 3px amber or sage bar to mark. No shadows, no
   rounded corners above 2px, no gradients — §11. */
.tm26 .tm26-rule { border: 0; border-top: 1px solid var(--hairline); margin: 0; }
.tm26 .tm26-mark-amber { border-left: 3px solid var(--amber); padding-left: var(--s5); }
.tm26 .tm26-mark-sage  { border-left: 3px solid var(--sage);  padding-left: var(--s5); }

/* --- surfaces ----------------------------------------------------------- */
/* Never two nested stone panels; use a 1px hairline rule instead — §09. */
.tm26 .tm26-stone { background: var(--stone); }
.tm26 .tm26-stone .tm26-stone { background: none; border-top: 1px solid var(--hairline); }

/* --- pull quote — §10, max one per article ------------------------------ */
.tm26 .tm26-pullquote {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--stone);
  border-left: 3px solid var(--amber);
  padding: var(--s6);
  margin: var(--s8) 0;
}

/* --- article shell and grid — §11 ---------------------------------------- */
/*
 * The article column is sized to its content and centred, rather than being a
 * 1120px shell with a `1fr 200px` grid inside it.
 *
 * The literal reading of §11 produced a visible defect: in a 1120px shell the
 * `1fr` column measures 780px while the body is capped at 620px, leaving ~160px
 * of dead space between the text and the rail. The text then reads as a narrow
 * strip stranded in the page — which is what it looked like. Sizing the shell
 * as measure + gap + rail keeps the 620px measure the book requires and makes
 * the whole block deliberate.
 */
.tm26 .tm26-article-shell {
  max-width: calc(var(--measure) + 36px + var(--rail));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
@media (max-width: 1179px) {
  .tm26 .tm26-article-shell { max-width: calc(var(--measure) + var(--gutter) * 2); }
}
@media (max-width: 899px) {
  .tm26 .tm26-article-shell { padding-inline: 20px; }
}

/* Body plus a margin rail for contents, colophon, notes, one place photo.
 *
 * The first track is minmax rather than a bare length. A grid item's automatic
 * minimum size is its min-content, and a code block with long lines has a huge
 * min-content, so the column refuses to shrink and the whole page scrolls
 * sideways. Measured at a 390px viewport: 451px of horizontal overflow.
 *
 * NOTE ON COMMENTS: never put a comment containing brackets inside a
 * declaration block. Autoptimize's minifier mangled exactly that and emitted
 * an @media rule nested inside this one, which silently broke every responsive
 * rule after it. Explanations go above the selector.
 */
.tm26 .tm26-article-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) var(--rail);
  gap: 36px;
  align-items: start;
}

/* ≥1180 full · 900–1179 rail below body · <900 single column, thumbnails
   hidden, colophon after the text — §11. */
@media (max-width: 1179px) {
  .tm26 .tm26-article-grid { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .tm26 .tm26-thumb { display: none; }
}

/* --- list rows — §11, §14 ----------------------------------------------- */
/* Article lists are rows, not cards. Cards only for territories and places. */
.tm26 .tm26-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) 120px;
  gap: var(--s6);
  align-items: start;
  border-top: 1px solid var(--hairline);
  padding: var(--s6) 0;
}
.tm26 .tm26-row:last-child { border-bottom: 1px solid var(--hairline); }

/* Whole row is the link; hover shifts the title to sage — §14. */
.tm26 .tm26-row a { text-decoration: none; color: inherit; display: contents; }
.tm26 .tm26-row:hover .tm26-list-title { color: var(--sage); }

@media (max-width: 899px) {
  .tm26 .tm26-row { grid-template-columns: 1fr; gap: var(--s3); }
}

/* --- duotone — §12 ------------------------------------------------------ */
/* Applied to every thumbnail and rail image. Duotone in CSS, never baked into
   the file — §22. Openers and all portraits stay untreated. */
.tm26 .tm26-duotone {
  background: var(--sage-deep);
  display: block;
  overflow: hidden;
}
.tm26 .tm26-duotone img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: luminosity;
  filter: contrast(1.06);
}

/* Ratios — §12 */
.tm26 .tm26-ratio-opener { aspect-ratio: 32 / 9; }
.tm26 .tm26-ratio-rail   { aspect-ratio: 4 / 3; }
.tm26 .tm26-ratio-thumb  { aspect-ratio: 3 / 2; }
.tm26 .tm26-ratio-about  { aspect-ratio: 5 / 6; }

.tm26 .tm26-caption {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.7;
  color: var(--muted);
  margin-top: var(--s2);
}

/* --- buttons ------------------------------------------------------------ */
/* Sage is the only colour allowed to carry a filled button — §09. */
.tm26 .tm26-button {
  display: inline-block;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1;
  padding: var(--s4) var(--s6);
  background: var(--sage);
  color: #FFFFFF;          /* white on sage: 6.1:1 */
  border: 0;
  border-radius: 2px;      /* no rounded corners above 2px — §11 */
  text-decoration: none;
  cursor: pointer;
}
.tm26 .tm26-button:hover { background: var(--sage-deep); }

/* --- tables — §13 ------------------------------------------------------- */
.tm26 .tm26-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 12.5px;
}
.tm26 .tm26-table th,
.tm26 .tm26-table td {
  text-align: left;
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--hairline);   /* hairline rows, no vertical rules */
}
.tm26 .tm26-table thead th { color: var(--muted); font-weight: 500; }

/* ==========================================================================
   DATES — deliberate deviation from the book, decided by Federico 2026-08-21.

   The book makes dating load-bearing (§07 archive policy, §14 colophon, §19).
   Federico's call is that visible dates make the archive read as old, so they
   are hidden from the reader. Kept deliberately as ONE toggle so it is a CSS
   revert, not an architecture change:

     - datePublished / dateModified stay in schema.org (§22 still satisfied,
       and Google reads the date from there regardless of this rule)
     - the <time> elements stay in the markup, so the data remains queryable
       for the Places page in phase two
     - only the reader-facing rendering is suppressed

   To put dates back: delete this block.
   ========================================================================== */
.tm26 .tm26-date { display: none; }
