/* ==========================================================================
   Kodelig — design tokens
   ========================================================================== */

@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/schibsted-grotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/karla.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono.woff2') format('woff2');
}

:root {
  /* colour — Arctic fjord + midnight-sun */
  --ink-950: #0B1A28;
  --ink-900: #0F2032;
  --ink-800: #13293E;
  --ink-700: #1C384F;
  --ink-600: #2E5268;
  --ink-500: #3E5F76;

  --mist: #F4F6F5;
  --muted: #92A5B8;

  --gold: #E8A855;
  --gold-soft: #F6D9A8;
  --aurora: #3E7A6D;
  --error: #E2604F;

  --bg: var(--ink-950);
  --panel: var(--ink-800);
  --border: var(--ink-700);
  --text: var(--mist);
  --text-muted: var(--muted);
  --accent: var(--gold);

  /* type */
  --font-display: 'Schibsted Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Karla', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;

  /* space (4px rhythm) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;
  --space-10: 9rem;

  --container: 72rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --radius-sm: 8px;
  --radius-md: 16px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 180ms;
  --dur-base: 500ms;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* film-grain overlay — quiets the flat dark gradients */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* blueprint grid — faint schematic backdrop, sits behind all page content */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  background-image:
    linear-gradient(rgba(232, 168, 85, 0.6) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 168, 85, 0.6) 1px, transparent 1px);
  background-size: 56px 56px;
}

/* ==========================================================================
   HUD chrome — corner brackets, chevron labels, scanlines, status dot.
   Console-panel language borrowed from 2Advanced's "Prophecy" (2004), redrawn
   in Kodelig's ink/gold palette instead of its original maroon/teal.
   ========================================================================== */

.hud-corners {
  position: relative;
}
.hud-corners::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold)),
    linear-gradient(var(--gold), var(--gold));
  background-repeat: no-repeat;
  background-size: 14px 2px, 2px 14px, 14px 2px, 2px 14px, 14px 2px, 2px 14px, 14px 2px, 2px 14px;
  background-position:
    top left, top left,
    top right, top right,
    bottom right, bottom right,
    bottom left, bottom left;
  opacity: 0.55;
}

.hud-scan {
  overflow: hidden;
}
.hud-scan::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-soft) 50%, transparent);
  box-shadow: 0 0 8px 1px rgba(232, 168, 85, 0.55);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .hud-scan::after { animation: hud-sweep 6s linear infinite; }
}
@keyframes hud-sweep {
  0%   { top: 0%;   opacity: 0; }
  6%   { opacity: 0.55; }
  94%  { opacity: 0.55; }
  100% { top: 100%; opacity: 0; }
}

.hud-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aurora);
  box-shadow: 0 0 6px 1px rgba(62, 122, 109, 0.85);
  margin-right: var(--space-2);
  vertical-align: middle;
}
@media (prefers-reduced-motion: no-preference) {
  .hud-dot { animation: hud-pulse 2.2s ease-in-out infinite; }
}
@keyframes hud-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* panel title bar — shared by service/portfolio cards, mirrors .term-bar */
.card-hud-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(244, 246, 245, 0.03);
}

.card-index {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* ==========================================================================
   Layout helpers
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -3rem;
  background: var(--gold);
  color: var(--ink-950);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  top: var(--space-4);
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: absolute;
  inset-inline: 0;
  top: 0;
  z-index: 20;
  padding-top: var(--space-6);
  padding-bottom: var(--space-4);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(232, 168, 85, 0.35) 20%, rgba(232, 168, 85, 0.35) 80%, transparent);
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.brand-mark-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 4px;
  flex-shrink: 0;
}
.brand-mark-frame::before { opacity: 0.4; }

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--gold);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--mist);
}

