/* ==========================================================================
   Lostyellow — style.css
   Lost, yet building.

   Contents
   01. Tokens
   02. Base & reset
   03. Utilities
   04. Buttons
   05. Header & navigation
   06. Hero
   07. Sections (shared)
   08. About
   09. Projects
   10. Lab / Notes
   11. Contact
   12. Footer
   13. 404 page
   14. Motion (reveal, keyframes, reduced motion)
   ========================================================================== */


/* 01. Tokens
   ========================================================================== */

:root {
  /* Color */
  --bg: #0f0f0e;
  --bg-elev: #151513;
  --bg-elev-2: #1b1b18;
  --text: #ede8dc;
  --text-muted: #a39f95;   /* 7.2:1 on --bg */
  --text-faint: #75716a;   /* decorative only */
  --line: rgba(237, 232, 220, 0.11);
  --line-strong: rgba(237, 232, 220, 0.24);
  --yellow: #f5c542;       /* 11.8:1 on --bg */
  --yellow-bright: #ffd65e;
  --yellow-dim: rgba(245, 197, 66, 0.14);
  --on-yellow: #14120c;

  /* Type */
  --font-sans: "Inter", "Inter Variable", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", "Roboto Mono",
    Menlo, Consolas, monospace;

  /* Layout */
  --max: 1440px;
  --gutter: clamp(20px, 4.5vw, 64px);
  --header-h: 72px;
  --radius: 6px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

@media (max-width: 767.98px) {
  :root { --header-h: 64px; }
}


/* 02. Base & reset
   ========================================================================== */

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

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }

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

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

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

::selection { background: var(--yellow); color: var(--on-yellow); }

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

#main:focus { outline: none; }


/* 03. Utilities
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  /* Keep content clear of the notch on landscape phones (viewport-fit=cover) */
  padding-inline:
    max(var(--gutter), env(safe-area-inset-left))
    max(var(--gutter), env(safe-area-inset-right));
}

.mono { font-family: var(--font-mono); }

.soft { color: var(--text-muted); }

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-yellow);
  font-weight: 600;
  font-size: 0.9375rem;
  transform: translateY(-200%);
  transition: transform 0.25s var(--ease);
}

.skip-link:focus { transform: none; }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.noscript-note { color: var(--text-muted); }
.noscript-note a { color: var(--yellow); text-decoration: underline; text-underline-offset: 0.2em; }


/* 04. Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 0.9375rem/1 var(--font-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.btn-primary {
  background: var(--yellow);
  color: var(--on-yellow);
}

.btn-primary:hover { background: var(--yellow-bright); }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.btn-arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.4s var(--ease);
}

.btn:hover .btn-arrow { transform: translateX(3px); }

.btn-icon {
  width: 16px;
  height: 16px;
}


/* 05. Header & navigation
   ========================================================================== */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition:
    background-color 0.4s var(--ease),
    border-color 0.4s var(--ease);
}

.site-header.is-scrolled {
  background: rgba(15, 15, 14, 0.88);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
}

.brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-block: 6px;
  color: var(--text);
}

.brand-mark {
  width: 28px;
  height: 28px;
  color: var(--yellow);
  transition: transform 0.6s var(--ease);
}

.brand:hover .brand-mark { transform: translateY(-2px); }

.brand-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.nav-list {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
  list-style: none;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--yellow);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 1px;
  background: var(--yellow);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease);
}

.nav-link:hover,
.nav-link[aria-current="true"] { color: var(--text); }

