@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex";
  src: url("/fonts/plex-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex";
  src: url("/fonts/plex-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
/* Metric-matched fallbacks keep the swap from shifting the layout. */
@font-face {
  font-family: "Newsreader Fallback";
  src: local("Times New Roman"), local("Times");
  size-adjust: 104%;
  ascent-override: 88%;
  descent-override: 24%;
}
@font-face {
  font-family: "Plex Fallback";
  src: local("Arial"), local("Helvetica");
  size-adjust: 101%;
  ascent-override: 102%;
  descent-override: 27%;
}

:root {
  --paper: #F4F2ED;
  --ink: #161616;
  --muted: #5E5B56;
  --faint: #8C8881;
  --line: rgb(22 22 22 / 0.16);
  --accent: #54151D;
  --geometry: rgb(22 22 22 / 0.13);

  --serif: "Newsreader", "Newsreader Fallback", "Times New Roman", serif;
  --sans: "Plex", "Plex Fallback", system-ui, sans-serif;

  --gutter: max(24px, min(6vw, 72px));
  --pad-x-l: max(var(--gutter), env(safe-area-inset-left));
  --pad-x-r: max(var(--gutter), env(safe-area-inset-right));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E0E0E;
    --ink: #E8E5DF;
    --muted: #A39E96;
    --faint: #7A766F;
    --line: rgb(232 229 223 / 0.16);
    --accent: #C07B85;
    --geometry: rgb(232 229 223 / 0.11);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, p { margin: 0; font-weight: inherit; font-size: inherit; }

/* ---------- Sheet: a drafting-sheet grid ---------- */
.sheet {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  padding:
    max(28px, env(safe-area-inset-top))
    var(--pad-x-r)
    max(28px, env(safe-area-inset-bottom))
    var(--pad-x-l);
}
/* Vertical construction guide, as in the reference sheet. */
.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: calc(var(--pad-x-r) + 9%);
  width: 1px;
  background: var(--line);
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- Masthead ---------- */
.masthead {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
/* Ruler ticks hanging from the hairline: minor every 8px, major every 64px. */
.masthead::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 7px;
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 64px) top / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 8px) top / 100% 3px no-repeat;
  opacity: 0.9;
}
.masthead__name {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.mark {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* ---------- Identity ---------- */
.identity {
  align-self: center;
  padding-block: clamp(56px, 12svh, 140px) clamp(40px, 8svh, 96px);
}
.name {
  font-family: var(--serif);
  font-weight: 400;
  font-variation-settings: "opsz" 72;
  font-size: clamp(3.25rem, 16.5vw, 6.5rem);
  line-height: 0.94;
  letter-spacing: -0.022em;
  font-kerning: normal;
}
.name span { display: block; }
.field {
  margin-top: clamp(20px, 3.4vw, 32px);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  color: var(--ink);
}
.field span { color: var(--faint); margin-inline: 0.35em; }

.contact { margin-top: clamp(64px, 12svh, 120px); }
.label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact__row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 12px;
}
.email {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  padding-block: 8px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.125rem, 5.2vw, 1.375rem);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.32em;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  overflow-wrap: anywhere;
  border-radius: 2px;
  transition: text-decoration-color 300ms var(--ease);
}
.email__arrow {
  flex: none;
  width: 0.62em;
  height: 0.62em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: square;
  transform: translateY(-0.05em);
  transition: transform 420ms var(--ease);
}
.email:hover, .email:focus-visible { text-decoration-color: var(--accent); }
.email:hover .email__arrow,
.email:focus-visible .email__arrow { transform: translate(0.12em, -0.17em); }

.copy {
  appearance: none;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.625rem/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: opacity 300ms var(--ease), color 300ms var(--ease);
}
.copy:hover, .copy:focus-visible, .copy[data-state="done"] { opacity: 1; color: var(--ink); }
/* Copy is a desktop affordance; on touch the mail link is the action. */
@media (hover: none) { .copy { display: none; } }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 6px;
}