.hud-nav {
  display: none;
  align-items: center;
  gap: var(--space-6);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud-nav a {
  transition: color var(--dur-fast) var(--ease-out);
}
.hud-nav a::before {
  content: "\00BB\0020";
  color: var(--gold);
}
.hud-nav a:hover,
.hud-nav a:focus-visible {
  color: var(--gold-soft);
}

@media (min-width: 56em) {
  .hud-nav { display: flex; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--gold);
  color: var(--ink-950);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1;
  white-space: nowrap;
  padding: var(--space-3) var(--space-5);
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.btn:hover {
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--lg {
  font-size: 1.0625rem;
  padding: var(--space-4) var(--space-7);
}

/* ==========================================================================
   Eyebrow / section kickers (semantic h2, styled small)
   ========================================================================== */

.eyebrow {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 var(--space-4);
}

.eyebrow::before {
  content: "\00BB\00BB\0020";
  letter-spacing: 0;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: var(--ink-950);
}

.hero-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.hero-photo {
  /* 10% taller than its box, so the scroll-parallax translate always has
     bleed to reveal instead of exposing an empty edge */
  position: absolute;
  top: -10%;
  left: 0;
  right: 0;
  bottom: -10%;
  width: 100%;
  height: 120%;
  object-fit: cover;
  object-position: 63% 40%;
}

.hero-glow {
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  background: radial-gradient(ellipse 55% 42% at 66% 82%,
    rgba(246, 217, 168, 0.55) 0%,
    rgba(232, 168, 85, 0.22) 45%,
    rgba(232, 168, 85, 0) 72%);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg,
      rgba(8, 15, 24, 0.86) 0%,
      rgba(8, 15, 24, 0.64) 30%,
      rgba(8, 15, 24, 0.28) 55%,
      rgba(8, 15, 24, 0.08) 76%),
    linear-gradient(to top,
      rgba(8, 15, 24, 0.6) 0%,
      rgba(8, 15, 24, 0) 28%);
}

@media (max-width: 40em) {
  /* narrow crops zoom into the photo's brightest rock face, and the text
     column spans nearly the full width — the desktop left-to-right scrim
     doesn't cover enough of it, so fall back to a strong, even wash */
  .hero-scrim {
    background:
      linear-gradient(rgba(6, 12, 20, 0.6), rgba(6, 12, 20, 0.6)),
      linear-gradient(to top,
        rgba(6, 12, 20, 0.7) 0%,
        rgba(6, 12, 20, 0.35) 30%,
        rgba(6, 12, 20, 0.45) 65%,
        rgba(6, 12, 20, 0.7) 100%);
  }
}

/* ==========================================================================
   Hero terminal — decorative "statement" piece. Stacked full-width below the
   text on narrow viewports (there's no side-by-side room); becomes a column
   beside the text from 64em up. Hidden only in the short/landscape case
   where the lede already gets dropped to keep the hero fitting on-screen.
   ========================================================================== */

.hero-terminal {
  margin-top: var(--space-6);
  border-radius: var(--radius-md);
  background: rgba(15, 30, 45, 0.42);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(244, 246, 245, 0.14);
  box-shadow: 0 24px 60px rgba(3, 8, 14, 0.45), 0 1px 0 rgba(244, 246, 245, 0.06) inset;
  overflow: hidden;
}

@media (min-width: 64em) {
  /* grid, not absolute positioning: a text column that can grow its own
     font-size (the h1's clamp() tracks viewport width, not this container)
     next to a fixed-width terminal column drifted apart or collided at
     various widths when it was guesswork percentages — grid reserves real
     track space for both, so they can't overlap regardless of exactly how
     wide the heading gets */
  .hero-inner {
    display: grid;
    grid-template-columns: 1fr min(21vw, 340px);
    align-items: center;
    column-gap: clamp(1.5rem, 4vw, 4rem);
  }

  .hero-terminal {
    margin-top: 0;
  }
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(244, 246, 245, 0.1);
}

.term-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(244, 246, 245, 0.28);
}

.term-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.term-body {
  height: 165px;
  overflow: hidden;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  white-space: pre;
}

@media (min-width: 64em) {
  .term-body { height: 258px; }
}

.term-body > div {
  min-height: 1.7em;
}

.term-cmd { color: var(--mist); }
.term-ok { color: var(--gold-soft); }
.term-code { color: var(--muted); }
.term-dim { color: var(--muted); opacity: 0.75; }

.term-cursor {
  display: inline-block;
  width: 6px;
  height: 1em;
  background: var(--gold);
  margin-left: 1px;
  vertical-align: text-bottom;
}

@media (prefers-reduced-motion: no-preference) {
  .term-cursor { animation: term-blink 1s step-end infinite; }
}

@keyframes term-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-glow { animation: glow 7s ease-in-out infinite alternate; }

  /* scroll parallax targets — updated from js/main.js while the hero is in view */
  .hero-photo, .hero-glow {
    will-change: transform;
  }
}

@keyframes glow {
  from { opacity: 0.58; }
  to   { opacity: 1; }
}

.hero-inner {
  position: relative;
  z-index: 2;
}

.hero-content {
  position: relative;
  padding-top: var(--space-10);
  padding-bottom: var(--space-8);
}

