/* ==========================================================================
   logicus.se — site stylesheet
   Order: fonts → design-system tokens (verbatim) → base → shell → content.
   Every value that has a token uses the token. Squared corners, no shadows,
   lines not boxes, one red element per eyeline.
   ========================================================================== */

/* ---- Fonts: Source Sans 3, self-hosted (SIL OFL 1.1 — assets/fonts/LICENSE).
        Replaces the design system's tokens/fonts.css Google Fonts @import. ---- */
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin-400-italic.woff2") format("woff2");
}

/* ---- Tokens: Logicus Ardens Design System — tokens/colors.css ---- */
:root {
  /* Base — neutrals */
  --colour-white: #FFFFFF;
  --colour-paper: #F7F7F6;
  --colour-rule: #E2E2E2;
  --colour-grey: #9E9E9E;
  --colour-graphite: #515151;
  --colour-ink: #1A1A1A;
  --colour-black: #000000;

  /* Base — brand accent (taken from the logo symbol) */
  --colour-red: #E60000;
  --colour-red-tint: #FF9A9A;

  /* Base — logo gradient stops. Artwork only, never UI. */
  --logo-dark-from: #9E9E9E;
  --logo-dark-to: #000000;
  --logo-red-from: #E60000;
  --logo-red-to: #FF9A9A;

  /* Semantic — text */
  --text-primary: var(--colour-ink);
  --text-secondary: var(--colour-graphite);
  --text-muted: var(--colour-grey);
  --text-inverse: var(--colour-white);

  /* Semantic — surface */
  --surface-page: var(--colour-white);
  --surface-subtle: var(--colour-paper);
  --surface-inverse: var(--colour-ink);

  /* Semantic — line */
  --border-hairline: var(--colour-rule);
  --border-strong: var(--colour-ink);

  /* Semantic — accent. One red element per eyeline, never a text background. */
  --accent: var(--colour-red);
  --accent-rule: var(--colour-red);
  --link: var(--colour-ink);
  --link-hover: var(--colour-red);
  --nav-active-underline: var(--colour-red);
  --focus-ring: var(--colour-red);
}

/* ---- Tokens: tokens/typography.css ---- */
:root {
  --font-sans: "Source Sans 3", "Source Sans Pro", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --weight-regular: 400;
  --weight-semibold: 600;

  /* Display — page-opening headline, one per page */
  --text-display-size: 52px;
  --text-display-line: 1.08;
  --text-display-weight: var(--weight-semibold);
  --text-display-tracking: -0.015em;

  /* H1 — section-opening headline on inner pages */
  --text-h1-size: 38px;
  --text-h1-line: 1.15;
  --text-h1-weight: var(--weight-semibold);
  --text-h1-tracking: -0.01em;

  /* H2 — section title */
  --text-h2-size: 26px;
  --text-h2-line: 1.2;
  --text-h2-weight: var(--weight-semibold);

  /* H3 — sub-heading, table row emphasis */
  --text-h3-size: 19px;
  --text-h3-line: 1.35;
  --text-h3-weight: var(--weight-semibold);

  /* Lead — standfirst under a headline */
  --text-lead-size: 19px;
  --text-lead-line: 1.6;

  /* Body */
  --text-body-size: 17px;
  --text-body-line: 1.65;

  /* Small — captions, table cells, legal */
  --text-small-size: 15px;
  --text-small-line: 1.6;

  /* Label — eyebrow above a heading, table head, footer heads */
  --text-label-size: 12px;
  --text-label-line: 1.4;
  --text-label-weight: var(--weight-semibold);
  --text-label-tracking: 0.12em;
  --text-label-transform: uppercase;

  /* Micro — copyright line */
  --text-micro-size: 13px;
  --text-micro-line: 1.6;
}

/* ---- Tokens: tokens/spacing.css ---- */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  --space-9: 56px;
  --space-10: 64px;
  --space-11: 88px;
  --space-12: 112px;
  --space-13: 128px;

  /* Semantic */
  --space-inline: var(--space-2);
  --space-cell: var(--space-4);
  --space-paragraph: var(--space-5);
  --space-gutter: var(--space-7);
  --space-heading-to-content: var(--space-9);
  --space-section: var(--space-11);
  --space-page-top: var(--space-12);
  --space-above-footer: var(--space-13);
}

