/* andrelockhart.com: one stylesheet (plan §5), in sections:
   fonts · tokens · base · layout · components · diagrams · print.
   Tokens are plan §3 (docs/theme.ts plus the Proofboard deck). No @import:
   every CSS URL must come from a page, where build.mjs can stamp it. */

/* ── Fonts ──────────────────────────────────────────────────────────
   Self-hosted Latin subsets (they include é and curly quotes). Both are
   variable fonts, so one file covers a weight range. The URLs must match the
   <link rel="preload"> lines in src/partials/head.html exactly. */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/fonts/montserrat-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/source-sans-3-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/source-sans-3-italic-latin.woff2") format("woff2");
}

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Surfaces (theme.ts) */
  --bg:           #0B0E11;
  --surface:      #12161C;
  --card:         #141A22;
  --card-alt:     #17202A;
  --header-bg:    #07131F;
  --divider:      rgba(255, 255, 255, 0.08);

  /* Text */
  --text:         #EAF3FF;
  --text-muted:   #9FB4C9;

  /* Brand */
  --blue:         #2396C8;
  --blue-light:   #4FA6D6;
  --blue-deep:    #174A6B;
  --amber:        #FFC000;
  --green:        #4ADE80;
  --red-text:     #F87171;  /* the theme red (#DC2626) fails AA as text */
  --purple:       #A07AF2;

  /* Type */
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-body:    "Source Sans 3", system-ui, sans-serif;
  --step--1:      clamp(0.83rem, 0.80rem + 0.15vw, 0.90rem);
  --step-0:       clamp(1.06rem, 1.00rem + 0.25vw, 1.19rem);
  --step-1:       clamp(1.25rem, 1.15rem + 0.45vw, 1.50rem);
  --step-2:       clamp(1.50rem, 1.30rem + 0.90vw, 2.00rem);
  --step-3:       clamp(2.00rem, 1.60rem + 1.80vw, 3.00rem);
  --step-4:       clamp(2.50rem, 1.90rem + 2.80vw, 4.25rem);

  /* Layout */
  --measure:      68ch;
  --wide:         1120px;
  --gutter:       clamp(1rem, 4vw, 2.5rem);
  --radius:       6px;
  --space-1: .5rem; --space-2: 1rem; --space-3: 1.5rem; --space-4: 2.5rem; --space-5: 4rem;
}

/* ── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
body { margin: 0; font-size: var(--step-0); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: var(--step-3); font-weight: 700; color: var(--blue); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); font-weight: 700; color: var(--blue); }
h3 { font-size: var(--step-1); font-weight: 600; color: var(--blue-light); }
p, ul, ol, figure { margin: 0; }
a { color: var(--blue-light); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--text); }
:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(160, 122, 242, 0.22);
  border-radius: 2px;
}
::selection { background: rgba(35, 150, 200, 0.35); }
.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 1;
  padding: .5rem 1rem; background: var(--card); color: var(--text); border-radius: var(--radius);
}
.skip-link:focus { top: .75rem; }

/* ── Layout ─────────────────────────────────────────────────────── */
.wrap { width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

.site-header { background: var(--header-bg); border-bottom: 1px solid var(--divider); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .5rem 2rem; padding-block: 1rem;
}
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 1.125rem;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em;
}
.wordmark:hover { color: var(--blue-light); }
.site-nav ul { display: flex; gap: .25rem 1.75rem; list-style: none; padding: 0; }
.site-nav a {
  display: inline-block; padding-block: .2rem; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-weight: 600; text-decoration: none;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current] { color: var(--text); border-bottom-color: var(--blue); }
@media (max-width: 639px) {
  .site-nav { width: 100%; }
  .site-nav ul { justify-content: space-between; }
}