/* ---------- Colophon ---------- */
.colophon { display: grid; gap: 12px; justify-items: start; }
.colophon__rule { width: 24px; height: 1px; background: var(--ink); opacity: 0.5; }
.colophon p {
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* ---------- Geometry ---------- */
.geometry {
  position: fixed;
  z-index: 0;
  top: 50%;
  left: 38%;
  width: max(118vw, 560px);
  height: auto;
  translate: 0 -46%;
  pointer-events: none;
  overflow: visible;
}
.geometry__drift { transition: transform 1.2s var(--ease); }
.g {
  fill: none;
  stroke: var(--geometry);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.g--3 { stroke-dasharray: 1; stroke-dashoffset: 0; }
.g--dash { stroke-dasharray: 3 7; opacity: 0.9; }
.geometry__orbit { transform-origin: 500px 640px; transform-box: view-box; }
.node { fill: var(--muted); opacity: 0.55; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Desktop composition ---------- */
@media (min-width: 900px) {
  .sheet {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 24px;
  }
  .sheet::before { right: calc(var(--pad-x-r) + 25%); }
  .masthead, .colophon { grid-column: 1 / -1; }
  .identity {
    grid-column: 1 / span 8;
    display: grid;
    grid-template-columns: subgrid;
    align-self: end;
    padding-block: 12svh 10svh;
  }
  .name, .field { grid-column: 1 / -1; }
  .name { font-size: clamp(6rem, 10.5vw, 11rem); line-height: 0.9; }
  .field { font-size: 0.875rem; }
  .contact { grid-column: 1 / span 6; margin-top: clamp(72px, 11svh, 140px); }
  .geometry { left: 52%; width: max(64vw, 820px); translate: 0 -46%; opacity: 0.85; }
}
@media (min-width: 900px) and (max-height: 640px) {
  .identity { padding-block: 6svh; align-self: center; }
  .contact { margin-top: 6svh; }
}

/* Short landscape phones: keep the whole sheet in view. */
@media (max-height: 520px) and (max-width: 899px) {
  .identity { padding-block: 28px 20px; }
  .name { font-size: clamp(2.75rem, 11svh + 2vw, 4.5rem); }
  .contact { margin-top: 24px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .name, .field {
    animation: settle 760ms var(--ease) both;
  }
  .field { animation-delay: 120ms; }
  .contact, .masthead, .colophon { animation: rise 900ms var(--ease) 260ms both; }
  .g { stroke-dasharray: 1; animation: draw 1600ms var(--ease) both; }
  .g--2 { animation-delay: 160ms; }
  .g--3 { animation-delay: 320ms; }
  .g--dash { stroke-dasharray: 3 7; animation: rise 1400ms var(--ease) 700ms both; }
  .node { animation: rise 600ms var(--ease) 1200ms both; }
}
@keyframes settle {
  from { opacity: 0.01; filter: blur(6px); transform: translateY(6px); }
  to { opacity: 1; filter: blur(0); transform: none; }
}
@keyframes rise { from { opacity: 0.01; } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .geometry__drift { transform: none !important; }
}

/* ---------- Print: a correspondence letterhead ---------- */
@media print {
  @page { size: A4; margin: 22mm 20mm; }
  :root { --paper: #fff; --ink: #000; --muted: #444; --accent: #54151D; --line: #bbb; --geometry: rgb(0 0 0 / 0.12); }
  body { min-height: 0; background: #fff; }
  .sheet { display: block; min-height: 0; padding: 0; }
  .sheet::before, .masthead::after, .copy { display: none; }
  .identity { padding: 18mm 0 0; }
  .name { font-size: 40pt; }
  .contact { margin-top: 14mm; }
  .email { text-decoration: none; }
  .colophon { margin-top: 20mm; }
  .geometry { position: absolute; top: 0; left: auto; right: -60mm; width: 150mm; translate: none; }
  * { animation: none !important; }
}
