/* The pages around the flight: /work/ and its project pages, the case
 * studies (/projects/<slug>/), /resume/, /film/ and /404.html. They read as
 * the home page's world (src/flight/flight.css): a graphite drafting void,
 * vellum ink, hairline rules that carry measuring ticks like the chapter
 * map, Oswald capitals for titles, DM Mono for labels, Montserrat for
 * reading. These pages do not load the flight, so the tokens repeat its
 * :root; each page's own stylesheet arranges its parts with them.
 *
 * Type floor: labels in DM Mono at 0.72rem or larger, reading text in
 * Montserrat at 1rem or larger. No link is underlined (owner, 2026-10-12):
 * each is a named control, a label in a bar, or marked by an arrow.
 *
 * Image rule (CLAUDE.md): nothing here sizes an image both ways. */

@font-face {
  font-family: "Oswald";
  src: url("/fonts/oswald-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("/fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Mono";
  src: url("/fonts/dm-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --graphite-0: #0c0e12;
  --graphite-1: #1b1f27;
  /* A sheet hung in the void: graphite-1, the grid faintly through it. */
  --sheet: rgba(27, 31, 39, 0.82);
  --vellum: #ece6da;
  /* Secondary text: 0.84 of the ink, as on the home page. */
  --vellum-soft: rgba(236, 230, 218, 0.84);
  /* Captions and notes: 0.68 of the ink, 7.5:1 on graphite. */
  --vellum-mute: rgba(236, 230, 218, 0.68);
  /* A control's edge: visible at a glance, quieter than the words in it. */
  --vellum-line: rgba(236, 230, 218, 0.34);
  --vellum-faint: rgba(236, 230, 218, 0.16);
  --paint-red: #c80808;
  /* Light grey, once sand (owner, 2026-10-23: "switch sand to a light grey"). */
  --paint-grey: #c6c9ce;
  --paint-blue: #083898;
  --display: "Oswald", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --sans: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --pad: clamp(1rem, 4vw, 4.5rem);
  --measure: 68ch;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* The measuring rule: a hairline, a short tick every 8px and a long one
     every 64px, standing on the element's foot (the chapter map's ticks). */
  --ruler:
    linear-gradient(var(--vellum-faint), var(--vellum-faint)) left bottom / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--vellum-faint) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--vellum-line) 0 1px, transparent 1px 64px) left bottom / 100% 11px no-repeat;
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-width: 320px;
  margin: 0;
  /* The void below shows through: the page's ground is the html's. */
  background: transparent;
  color: var(--vellum);
  font: 400 1rem/1.6 var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The drafting void: a hairline grid under a light from above, fixed behind
   the page as the home page's void stands behind its stations. */
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 55% at 50% -12%, rgba(236, 230, 218, 0.075), transparent 72%),
    linear-gradient(rgba(236, 230, 218, 0.045) 1px, transparent 1px) 50% 0 / 64px 64px,
    linear-gradient(90deg, rgba(236, 230, 218, 0.045) 1px, transparent 1px) 50% 0 / 64px 64px;
  content: "";
  pointer-events: none;
  -webkit-mask-image: linear-gradient(#000, rgba(0, 0, 0, 0.4) 65%, rgba(0, 0, 0, 0.15));
  mask-image: linear-gradient(#000, rgba(0, 0, 0, 0.4) 65%, rgba(0, 0, 0, 0.15));
}

::selection {
  background: var(--paint-grey);
  color: var(--graphite-0);
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--vellum);
  outline-offset: 3px;
}

main:focus {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip links: a vellum label at the top left, shown on focus. */
.project-skip,
.cs-skip,
.skip {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.6rem 1rem;
  background: var(--vellum);
  color: var(--graphite-0) !important;
  font: 400 0.75rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: translateY(-200%);
}

.project-skip:focus,
.cs-skip:focus,
.skip:focus {
  transform: none;
}

/* --- The bar over the page and the foot under it ----------------------------
   The project pages (.project-header) and the case studies (.cs-top) share
   it: the name in Oswald capitals, the way on in DM Mono labels, a measuring
   rule along its foot. On a wide screen it stays over the page, solid
   graphite so nothing reads through it, as the home page's header stays
   over the void. */

.project-header,
.cs-top {
  position: relative;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding: 0.65rem max(var(--pad), calc((100% - 1180px) / 2)) 0.9rem;
  background: var(--ruler), var(--graphite-0);
}

@media (min-width: 761px) {
  .project-header,
  .cs-top {
    position: sticky;
    top: 0;
  }
}

.project-header > a,
.cs-top__home {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.project-header nav,
.cs-top ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-header nav a,
.cs-top li a,
.project-footer a,
.cs-foot nav a,
.cs-foot__top {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 44px;
  color: var(--vellum-soft);
  font: 400 0.75rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .project-header nav a:hover,
  .cs-top li a:hover,
  .project-footer a:hover,
  .cs-foot nav a:hover,
  .cs-foot__top:hover,
  .project-header > a:hover,
  .cs-top__home:hover {
    color: var(--paint-grey);
  }
}

.project-footer,
.cs-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.25rem 1.6rem;
  margin-top: clamp(3rem, 7vw, 6rem);
  padding: 1.6rem max(var(--pad), calc((100% - 1180px) / 2)) max(2.5rem, env(safe-area-inset-bottom));
  /* The rule along the top, ticks hanging down. */
  background:
    linear-gradient(var(--vellum-faint), var(--vellum-faint)) left top / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--vellum-faint) 0 1px, transparent 1px 8px) left top / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--vellum-line) 0 1px, transparent 1px 64px) left top / 100% 11px no-repeat,
    rgba(12, 14, 18, 0.6);
}

@media print {
  html,
  body {
    background: #fff;
    color: #111;
  }

  body::before {
    display: none;
  }
}

/* A picture opened from a project page or a case study (work.js, owner 2026-10-19; the case studies too, 2026-10-21: "YOU CANT CLOSE THIS PAGE!???"): over the page, closed by Esc, Close or a click off it. Shown whole at its own ratio, never past its own pixels; a full-page capture runs the window's width and scrolls. */
html:has(.project-viewer[open]) {
  overflow: hidden;
}

.project-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--graphite-0);
  color: var(--vellum);
  font: 400 1rem/1.4 var(--sans);
}

.project-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.project-viewer::backdrop {
  background: transparent;
}

.project-viewer__bar {
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: max(0.75rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 3rem) 0.9rem;
  background: var(--ruler);
}

.project-viewer__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--vellum-soft);
  font: 400 0.75rem/1.4 var(--mono);
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-viewer__full {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  color: var(--vellum);
  font: 400 0.75rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.project-viewer__close {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 44px;
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--vellum-line);
  background: rgba(12, 14, 18, 0.5);
  color: var(--vellum);
  font: 400 0.75rem/1.2 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .project-viewer__close:hover {
    border-color: var(--vellum);
    background: rgba(236, 230, 218, 0.06);
  }
}

.project-viewer__stage {
  display: flex;
  align-items: flex-start;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.5rem clamp(1rem, 4vw, 3rem) max(1.5rem, env(safe-area-inset-bottom));
}

.project-viewer__stage img {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
}

.project-viewer.is-tall .project-viewer__stage img {
  max-height: none;
  margin: 0 auto;
}

@media (max-width: 520px) {
  .project-viewer__full {
    display: none;
  }
}

/* Page to page (the home page, /work/, the case studies, /resume/, /film/):
   the browser crossfades one page into the next where it can (cross-document
   view transitions; Chrome 126, Safari 18.2), and simply navigates where it
   cannot. With reduced motion there is no transition (2026-10-26). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}