.site-footer { background: var(--header-bg); border-top: 1px solid var(--divider); color: var(--text-muted); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; padding-block: var(--space-3); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; padding: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* A page: kicker, h1 and lead, then prose. Prose keeps to the reading
   measure; figures, grids and diagrams use the full width. */
.page { padding-block: var(--space-5); }
.page-head { margin-bottom: var(--space-4); }
.prose > * { max-width: var(--measure); }
.prose > :is(figure, .shots, .stats, .steps, .diagram, .features, .work-list) { max-width: none; }
.prose > * + * { margin-top: 1.1em; }
.prose > h2 { margin-top: var(--space-5); }
.prose > h3 { margin-top: var(--space-4); }
.prose > :is(h2, h3) + * { margin-top: .8em; }
.prose > :is(figure, .shots, .stats, .steps, .diagram),
.prose > :is(figure, .shots, .stats, .steps, .diagram) + * { margin-top: var(--space-4); }

/* ── Components ─────────────────────────────────────────────────── */
.kicker {
  margin-bottom: var(--space-2);
  color: var(--green); font-size: var(--step--1); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; line-height: 1.4;
}
.kicker .sep { color: var(--text-muted); opacity: .6; margin-inline: .3em; }
.lead { margin-top: var(--space-2); max-width: 46ch; color: var(--amber); font-size: var(--step-1); line-height: 1.4; text-wrap: pretty; }
.h2-label {
  display: block; margin-bottom: .35rem;
  color: var(--green); font-family: var(--font-body); font-size: var(--step--1); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
.note { color: var(--text-muted); font-size: var(--step--1); font-style: italic; }

/* Home */
.home-hero {
  padding-block: clamp(3rem, 7vw, 6rem) var(--space-4);
  background: radial-gradient(ellipse 60% 90% at 15% 0%, rgba(23, 74, 107, 0.55), transparent 70%);
}
.home-hero h1 { font-size: var(--step-4); line-height: 1.05; letter-spacing: -0.02em; }
.home-hero .lead { max-width: 34ch; text-wrap: balance; }
.home .page { padding-top: var(--space-3); }
.invite { margin-top: var(--space-5); padding: var(--space-3); max-width: var(--measure); background: var(--card); border-radius: var(--radius); }
.invite p + p { margin-top: var(--space-2); }

.button {
  display: inline-block; padding: .65rem 1.2rem; border-radius: var(--radius);
  background: var(--blue); color: var(--bg); font-weight: 600; text-decoration: none;
}
.button:hover { background: var(--blue-light); color: var(--bg); }

/* Home: Proofboard.ai first, then Gigtasia, each a section in the site's own
   type (kicker, h2, text, a screenshot, links). Proofboard's h2 is larger. */
.home-section > :not(.cards, figure, .shots) { max-width: var(--measure); }
.home-section > * + * { margin-top: var(--space-2); }
.home-section > .kicker + h2 { margin-top: 0; }
.home-section > .tagline { margin-top: var(--space-1); color: var(--text); font-size: var(--step-1); line-height: 1.4; }
.home-section > :is(figure, .shots), .home-section > :is(figure, .shots) + * { margin-top: var(--space-3); }
.home-section--lead h2 { font-size: var(--step-3); }
.home-section > .home-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-3); font-weight: 600; }
.home-section + .home-section, .home .prose { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--divider); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: var(--space-2); list-style: none; padding: 0; }
.cards li { display: grid; align-content: start; gap: .35rem; padding: 1rem 1.1rem; background: var(--card); border-radius: var(--radius); }
.cards strong { font-family: var(--font-display); font-weight: 600; color: var(--amber); }
.cards span { color: var(--text-muted); font-size: var(--step--1); line-height: 1.45; }
.page-link { margin-top: var(--space-2); font-weight: 600; }

/* Rows of links: Selected work, Work index, Next. */
.work-list { list-style: none; padding: 0; border-top: 1px solid var(--divider); }
.work-list li { border-bottom: 1px solid var(--divider); }
.work-list a {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; align-items: baseline;
  gap: .25rem 1.5rem; padding: 1rem .75rem;
  color: var(--text-muted); text-decoration: none; transition: background-color .15s;
}
.work-list a::after { content: "→"; color: var(--blue); transition: transform .15s; }
.work-list a:hover { background: rgba(160, 122, 242, 0.10); color: var(--text); }
.work-list a:hover::after { transform: translateX(3px); }
.work-list .title { font-family: var(--font-display); font-weight: 600; color: var(--blue-light); }
@media (max-width: 639px) {
  .work-list a { grid-template-columns: minmax(0, 1fr) auto; }
  .work-list .desc { grid-column: 1; }
  .work-list a::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
}

/* Work index: Proofboard and Gigtasia side by side, same weight. */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: var(--space-4) var(--space-3); }
.feature-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid rgba(160, 122, 242, 0.14); border-radius: var(--radius);
  color: var(--text); text-decoration: none; transition: border-color .15s;
}
.feature-card:hover { border-color: rgba(160, 122, 242, 0.5); color: var(--text); }
.feature-card .thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--divider); }
.feature-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.feature-card .body { display: grid; gap: .5rem; padding: var(--space-3); }
.feature-card .kicker { margin: 0; }
.feature-card h2 { font-size: var(--step-2); }
.feature-card p:last-child { color: var(--amber); }
/* Each feature is a card plus its deeper pages; a subgrid keeps both cards the
   same height so the two lists start level. */
