/* =========================================================================
   henryscottgreen.com
   Text-first, single page, no motion.

   Palette contrast against --bg (#f0ebe1), measured:
     --ink        13.00:1  body text, headings              AAA
     --ink-soft    6.84:1  section labels, role, year, meta AA
     --link        5.18:1  hover and focus only             AA
     --accent      2.69:1  arrows and selection — never text
     --accent-warm 1.45:1  rules and fills only  — never text
   ========================================================================= */

/* ---- Fonts: self-hosted, latin + latin-ext only -------------------------
   League Spartan is a variable font, so one file per subset covers the whole
   weight range this page uses — two files, 42K, for the entire site.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'League Spartan';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/leaguespartan-var-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'League Spartan';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/leaguespartan-var-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens ------------------------------------------------------------- */

:root {
  --bg: #f0ebe1;
  --ink: #22223b;
  --ink-soft: #4a4e69;
  /* Spot colour. Cool mauve against a warm page, so the small marks that
     carry it read as deliberate rather than as a tint of the background. */
  --accent: #9a8c98;
  --accent-warm: #cfc4b0;

  /* Sampled from the shirt in the portrait (hue 217°, the largest colour in
     the image) and darkened to clear AA at body size. Reserved for interactive
     states only, so blue on this page always means "this does something". */
  --link: #1c5dc4;

  /* One family throughout. The two tokens are kept distinct so the title and
     body can be re-paired later without hunting through rules. */
  --font-title: 'League Spartan', Futura, 'Century Gothic', sans-serif;
  --font-body: 'League Spartan', Futura, 'Century Gothic', sans-serif;

  --measure: 34rem;

  --row-gap: 1rem;
}

/* ---- Reset -------------------------------------------------------------- */

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

html {
  /* This design commits to one palette; declaring it stops the browser
     from painting a dark canvas behind the page. */
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  /* League Spartan has a small x-height for its point size and tight
     apertures, so body copy needs both more size and more leading than a
     text face would to stay comfortable at this measure. */
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  /* The width/height attributes on <img> apply as presentational hints and
     would otherwise beat aspect-ratio, locking the rendered height to the
     attribute value. */
  height: auto;
  display: block;
}

a {
  color: inherit;
}

/* Off-screen host for the arrow symbol. Deliberately not display:none, which
   stops <use> resolving in some engines. */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---- Layout ------------------------------------------------------------- */

.page {
  max-width: var(--measure);
  margin-inline: auto;
  --pad-x: 1.5rem;

  /* Scales on width, not height: phones are tall, so a vh value spends the
     scarce dimension. The calc is a line through (430px, 24px) and
     (1280px, 112px), so every handset up to 430px falls under the floor and
     pins to --pad-x — the gap above the photo equals the gap beside it — then
     it grows to the ceiling with no breakpoint jump. */
  padding-top: clamp(var(--pad-x), calc(10.4vw - 21px), 7rem);
  padding-inline: var(--pad-x);
  padding-bottom: clamp(2.5rem, 8vw, 5rem);
}

/* ---- Portrait ----------------------------------------------------------- */

.portrait {
  /* Full measure — the portrait shares the text column's exact width, so the
     left and right edges line up with every line of type below it. */
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  /* Fills the frame before the image arrives, so the layout never shifts. */
  background: color-mix(in srgb, var(--accent-warm) 30%, var(--bg));
}

/* ---- Masthead ----------------------------------------------------------- */

.name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 2.25rem 0 0;
}

/* ---- Bio ---------------------------------------------------------------- */

.bio p {
  margin: 0 0 1.35rem;
  /* Discourages a lone word on the last line. Ignored by browsers that don't
     support it, so it costs nothing where it isn't understood. */
  text-wrap: pretty;
  /* Keep the many numerals in this bio ($750M, 4 patents, $3.5M) on a
     steady baseline rather than letting old-style figures hop. */
  font-variant-numeric: lining-nums;
}

.bio p:last-child {
  margin-bottom: 0;
}

/* ---- Sections ----------------------------------------------------------- */

.section {
  margin-top: 3.5rem;
}

.section__label {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
}

/* Stacked, this label sits directly under the name and reads as part of the
   masthead. Matching the label's own bottom margin puts equal space on both
   sides of it — 29px ink-to-ink either way. */
.section--about {
  margin-top: 1.5rem;
}

/* ---- Lists (contact + projects) ----------------------------------------- */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem var(--row-gap);
  /* Load-bearing: with no dividing rules, this padding is the only thing
     grouping the rows, and it keeps each row past the 44px touch minimum. */
  padding: 0.65rem 0;
  text-decoration: none;
  color: var(--ink);
}