.nav-link:hover::after,
.nav-link[aria-current="true"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-toggle { display: none; }

/* Mobile navigation (JS-enhanced overlay) */
@media (max-width: 767.98px) {
  .js .nav-toggle {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 6px 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .nav-toggle-icon {
    position: relative;
    width: 28px;
    height: 28px;
  }

  .nav-toggle-icon span {
    position: absolute;
    left: 7px;
    right: 7px;
    height: 1.5px;
    background: currentColor;
    border-radius: 1px;
    transition: transform 0.4s var(--ease), background-color 0.3s;
  }

  .nav-toggle-icon span:first-child { top: 10.5px; }
  .nav-toggle-icon span:last-child { top: 16px; }

  .nav-open .nav-toggle-icon span { background: var(--yellow); }
  .nav-open .nav-toggle-icon span:first-child { transform: translateY(2.75px) rotate(45deg); }
  .nav-open .nav-toggle-icon span:last-child { transform: translateY(-2.75px) rotate(-45deg); }

  /* The overlay starts below the header and scrolls internally when the
     screen is too short (e.g. phones in landscape). */
  .js .site-nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: 24px var(--gutter) 40px;
    padding:
      24px
      max(var(--gutter), env(safe-area-inset-right))
      calc(40px + env(safe-area-inset-bottom))
      max(var(--gutter), env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
    visibility: hidden;
    opacity: 0;
    transition:
      opacity 0.35s var(--ease),
      visibility 0s linear 0.35s;
  }

  /* Auto margins centre the list when there is room and fall back to
     top-aligned (never clipped above) when there is not. */
  .js .nav-list { margin-block: auto; }

  .nav-open .site-header { border-bottom-color: var(--line); }

  .nav-open .site-nav {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.35s var(--ease), visibility 0s;
  }

  /* backdrop-filter would make the fixed overlay relative to the header */
  .nav-open .site-header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .js .nav-list {
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--line);
  }

  .js .nav-list li { border-bottom: 1px solid var(--line); }

  .js .nav-link {
    display: flex;
    width: 100%;
    gap: 18px;
    padding: 20px 0;
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    font-weight: 500;
    letter-spacing: -0.025em;
    color: var(--text);
  }

  .js .nav-link::after { display: none; }

  .js .nav-link[aria-current="true"] { color: var(--yellow); }

  .js .nav-index { font-size: 0.75rem; }

  html.nav-open { overflow: hidden; }

  /* Short screens (landscape phones): tighter rows so all four fit */
  @media (max-height: 500px) {
    .js .site-nav { padding-top: 12px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
    .js .nav-link { padding: 12px 0; font-size: 1.5rem; }
  }

  /* No-JS fallback: a simple wrapped row */
  .no-js .site-header { position: absolute; height: auto; }
  .no-js .header-inner { flex-wrap: wrap; padding-block: 14px; }
  .no-js .nav-list { flex-wrap: wrap; gap: 4px 18px; }
  .no-js .nav-link { font-size: 0.875rem; }
}


/* 06. Hero
   ========================================================================== */

.hero {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: var(--header-h);
  overflow-x: clip;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  padding-top: clamp(24px, 5vh, 64px);
  padding-bottom: clamp(24px, 4vh, 48px);
  container-type: inline-size;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-eyebrow-rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* The masthead is sized to the container width by main.js (fitMasthead);
   these values are a close CSS estimate so there is no visible jump. */
.masthead {
  margin-top: clamp(14px, 3vh, 32px);
  font-size: 15.5vw;
  font-size: 16.4cqi;
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}

.masthead-text {
  display: inline-block;
  padding-bottom: 0.03em;
  margin-left: -0.05em; /* optical alignment of the "L" stem with the text column */
}

.hero-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: end;
  gap: clamp(24px, 4vw, 72px);
  margin-top: clamp(24px, 5vh, 56px);
}

.hero-copy { padding-bottom: clamp(4px, 2vh, 24px); }

.hero-tagline {
  font-size: clamp(2.25rem, 5.4cqi, 4.75rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-tagline .accent { color: var(--yellow); }

.hero-lede {
  max-width: 30ch;
  margin-top: 20px;
  font-size: clamp(1.125rem, 1.6cqi, 1.375rem);
  line-height: 1.45;
  color: var(--text-muted);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 56px;
  max-width: 440px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.hero-meta dt {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero-meta dd {
  margin-top: 6px;
  font-size: 1.0625rem;
  color: var(--text);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero-art {
  align-self: end;
  min-width: 0;
}

.sun {
  width: 100%;
  height: auto;
  max-height: 46vh;
  max-height: 46svh;
  overflow: visible;
}

.sun-disc { fill: var(--yellow); }

.sun-ring {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1;
  opacity: 0.34;
}

.sun-ring--2 { opacity: 0.28; stroke-dasharray: 2 7; }
.sun-ring--3 { opacity: 0.1; }

.sun-pulse {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transform-box: view-box;
  transform-origin: 300px 330px;
}

.sun-rise {
  transform-box: view-box;
  transform-origin: 300px 330px;
}

.sun-orbit {
  transform-box: view-box;
  transform-origin: 300px 330px;
  transform: rotate(-38deg);
}

.sun-lost { fill: var(--text); }

.sun-lost-halo {
  fill: none;
  stroke: var(--text);
  stroke-opacity: 0.35;
  stroke-width: 1;
}

.horizon-line {
  stroke: var(--text);
  stroke-opacity: 0.3;
  stroke-width: 1;
}

.horizon-ticks {
  stroke: var(--text);
  stroke-opacity: 0.22;
  stroke-width: 1;
}

.reflection path {
  stroke: var(--yellow);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: var(--o, 0.4);
}

.reflection path:nth-child(1) { --o: 0.6; }
.reflection path:nth-child(2) { --o: 0.46; }
.reflection path:nth-child(3) { --o: 0.34; }
.reflection path:nth-child(4) { --o: 0.24; }
.reflection path:nth-child(5) { --o: 0.16; }
.reflection path:nth-child(6) { --o: 0.1; }

.scroll-cue {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 14px;
  margin-top: clamp(20px, 4vh, 44px);
  padding-block: 6px;
  font-size: 0.6875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}

.scroll-cue:hover { color: var(--text); }

.scroll-cue-line {
  position: relative;
  width: 48px;
  height: 1px;
  overflow: hidden;
  background: var(--line-strong);
}

.scroll-cue-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--yellow);
  transform: translateX(-101%);
}

@media (max-width: 559.98px) {
  .hero-eyebrow-rule,
  .hero-eyebrow span:last-child { display: none; }
}

@media (max-width: 899.98px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 8px;
  }

  .hero-art {
    order: -1;
    width: min(100%, 520px);
    justify-self: center;
  }

  .sun { max-height: 42vh; max-height: 42svh; }

  .hero-tagline { font-size: clamp(2.5rem, 11cqi, 4.25rem); }
  .hero-lede { font-size: clamp(1.0625rem, 4.4cqi, 1.25rem); }
}

@media (max-width: 899.98px) and (max-height: 700px) {
  .sun { max-height: 34vh; max-height: 34svh; }
}


/* 07. Sections (shared)
   ========================================================================== */

.section {
  position: relative;
  padding-block: clamp(88px, 12vw, 168px);
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) - 1px);
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}

.section-rail {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-index { color: var(--yellow); }

.section-index::after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  margin-left: 14px;
  vertical-align: middle;
  background: var(--line-strong);
}

.section-label { color: var(--text-muted); }

@media (min-width: 960px) {
  .section-grid {
    grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
    gap: clamp(40px, 6vw, 112px);
  }

  .section-rail {
    position: sticky;
    top: calc(var(--header-h) + 40px);
    align-self: start;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 0.9em;
  }
}

.section-body { min-width: 0; }

.section-head {
  display: grid;
  gap: 20px;
  margin-bottom: clamp(40px, 6vw, 72px);
}

@media (min-width: 1180px) {
  .section-head {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    align-items: end;
    gap: 48px;
  }
}

.section-title {
  max-width: 18ch;
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.section-intro {
  max-width: 44ch;
  font-size: 1.0625rem;
  color: var(--text-muted);
}


/* 08. About
   ========================================================================== */

.about-grid {
  display: grid;
  gap: 48px;
  margin-top: clamp(40px, 6vw, 72px);
}

@media (min-width: 1100px) {
  .about-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: clamp(48px, 7vw, 120px);
  }
}

.prose {
  display: grid;
  gap: 1.1em;
  max-width: 60ch;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.prose .lead {
  font-size: clamp(1.375rem, 2.3vw, 1.75rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.interest-list {
  margin-top: 18px;
  list-style: none;
  border-top: 1px solid var(--line);
}

.interest-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.0625rem;
}

.interest-mark {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
}

.principles {
  display: grid;
  gap: 36px;
  margin-top: clamp(64px, 9vw, 120px);
  list-style: none;
}

@media (min-width: 720px) {
  .principles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(24px, 3vw, 48px);
  }
}

.principle {
  position: relative;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.principle::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--yellow);
  transform: scaleX(0.16);
  transform-origin: left;
  transition: transform 1.2s var(--ease);
}

.principle:hover::before { transform: scaleX(1); }

.principle-step {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--yellow);
}

.principle-title {
  margin-top: 18px;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.principle p {
  margin-top: 10px;
  color: var(--text-muted);
}


/* 09. Projects
   ========================================================================== */

.project-grid {
  display: grid;
  gap: 20px;
  list-style: none;
}

@media (min-width: 720px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1180px) {
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.project-grid > li { display: flex; }

.project-card {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 420px;
  padding: clamp(22px, 2.4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition:
    border-color 0.5s var(--ease),
    background-color 0.5s var(--ease),
    transform 0.6s var(--ease);
}

.project-card:hover,
.project-card:focus-within {
  border-color: rgba(245, 197, 66, 0.42);
  background: var(--bg-elev-2);
}

@media (hover: hover) {
  .project-card:hover { transform: translateY(-4px); }
}

.project-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.project-index { color: var(--yellow); }

.project-glyph {
  display: flex;
  align-items: center;
  height: 112px;
  margin: 32px 0 36px;
  color: var(--yellow);
}

.project-glyph svg {
  width: auto;
  height: 100%;
  overflow: visible;
}

.project-title {
  font-size: clamp(1.5rem, 2.2vw, 1.875rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.project-summary {
  margin-top: 12px;
  color: var(--text-muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 28px;
  list-style: none;
}

.project-tag {
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 24px;
  list-style: none;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  color: var(--yellow);
}

.project-link:hover { text-decoration: underline; text-underline-offset: 0.25em; }

.project-card.is-placeholder {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
}

.project-card.is-placeholder:hover { background: rgba(237, 232, 220, 0.02); }
.project-card.is-placeholder .project-title { color: var(--text-muted); }

/* Glyphs */
.g-card {
  transform-box: view-box;
  transform-origin: 80px 96px;
  transition: transform 0.9s var(--ease);
}

.g-card--l { transform: rotate(-17deg) translateX(-2px); }
.g-card--r { transform: rotate(17deg) translateX(2px); }
.g-card--c { transform: none; }
.g-card-face { fill: var(--bg-elev); transition: fill 0.5s var(--ease); }
.project-card:hover .g-card-face { fill: var(--bg-elev-2); }

.project-card:hover .g-card--l { transform: rotate(-24deg) translateX(-3px); }
.project-card:hover .g-card--r { transform: rotate(24deg) translateX(3px); }
.project-card:hover .g-card--c { transform: translateY(-6px); }

.g-node { fill: var(--bg-elev); transition: fill 0.5s var(--ease); }
.project-card:hover .g-node { fill: var(--bg-elev-2); }

.g-edges {
  stroke-dasharray: 3 4;
}

.g-core-ring {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.9s var(--ease), opacity 0.9s var(--ease);
}

.project-card:hover .g-core-ring { transform: scale(1.5); opacity: 0.4; }

.g-open-ring {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.6s var(--ease);
}

.project-card:hover .g-open-ring { transform: rotate(90deg); }


/* 10. Lab / Notes
   ========================================================================== */

.lab-kinds {
  display: grid;
  gap: 24px;
  margin-bottom: clamp(40px, 5vw, 64px);
  list-style: none;
}

@media (min-width: 720px) {
  .lab-kinds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(24px, 3vw, 48px);
  }
}

.lab-kind { display: grid; gap: 8px; align-content: start; }

.lab-kind-name {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
}

.lab-kind-desc {
  font-size: 1rem;
  color: var(--text-muted);
}

.notebook { border-top: 1px solid var(--line-strong); }

.notebook-head,
.note-row {
  display: grid;
  grid-template-columns: 8rem 8rem minmax(0, 1fr);
  gap: 24px;
}

.notebook-head {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.notes-list { list-style: none; }

.note { border-bottom: 1px solid var(--line); }

.note-row {
  align-items: baseline;
  padding: 24px 0;
}

.note-date,
.note-kind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.note-kind { color: var(--yellow); }

.note-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  transition: color 0.3s var(--ease);
}

.note-summary {
  margin-top: 6px;
  color: var(--text-muted);
}

a.note-row:hover .note-title { color: var(--yellow); }

.notes-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
}

.notes-empty-mark { color: var(--yellow); }

.caret {
  flex: none;
  width: 9px;
  height: 1.15em;
  background: var(--yellow);
}

@media (max-width: 719.98px) {
  .notebook-head { display: none; }
  .note-row { grid-template-columns: auto 1fr; gap: 6px 16px; }
  .note-main { grid-column: 1 / -1; }
  .notes-empty { align-items: flex-start; }
  .notes-empty .caret { display: none; }
}


/* 11. Contact
   ========================================================================== */

.section--contact { padding-bottom: clamp(104px, 14vw, 200px); }

.contact { container-type: inline-size; }

.contact-email {
  display: inline-block;
  max-width: 100%;
  /* Min 1.25rem so the address keeps ~10% headroom on one line at 320px wide */
  font-size: clamp(1.25rem, 7.4vw, 5.25rem);
  font-size: clamp(1.25rem, 8.4cqi, 5.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.045em;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--yellow);
  text-decoration-thickness: 0.05em;
  text-underline-offset: 0.16em;
  overflow-wrap: normal; /* never break inside a word; the only break point is after "@" */
  transition: color 0.4s var(--ease), text-underline-offset 0.4s var(--ease);
}

.contact-email-domain { white-space: nowrap; }

.contact-email:hover {
  color: var(--yellow);
  text-underline-offset: 0.22em;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 40px;
}

.copy-status {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
}

.contact-note {
  margin-top: 48px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}


/* 12. Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--line); }

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding-block: 32px;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
}

.footer-tagline {
  justify-self: center;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.footer-top {
  justify-self: end;
  padding-block: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s var(--ease);
}

.footer-top:hover { color: var(--yellow); }

@media (max-width: 719.98px) {
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: 8px;
  }

  .footer-tagline,
  .footer-top { justify-self: start; }
}


/* 13. 404 page
   ========================================================================== */

.notfound {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 64px;
}

.notfound-mark {
  width: 72px;
  height: 72px;
  color: var(--yellow);
}

.notfound-code {
  margin-top: 40px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow);
}

.notfound-title {
  max-width: 14ch;
  margin-top: 16px;
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
}

.notfound-text {
  max-width: 40ch;
  margin-top: 24px;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.notfound .btn { margin-top: 40px; align-self: flex-start; }


/* 14. Motion
   ========================================================================== */

/* Scroll reveal — enabled only once main.js has set up the observer,
   so content is never hidden if scripts fail to load. */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity 1s var(--ease),
    transform 1s var(--ease);
}

.reveal-ready [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

.reveal-ready .principle::before { transform: scaleX(0); transition-delay: 0.3s; }
.reveal-ready .principle.is-revealed::before { transform: scaleX(0.16); }
.reveal-ready .principle.is-revealed:hover::before { transform: scaleX(1); transition-delay: 0s; }

@media (prefers-reduced-motion: no-preference) {
  /* Hero intro */
  .js [data-intro] {
    animation: intro 1.2s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 90ms + 100ms);
  }

  .hero-eyebrow { --i: 0; }
  .masthead { --i: 1; }
  .hero-tagline { --i: 3; }
  .hero-lede { --i: 4; }
  .hero-meta { --i: 5; }
  .hero-actions { --i: 6; }
  .scroll-cue { --i: 9; }

  .js .hero-art { animation-name: fade; --i: 2; }

  .js .sun-rise { animation: sunrise 2.4s var(--ease) 0.35s both; }
  .js .sun-glow { animation: fade 2.4s var(--ease) 0.9s both; }

  /* Ambient: orbit of the "lost" dot, signal pulse, reflection shimmer */
  .sun-orbit { animation: orbit 44s linear infinite; }
  .sun-pulse { animation: pulse 6.5s var(--ease) 2.6s infinite; }

  .reflection path { animation: shimmer 4.8s ease-in-out infinite alternate; }
  .reflection path:nth-child(2) { animation-delay: -0.8s; }
  .reflection path:nth-child(3) { animation-delay: -1.6s; }
  .reflection path:nth-child(4) { animation-delay: -2.4s; }
  .reflection path:nth-child(5) { animation-delay: -3.2s; }
  .reflection path:nth-child(6) { animation-delay: -4s; }

  .scroll-cue-line::after { animation: cue 2.6s var(--ease-in-out) 2s infinite; }

  .caret { animation: blink 1.1s steps(1, end) infinite; }

  /* Mobile nav items */
  .nav-open .nav-list li { animation: intro 0.7s var(--ease) both; }
  .nav-open .nav-list li:nth-child(2) { animation-delay: 0.05s; }
  .nav-open .nav-list li:nth-child(3) { animation-delay: 0.1s; }
  .nav-open .nav-list li:nth-child(4) { animation-delay: 0.15s; }

  /* Agent glyph: messages passing along edges */
  .project-card:hover .g-edges { animation: flow 1.4s linear infinite; }
}

@keyframes intro {
  from { opacity: 0; transform: translate3d(0, 28px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes sunrise {
  from { transform: translateY(150px); }
  to   { transform: none; }
}

/* The dot travels the visible arc slowly, then slips below the horizon
   briefly before it is found again. -96deg and 264deg are the same angle. */
@keyframes orbit {
  0%   { transform: rotate(-96deg); }
  78%  { transform: rotate(96deg); }
  100% { transform: rotate(264deg); }
}

@keyframes pulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { opacity: 0; }
  100% { transform: scale(1.85); opacity: 0; }
}

@keyframes shimmer {
  from { opacity: var(--o, 0.4); }
  to   { opacity: calc(var(--o, 0.4) * 0.45); }
}

@keyframes cue {
  0%   { transform: translateX(-101%); }
  50%  { transform: translateX(0); }
  100% { transform: translateX(101%); }
}

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

@keyframes flow {
  to { stroke-dashoffset: -14; }
}

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

  .reveal-ready [data-reveal] { opacity: 1; transform: none; }
}
