/* Sylva Systems
   One family (TeX Gyre Heros) in two widths. Off-black, warm off-white,
   one signal red used only where something is live or actionable. */

@font-face {
  font-family: "Heros";
  src: url("../fonts/texgyreheros-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Heros";
  src: url("../fonts/texgyreheros-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Heros Cn";
  src: url("../fonts/texgyreheroscn-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --ink: #f1f0ea;
  --mute: #8e9291;
  --rule: rgb(241 240 234 / 0.18);
  --signal: #cc0000;

  --sans: "Heros", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --cn: "Heros Cn", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 2.25vw, 32px);
  --gap: 8px;
  --radius: 2px;
  --expo: cubic-bezier(0.19, 1, 0.22, 1);

  color-scheme: dark;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.4 var(--sans);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
p,
figure {
  margin: 0;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

@view-transition {
  navigation: auto;
}

/* Small condensed caps: nav, page titles, field names, roles. */
.label {
  font: 700 0.8125rem/1.05 var(--cn);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.skip:focus {
  top: var(--gutter);
}

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: clamp(16px, 2vw, 24px) var(--gutter);
}

.site-header a {
  text-decoration: none;
}

.site-header__link {
  justify-self: start;
  padding: 12px 0;
  color: var(--mute);
  transition: color 0.3s ease-out;
}
.site-header__link:last-child {
  justify-self: end;
}
.site-header__link:hover,
.site-header__link[aria-current="page"] {
  color: var(--ink);
}

.logo img {
  width: auto;
  height: clamp(38px, 3.6vw, 48px);
}

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
  margin: 0 var(--gutter);
  padding: 20px 0 24px;
  border-top: 1px solid var(--rule);
  color: var(--mute);
}

/* ── Home ───────────────────────────────────────────────── */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: 48px;
  align-content: end;
  align-items: end;
  height: 100%;
  padding: 64px var(--gutter) clamp(32px, 4.5vw, 64px);
}

.hero__thesis {
  grid-column: 1 / span 8;
  font-weight: 700;
  font-size: clamp(2.75rem, 7.6vw, 9rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

/* Line breaks are set by hand: three lines, the last one carries the changing word. */
.hero__thesis .line {
  display: block;
  white-space: nowrap;
}

/* The phrase the thesis lands on: the one place type itself goes red. */
.hero__x,
.roll > .is-final,
.type__text.is-final {
  color: var(--signal);
}
.hero__x {
  white-space: nowrap;
}

.hero__aside {
  grid-column: 9 / -1;
  display: grid;
  gap: 32px;
  max-width: 340px;
  padding-bottom: 0.5em;
}

.hero__aside p:not(.status) {
  max-width: 34ch;
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--signal);
  animation: blink 1.6s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* Hero media slot. Stays collapsed until a <video> or <img> is placed
   inside .hero__media; then the hero becomes a framed, scrimmed plate. */
.hero__media {
  display: none;
}
.hero__media:has(video, img) {
  display: block;
  position: absolute;
  inset: 0 var(--gutter) var(--gutter);
  z-index: -1;
  overflow: hidden;
  border-radius: var(--radius);
}
.hero__media :is(video, img) {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(10 10 10 / 0.85), rgb(10 10 10 / 0.15) 60%);
}
.hero:has(.hero__media :is(video, img)) {
  min-height: 72svh;
  padding-inline: calc(var(--gutter) * 2);
  padding-bottom: calc(var(--gutter) * 2);
}

/* Full-width media band for later sections: <figure class="plate">. */
.plate {
  margin: var(--gap) var(--gutter) 0;
}
.plate :is(video, img) {
  width: 100%;
  border-radius: var(--radius);
}
.plate figcaption {
  padding-top: 12px;
  color: var(--mute);
}

/* Load sequence: the thesis rises line by line, then the aside fades in.
   Runs once. Everything is visible without JS. */
.js .hero__thesis .w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.js .hero__thesis .w > span {
  display: inline-block;
  transform: translateY(115%);
}
/* Rolling last line: words stack in one cell and pass through the same mask,
   up and out as the next comes up from below. */
.roll {
  display: inline-grid;
  justify-items: start;
  vertical-align: top;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
  white-space: nowrap;
}
.roll > span {
  grid-area: 1 / 1;
  transform: translateY(115%);
  transition: transform 1.1s var(--expo);
}
.roll > .is-on {
  transform: none;
}
.roll > .is-on.is-first {
  transition: transform 1.7s var(--expo);
}
.roll > .is-on.is-final {
  transition-duration: 1.5s;
}
.roll > .is-off {
  transform: translateY(-115%);
}
/* Typed last line: letters ease in rather than pop, and a thin caret marks
   where the sentence is still being worked out. */
.type__char {
  display: inline-block;
  white-space: pre;
  animation: letter 0.1s ease-out both;
}
.type__caret {
  display: inline-block;
  width: 0.055em;
  height: 0.74em;
  margin-left: 0.07em;
  background: var(--signal);
}
.type__caret.is-idle {
  animation: caret 1s ease-in-out infinite;
}
@keyframes letter {
  from {
    opacity: 0.2;
    transform: translateY(0.06em);
  }
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}
.js .hero__aside {
  opacity: 0;
}
.js.is-in .hero__thesis .w > span {
  transform: none;
  transition: transform 1.7s var(--expo) calc(var(--line, 0) * 150ms);
}
.js.is-in .hero__aside {
  opacity: 1;
  transition: opacity 1.4s var(--expo) 0.9s;
}

/* ── Inner pages ────────────────────────────────────────── */

.page {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: clamp(56px, 8vw, 112px);
  align-content: start;
  padding: clamp(48px, 9vw, 128px) var(--gutter) clamp(64px, 9vw, 128px);
}

/* The nav already names the current page, so the h1 is for assistive tech and outlines only. */
.page__title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* One centred column shared by text, portraits and form. */
.page__body,
.people {
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%;
  max-width: 920px;
}

.lead {
  font-size: clamp(1.5rem, 3.05vw, 2.75rem);
  line-height: 1.14;
  letter-spacing: -0.022em;
  text-wrap: pretty;
}

.lead a,
.text-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--mute);
  text-underline-offset: 0.14em;
  transition: text-decoration-color 0.3s ease-out;
}
.lead a:hover,
.text-link:hover {
  text-decoration-color: var(--signal);
  text-decoration-thickness: 2px;
}

/* People: two portraits butted together, contact-sheet style. */
.people {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.person__photo {
  aspect-ratio: 4 / 5;
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: var(--radius);
  background: #161616;
  filter: grayscale(1) contrast(1.06);
}

.person__meta {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 14px 0 24px;
}

.person__name {
  font-size: clamp(1.0625rem, 1.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

.person__role {
  color: var(--mute);
}

/* ── Contact form ───────────────────────────────────────── */

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px var(--gutter);
}

.field {
  display: grid;
  gap: 4px;
}
.field--wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--mute);
  transition: color 0.3s ease-out;
}
.field:focus-within label {
  color: var(--ink);
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 0 14px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  color: var(--ink);
  font: 400 clamp(1.25rem, 2vw, 1.75rem) / 1.2 var(--sans);
  letter-spacing: -0.015em;
  transition: border-color 0.3s ease-out;
}
.field textarea {
  min-height: 7.5em;
  resize: vertical;
  line-height: 1.3;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
  box-shadow: 0 1px 0 var(--ink);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px var(--bg) inset;
  caret-color: var(--ink);
}

/* Spam trap: off-screen, never focusable. */
.field--trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__foot {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}

.button {
  appearance: none;
  padding: 18px 28px 17px;
  border: 0;
  border-radius: var(--radius);
  background: var(--signal);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.3s ease-out, color 0.3s ease-out;
}
.button:hover {
  background: var(--ink);
  color: var(--bg);
}
.button[disabled] {
  background: #2a2a2a;
  color: var(--mute);
  cursor: default;
}

.form__error {
  display: none;
  max-width: 40ch;
}
.form__error.is-shown,
.form__error:target {
  display: block;
}

.sent {
  display: none;
}
.sent:focus {
  outline: none;
}
.sent.is-shown,
.sent:target {
  display: block;
}
.page__body:has(.sent.is-shown, .sent:target) .form {
  display: none;
}

/* ── Small screens ──────────────────────────────────────── */

@media (max-width: 860px) {
  .hero {
    row-gap: 40px;
    padding-top: 48px;
  }
  .hero__thesis {
    grid-column: 1 / -1;
    font-size: clamp(2.25rem, 11.6vw, 6rem);
  }
  .hero__aside {
    grid-column: 1 / -1;
    max-width: none;
    padding-bottom: 0;
  }

  .page {
    row-gap: 48px;
  }
  .page__body,
  .people {
    grid-column: 1 / -1;
  }

  .form {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status::before {
    animation: none;
  }
  .js .hero__thesis .w > span {
    transform: none;
  }
  .js .hero__aside {
    opacity: 1;
  }
  @view-transition {
    navigation: none;
  }
}