.row__name {
  flex: 1 1 auto;
  min-width: 0;
  /* The one project title long enough to wrap breaks into a full line plus a
     single word; balancing evens the two lines. */
  text-wrap: balance;
}

/* Meta and arrow travel as one unit. Kept together, a long project name that
   wraps pushes both down as a pair instead of orphaning the arrow onto the
   second line on its own. */
.row__end {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Role, year, and the plain contact handle share one small-text treatment. */
.row__meta,
.row__role,
.row__year {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* The year gets a fixed cell so the four-digit years stack into a true
   column. `font-variant-numeric: tabular-nums` cannot do this job here —
   League Spartan ships no tnum feature, so its figures stay proportional and
   "2018" renders 3.5px narrower than "2020". A fixed width is font-agnostic. */
.row__year {
  flex: 0 0 auto;
  width: 2.5rem;
  text-align: right;
}

.row__role {
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__arrow {
  flex: 0 0 auto;
  width: 0.6875rem;
  height: 0.6875rem;
  color: var(--accent);
}

/* Hover and focus shift colour only — instantaneous, no transition, in
   keeping with the no-motion brief. The whole row moves to the interactive
   blue, including the muted meta, so the change reads at a glance rather than
   as a faint underline. */
.row:is(:hover, :focus-visible),
.row:is(:hover, :focus-visible) :is(.row__meta, .row__role, .row__year, .row__arrow) {
  color: var(--link);
}

.row:is(:hover, :focus-visible) .row__name {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--link);
}

/* Narrow screens: let the meta drop beneath a long project name rather
   than crushing the name into a three-line column. */
@media (max-width: 26rem) {
  .row {
    flex-wrap: wrap;
    gap: 0.15rem var(--row-gap);
  }

  .row__name {
    flex: 1 1 100%;
  }

  /* Three children now, so space-between would strand the year in a ragged
     middle position. Letting the role take up the slack pins the year and
     arrow right, keeping the year column aligned on narrow screens too. */
  .row__end {
    flex: 1 1 100%;
  }

  /* Contact rows carry a plain meta instead of a role cell, so it takes the
     slack for them — otherwise their arrows bunch up on the left. */
  .row__role,
  .row__meta {
    flex: 1 1 auto;
  }
}

/* ---- Colophon ----------------------------------------------------------- */

.colophon {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--accent-warm) 55%, transparent);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.colophon p {
  margin: 0;
}

/* ---- Wide layout: hanging section labels --------------------------------
   Above this width there is room for a gutter, so the section labels move out
   beside their content instead of stacking above it. The reading column keeps
   its measure; only the labels move. Below this width everything stacks.
   -------------------------------------------------------------------------- */

@media (min-width: 56rem) {
  :root {
    --gutter: 9.5rem;
  }

  .page {
    max-width: 44rem;
  }

  /* Elements outside a .section have no grid cell to sit in, so they take the
     gutter offset directly. .bio is absent by design: it sits in the About
     section's grid and would otherwise be offset twice. */
  .portrait,
  .name,
  .colophon {
    margin-left: var(--gutter);
  }

  /* .name and .colophon are auto-width, so the margin above shrinks them to the
     reading column on its own. The portrait is width:100%, which resolves
     against the containing block and ignores the margin, so it needs the
     gutter subtracted explicitly or it overhangs the text by exactly --gutter. */
  .portrait {
    width: calc(100% - var(--gutter));
  }

  .section {
    display: grid;
    grid-template-columns: calc(var(--gutter) - 2rem) minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }

  /* These two paddings align the *cap-height* of the label with the cap-height
     of the first line beside it — not the line boxes, which would leave the
     label sitting high, since the label is line-height 1 against body text at
     1.85. Measured for League Spartan 600 at 12px against the 18px body, which
     is why they are not round numbers. Re-derive whenever the face, the body
     size, the label size, or .row's padding changes — each of those has moved
     this by 1-2px in practice. */
  .section__label {
    padding-top: 1.12rem;
    margin: 0;
    text-align: right;
  }

  /* A bare paragraph carries no row padding, so its first line starts higher. */
  .section--about .section__label {
    padding-top: 0.47rem;
  }

  /* The label moves to the gutter here, so nothing sits between the name and
     the body — restore the full section rhythm. */
  .section--about {
    margin-top: 3.5rem;
  }
}

/* ---- Selection ---------------------------------------------------------- */

::selection {
  background: var(--accent-warm);
  color: var(--ink);
}

/* ---- Focus -------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--ink-soft);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- Print -------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .row__arrow {
    display: none;
  }

  /* A printed page can't be clicked — surface the destinations. */
  .row[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.6875rem;
    color: #555;
    word-break: break-all;
  }
}