/* ---- Tokens: tokens/layout.css ---- */
:root {
  /* The page is a single 1120px column. Nothing is centred except the
     copyright line in the footer. */
  --container-max: 1120px;
  --container-gutter: var(--space-7);
  --measure: 640px;
  --measure-narrow: 560px;

  /* Squared corners throughout — no radii anywhere in this system. */
  --radius: 0;

  /* Lines do the work that borders and shadows do elsewhere. */
  --hairline: 1px solid var(--border-hairline);
  --headline-rule: 1px solid var(--border-strong);
  --shadow: none;

  /* Section marker: a 40x2 red rule above a section title. */
  --accent-rule-width: 40px;
  --accent-rule-height: 2px;

  /* Nav */
  --nav-underline-height: 2px;
  --nav-underline-offset: 3px;

  /* Motion — restrained. Colour transitions only. */
  --transition-fast: 120ms ease-out; /* @kind other */
  --transition: 180ms ease-out; /* @kind other */
}

/* ---- Base ---- */
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--surface-page); }
body { font-family: var(--font-sans); color: var(--text-primary); }
img { border: 0; }

/* Links: never browser blue. Colour transition only; red on hover; red focus ring. */
a { color: var(--link); text-decoration: none; transition: color 150ms ease-out; }
a:hover { color: var(--link-hover); }
a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---- Shell ---- */
.page {
  background: var(--surface-page);
  font-family: var(--font-sans);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.site-header {
  border-bottom: var(--hairline);
  background: var(--surface-page);
}
.site-header__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-5) var(--container-gutter);
  box-sizing: border-box;
  display: flex;
  align-items: center;
}
.site-header__logo { height: 42px; width: auto; display: block; }

.site-main {
  flex: 1 1 auto;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
/* Home: viewport-relative vertical padding keeps header+body+footer on one 16:9 screen. */
.site-main--viewport { padding: clamp(24px, 4.5vh, 64px) var(--container-gutter) clamp(24px, 5vh, 72px); }
/* Inner pages: fixed padding, the page may scroll. */
.site-main--article { padding: var(--space-10) var(--container-gutter) var(--space-11); }

.column {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: var(--measure);
}

.site-footer {
  border-top: var(--hairline);
  background: var(--surface-subtle);
}
.site-footer__inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-8) var(--container-gutter) var(--space-7);
  box-sizing: border-box;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4) var(--space-7);
  font-size: var(--text-small-size);
  line-height: var(--text-small-line);
  color: var(--text-secondary);
}
.site-footer__item { display: flex; flex-direction: column; gap: var(--space-2); }
.site-footer__label {
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: var(--text-label-transform);
  color: var(--text-muted);
}
.site-footer__item a { color: var(--text-secondary); }
.site-footer__item a:hover { color: var(--link-hover); }
.site-footer__value--strong { color: var(--text-primary); font-weight: var(--weight-semibold); }
.site-footer__copyright {
  margin-top: var(--space-7);
  text-align: center; /* the only centred text on the site */
  font-size: var(--text-micro-size);
  color: var(--text-muted);
}

/* ---- Content ---- */
.h1 {
  margin: 0;
  font-size: var(--text-h1-size);
  line-height: var(--text-h1-line);
  font-weight: var(--text-h1-weight);
  letter-spacing: var(--text-h1-tracking);
  text-wrap: balance;
}
.h2 {
  margin: 0;
  font-size: var(--text-h2-size);
  line-height: var(--text-h2-line);
  font-weight: var(--text-h2-weight);
}
.body {
  margin: 0;
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  color: var(--text-secondary);
  text-wrap: pretty;
}
.body strong, .hairline-list strong { color: var(--text-primary); font-weight: var(--weight-semibold); }