.hero-content .eyebrow { color: var(--gold-soft); }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.75rem, 2.1rem + 3.6vw, 5.25rem);
  line-height: 1.03;
  letter-spacing: -0.02em;
  color: var(--mist);
  max-width: 16ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--gold);
}

.hero .lede {
  margin-top: var(--space-5);
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 38ch;
}

.hero-telemetry {
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-6);
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(244, 246, 245, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(15, 30, 45, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.scroll-cue {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  align-self: flex-start;
  margin: var(--space-7) var(--gutter) var(--space-7);
  padding: var(--space-2) var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease-out);
}
.scroll-cue:hover,
.scroll-cue:focus-visible { color: var(--gold-soft); }

.scroll-cue-line {
  width: 1px;
  height: 28px;
  background: currentColor;
  opacity: 0.6;
}
@media (prefers-reduced-motion: no-preference) {
  .scroll-cue-line { animation: pulse-line 2.2s ease-in-out infinite; }
}
@keyframes pulse-line {
  0%, 100% { transform: scaleY(1); opacity: 0.35; }
  50%      { transform: scaleY(0.55); opacity: 0.8; }
}

/* ==========================================================================
   Reveal-on-scroll (progressive enhancement — see js/main.js)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }

  .js .hero-content > * {
    opacity: 0;
    transform: translateY(14px);
    animation: rise var(--dur-base) var(--ease-out) forwards;
  }
  .js .hero-content > *:nth-child(1) { animation-delay: 80ms; }
  .js .hero-content > *:nth-child(2) { animation-delay: 180ms; }
  .js .hero-content > *:nth-child(3) { animation-delay: 300ms; }
  .js .hero-content > *:nth-child(4) { animation-delay: 420ms; }
  @keyframes rise {
    to { opacity: 1; transform: none; }
  }
}

/* ==========================================================================
   About
   ========================================================================== */

.about {
  padding-block: var(--space-9);
  border-bottom: 1px solid var(--border);
}

.about .prose {
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.4375rem);
  line-height: 1.65;
  color: var(--text);
  max-width: 42ch;
}

/* ==========================================================================
   Services
   ========================================================================== */

.services {
  padding-block: var(--space-9);
}

.service-list {
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 48em) {
  .service-list { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
}

.service-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.service-card:hover {
  border-color: var(--ink-500);
  transform: translateY(-2px);
}

.service-card-body {
  padding: var(--space-6);
}

.service-icon {
  width: 32px;
  height: 32px;
  color: var(--gold);
  margin-bottom: var(--space-5);
}

.service-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--mist);
  letter-spacing: -0.01em;
}

.service-card p {
  margin-top: var(--space-3);
  color: var(--muted);
  line-height: 1.6;
}

/* ==========================================================================
   Portfolio
   ========================================================================== */

.portfolio {
  padding-block: var(--space-9);
  border-bottom: 1px solid var(--border);
}

.portfolio-list {
  margin-top: var(--space-6);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: var(--space-5);
}

.portfolio-card {
  display: block;
  max-width: 34rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.portfolio-card:hover,
.portfolio-card:focus-visible {
  border-color: var(--ink-500);
  transform: translateY(-2px);
}

.portfolio-media {
  aspect-ratio: 8 / 5;
  overflow: hidden;
}

.portfolio-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease-out);
}

.portfolio-card:hover .portfolio-media img {
  transform: scale(1.03);
}

.portfolio-body {
  padding: var(--space-6);
}

.portfolio-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 var(--space-2);
}

.portfolio-body h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.375rem;
  color: var(--mist);
  letter-spacing: -0.01em;
}

.portfolio-body p:not(.portfolio-tag) {
  margin-top: var(--space-3);
  color: var(--muted);
  line-height: 1.6;
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-5);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--gold-soft);
}

.portfolio-link svg {
  width: 14px;
  height: 14px;
  transition: transform var(--dur-fast) var(--ease-out);
}

.portfolio-card:hover .portfolio-link svg {
  transform: translate(2px, -2px);
}

/* ==========================================================================
   Closing CTA
   ========================================================================== */

.cta-band {
  padding-block: var(--space-9);
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.cta-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  letter-spacing: -0.01em;
  color: var(--mist);
  max-width: 20ch;
  margin-inline: auto;
}

.cta-lede {
  margin-top: var(--space-3);
  color: var(--muted);
  font-size: 1.0625rem;
}