.feature { display: grid; grid-row: span 2; grid-template-rows: subgrid; row-gap: 0; }
.feature .more { margin-top: var(--space-2); }
.feature .more .work-list a { grid-template-columns: minmax(0, 1fr) auto; padding-block: .75rem; }
.feature .more .work-list .desc { grid-column: 1; }
.feature .more .work-list a::after { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
/* Proofboard has no screens yet (plan §10): its thumbnail is typographic. */
.thumb--type { display: flex; align-items: center; justify-content: center; padding: var(--space-3); background: radial-gradient(ellipse at 30% 20%, rgba(23, 74, 107, 0.6), var(--surface) 70%); }
.thumb--type ol { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.4rem; list-style: none; padding: 0; font-family: var(--font-display); font-weight: 600; }
.thumb--type li { position: relative; padding: .45rem .8rem; background: var(--card-alt); border: 1px solid var(--blue-deep); border-radius: var(--radius); color: var(--amber); }
.thumb--type li + li::before { content: "→"; position: absolute; left: -1.1rem; color: var(--green); }

/* Screenshots */
figure img, .shots img { border: 1px solid var(--divider); border-radius: var(--radius); background: var(--surface); }
figcaption { margin-top: .6rem; max-width: 60ch; color: var(--text-muted); font-size: var(--step--1); line-height: 1.45; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--space-3); align-items: start; list-style: none; padding: 0; }
.shots--phones { grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.shots--phones img { width: 100%; max-width: 390px; }
/* Wide desktop shot beside a phone: 3:1 keeps their heights close. */
.shots--pair { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
@media (max-width: 719px) { .shots--pair { grid-template-columns: 1fr; } .shots--pair img { max-width: 390px; } .shots--pair figure:first-child img { max-width: 100%; } }
.teaser { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-3); align-items: center; padding: var(--space-3); background: var(--card); border-radius: var(--radius); }
.teaser p + p { margin-top: var(--space-2); }
@media (max-width: 719px) { .teaser { grid-template-columns: 1fr; } }

/* Key numbers, at most one row per page. */
.stats { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); list-style: none; padding: var(--space-3) 0; border-block: 1px solid var(--divider); }
.stats li { display: grid; align-content: start; gap: .3rem; max-width: 16rem; }
.stats strong { font-family: var(--font-display); font-size: var(--step-3); font-weight: 700; line-height: 1; color: var(--blue); }
.stats li:nth-child(even) strong { color: var(--green); }
.stats span { color: var(--text-muted); font-size: var(--step--1); line-height: 1.4; }

/* Chapter strip (Gigtasia) */
.chapter-nav ol { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin-bottom: var(--space-3); font-size: var(--step--1); }
.chapter-nav a { display: inline-block; padding: .3rem .8rem; border: 1px solid var(--divider); border-radius: 999px; color: var(--text-muted); text-decoration: none; }
.chapter-nav a:hover { color: var(--text); border-color: var(--blue-deep); }
.chapter-nav a[aria-current="page"] { color: var(--text); border-color: var(--blue); background: rgba(35, 150, 200, 0.12); }

/* End of every case */
.next { margin-top: var(--space-5); }
.next .kicker { margin-bottom: var(--space-1); }
.next .all { display: inline-block; margin-top: var(--space-2); font-size: var(--step--1); }

/* Contact. Without JS, the empty link shows the address drawn by CSS from its
   data attributes, so it is never one string in the HTML (plan §6.4). With JS,
   email.js fills the link in and the CSS copy goes away. */
.email-display:empty::before { content: attr(data-u) "\0040" attr(data-d) "." attr(data-t); }
.contact-address { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; }

/* ── Diagrams ───────────────────────────────────────────────────────
   Built from HTML lists, so they read as text without the styling. */
.diagram figcaption { margin-top: .9rem; }
.steps {
  --n: 4;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2rem;
  list-style: none; padding: 0; counter-reset: step;
}
.steps + .steps { margin-top: 2rem; }
.steps > li {
  position: relative; display: grid; align-content: start; gap: .35rem;
  padding: 1rem 1rem 1.1rem; background: var(--card); border-radius: var(--radius);
  counter-increment: step;
}
.steps > li::before { content: counter(step); font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; line-height: 1; color: var(--blue); }
.steps > li:nth-child(4n + 2)::before, .steps > li:nth-child(4n + 4)::before { color: var(--green); }
.steps > li:nth-child(4n + 3)::before { color: var(--amber); }
.steps > li + li::after {
  content: "→"; position: absolute; left: -1.5rem; top: 50%; width: 1rem;
  transform: translateY(-50%); text-align: center; color: var(--green); font-weight: 700;
}
.steps strong { font-family: var(--font-display); font-weight: 600; line-height: 1.25; color: var(--amber); }
.steps span { color: var(--text-muted); font-size: var(--step--1); line-height: 1.4; }
.steps .red { color: var(--red-text); }
.steps .green { color: var(--green); }
/* Unnumbered, both directions (a topology rather than a sequence). */
.steps--plain > li::before { content: none; }
.steps--both > li + li::after { content: "↔"; }
.steps--plain strong { color: var(--blue-light); }
.steps > li.small { align-self: center; background: var(--card-alt); }
@media (max-width: 719px) {
  .steps { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .steps > li + li::after { content: "↓"; left: 50%; top: -1.4rem; transform: translateX(-50%); }
  .steps--both > li + li::after { content: "↕"; }
}

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

/* ── Print ──────────────────────────────────────────────────────── */
@media print {
  :root { color-scheme: light; }
  html, .site-header, .site-footer, .home-hero, .invite, .teaser, .feature-card, .steps > li, .cards li { background: #fff !important; color: #000; }
  .site-nav, .skip-link, .chapter-nav, .next, .site-footer ul, .button { display: none; }
  h1, h2, h3, .lead, .kicker, .h2-label, .stats strong, .steps strong, .work-list .title { color: #000 !important; }
  a { color: #000; }
  .prose a[href^="/"]::after, .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 85%; }
  .steps > li, .stats { border: 1px solid #999; }
  figure, .steps > li, .shots > * { break-inside: avoid; }
  .work-list a::after { content: none; }
}