.eyebrow {
  font-size: var(--text-label-size);
  line-height: var(--text-label-line);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: var(--text-label-transform);
  color: var(--text-muted);
}

/* Section marker: 40×2 red rule. The only red element besides link hover. */
.accent-rule {
  display: block;
  width: var(--accent-rule-width);
  height: var(--accent-rule-height);
  background: var(--accent-rule);
}

/* In-text link: ink with a hairline underline; red on hover via the global rule. */
.text-link { color: var(--text-primary); border-bottom: 1px solid var(--border-hairline); }
.text-link--strong { font-weight: var(--weight-semibold); }

.section { max-width: var(--measure); margin-top: var(--space-11); }
.section__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-6); /* DR-9: rule reads as a divider (was --space-3 marker spacing) */
  margin-bottom: var(--space-7);
}
.section__body { display: flex; flex-direction: column; gap: var(--space-5); }

.hairline-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: var(--text-body-size);
  line-height: var(--text-body-line);
  color: var(--text-secondary);
}
.hairline-list li { border-top: var(--hairline); padding-top: var(--space-4); text-wrap: pretty; }

.code {
  font-family: var(--font-mono);
  font-size: var(--text-small-size);
  background: var(--surface-subtle);
  padding: 1px 4px;
  overflow-wrap: anywhere; /* the User-Agent string is longer than a phone-width measure */
}
.pre {
  margin: 0;
  background: var(--surface-subtle);
  border: var(--hairline);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-small-size);
  line-height: var(--text-small-line);
  color: var(--text-primary);
  overflow-x: auto;
}

/* English summary: the one heavier rule on the site. */
.summary {
  max-width: var(--measure);
  margin-top: var(--space-12);
  border-top: var(--headline-rule);
  padding-top: var(--space-8);
}
.summary__inner { display: flex; flex-direction: column; gap: var(--space-6); }

/* ---- Responsive: single column throughout; tighter gutter on narrow screens ---- */
@media (max-width: 600px) {
  :root { --container-gutter: var(--space-5); }
}

/* Short desktop viewports (DR-7): the handoff's values total 794px at 1366×768, so the
   home page would scroll. Below 820px tall, close the column rhythm one step (32→24)
   and take the main padding to its clamp floor. Above that the spec applies unchanged. */
@media (min-width: 601px) and (max-height: 820px) {
  .site-main--viewport { padding-top: var(--space-5); padding-bottom: var(--space-5); }
  .site-main--viewport .column { gap: var(--space-5); }
}

/* ---- DataTable (design system components/core/DataTable.jsx, transcribed) ----
   Hairlines only: Ink rule under the head, Rule grey between rows. No zebra
   stripes, no vertical rules, no outer box. First column Ink 600, numeric
   columns right-aligned with tabular figures, row hover tints to Paper. */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 16px; /* DataTable.jsx literal — no type token at this size */
  color: var(--text-secondary);
}
.data-table th, .data-table td { text-align: left; vertical-align: top; }
.data-table thead th {
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: var(--text-label-transform);
  color: var(--text-muted);
  padding: 0 var(--space-4) var(--space-3) 0;
  border-bottom: 1px solid var(--border-strong);
}
.data-table tbody th, .data-table tbody td {
  padding: var(--space-5) var(--space-4) var(--space-5) 0;
  border-bottom: var(--hairline);
  font-weight: var(--weight-regular);
}
.data-table tbody th { color: var(--text-primary); font-weight: var(--weight-semibold); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table a { color: var(--text-secondary); }
.data-table a:hover { color: var(--link-hover); }
/* Headless variant (contact rows): the Ink rule that would close the head opens the first row. */
.data-table--headless tbody tr:first-child th,
.data-table--headless tbody tr:first-child td { border-top: 1px solid var(--border-strong); }
.data-table--headless tbody th { width: 200px; }
@media (max-width: 600px) {
  .data-table--headless tbody th { width: auto; white-space: nowrap; }
}

/* Table blocks sit at container width, below the prose column. */
.table-block { margin-top: var(--space-8); }
.table-block + .body { margin-top: var(--space-7); }