.cta-band .btn {
  margin-top: var(--space-6);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding-block: var(--space-6);
  border-top: 1px solid var(--border);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer .tagline {
  font-family: var(--font-mono);
  color: var(--muted);
}

/* ==========================================================================
   Contact modal — a terminal window, same visual language as .hero-terminal
   (.term-bar / .term-dot / .term-title / .term-cmd / .term-ok are shared),
   but this one is a real, functional <dialog> rather than an animated prop.
   ========================================================================== */

body:has(.contact-modal[open]) {
  overflow: hidden;
}

.contact-modal {
  width: min(34rem, calc(100vw - 2rem));
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
}

.contact-modal::backdrop {
  background: rgba(5, 10, 16, 0.72);
}

@media (prefers-reduced-motion: no-preference) {
  .contact-modal {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
  }
  .contact-modal.is-open {
    opacity: 1;
    transform: none;
  }
  .contact-modal::backdrop {
    opacity: 0;
    transition: opacity var(--dur-base) var(--ease-out);
  }
  .contact-modal.is-open::backdrop {
    opacity: 1;
  }
}

.term-window {
  display: flex;
  flex-direction: column;
  max-height: min(40rem, calc(100vh - 4rem));
  background: var(--ink-900);
  border: 1px solid rgba(244, 246, 245, 0.14);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(3, 8, 14, 0.5);
  overflow: hidden;
}

.term-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -10px -10px 4px;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.term-close svg {
  width: 16px;
  height: 16px;
}

.term-close:hover {
  color: var(--mist);
  background: rgba(244, 246, 245, 0.08);
}

.contact-body {
  padding: var(--space-6);
  overflow-y: auto;
}

.contact-body form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.contact-body form[hidden] {
  display: none;
}

.term-line {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.term-field {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.term-field label {
  flex-shrink: 0;
  color: var(--gold-soft);
}

.term-optional {
  color: var(--muted);
  font-weight: 400;
}

.term-field input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: var(--space-2) 0;
  font: inherit;
  color: var(--mist);
}

.term-field input:focus-visible {
  border-bottom-color: var(--gold);
}

.term-field input:-webkit-autofill,
.term-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--mist);
  -webkit-box-shadow: 0 0 0px 1000px var(--ink-900) inset;
  transition: background-color 9999s ease-in-out 0s;
}

.term-field--block {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}

.term-field--block textarea {
  background: rgba(244, 246, 245, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font: inherit;
  color: var(--mist);
  resize: vertical;
  min-height: 6em;
}

.term-field--block textarea:focus-visible {
  border-color: var(--gold);
}

@media (max-width: 40em) {
  /* iOS Safari auto-zooms the viewport when a focused field's font-size is
     under 16px, and doesn't reliably zoom back out once the field blurs —
     bump these two to the zoom threshold on small/touch screens only, so
     the terminal's compact 0.875rem type stays put on desktop. */
  .term-field input,
  .term-field--block textarea {
    font-size: 16px;
  }
}

.contact-form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
}

.term-submit {
  background: var(--gold);
  color: var(--ink-950);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.875rem;
  padding: var(--space-3) var(--space-5);
  min-height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.term-submit:hover {
  background: var(--gold-soft);
}

.term-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.contact-status[data-state="loading"] { color: var(--muted); }
.contact-status[data-state="success"] { color: var(--gold-soft); }
.contact-status[data-state="error"] { color: var(--error); }

.contact-success {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.contact-success > div {
  min-height: 1.5em;
}

/* ==========================================================================
   Breakpoints — spacing/rhythm refinement
   ========================================================================== */

@media (min-width: 90em) {
  :root { --gutter: max(3rem, calc((100vw - 90rem) / 2 + 3rem)); }
}

/* short viewports (landscape phones/tablets) — the hero's normal padding and
   type scale are sized for portrait; without this the heading alone can
   overflow a ~375px-tall viewport before the lede or scroll-cue even render */
@media (max-height: 480px) {
  .hero-content {
    padding-top: 4.5rem; /* clears the absolutely-positioned header (~4.25rem tall) */
    padding-bottom: var(--space-3);
  }
  .hero h1 {
    font-size: clamp(1.75rem, 1.4rem + 2.2vw, 3rem);
    line-height: 1.08;
  }
  .hero .lede {
    display: none; /* supplementary copy — the heading already carries the message */
  }
  .hero-terminal {
    display: none; /* same reasoning — there's no headroom for it here either */
  }
  .scroll-cue {
    margin: var(--space-3) var(--gutter);
  }
}
