:root {
  --ink: #17202a;
  --ink-soft: #24303c;
  --ink-faint: #33414f;
  --line: rgba(20, 32, 46, 0.28);
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;

  /* Set by scene.js to match the canvas layout; these are fallbacks. */
  --hero-h: 100vh;
  --line-y: 68vh;
  --list-x: 70vw;
  --list-top: 22vh;
  --gutter: 5vw;
  --ground-h: 20vh;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* each page is a stop, and the umbrella settles into its next stage;
     ui.js turns each wheel or trackpad gesture into one page */
  scroll-snap-type: y proximity;
}
/* touch screens: pages behave like slides, one swipe per page */
@media (hover: none) {
  html { scroll-snap-type: y mandatory; }
  .hero, .page { scroll-snap-stop: always; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100%;
  background: #7393b3;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

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

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

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 50;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  pointer-events: none;
}

main { position: relative; z-index: 1; }

.meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ---------- glass ----------
 * A flat pane of frosted glass: no solid border, just light catching the
 * edges (brighter along the top and left), a faint sheen across the face,
 * and a fine grain for the matte finish.
 */

.glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius);
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.07) 42%, rgba(255, 255, 255, 0) 54%),
    linear-gradient(160deg, rgba(236, 243, 250, 0.3), rgba(220, 232, 244, 0.16));
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 1px 0 0 rgba(255, 255, 255, 0.14),
    0 24px 48px -30px rgba(14, 28, 46, 0.45);
}
/* edge light: a hairline that fades in and out along the pane's edges */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.12) 22%,
    rgba(255, 255, 255, 0) 50%,
    rgba(255, 255, 255, 0.06) 78%,
    rgba(255, 255, 255, 0.22) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
/* matte grain */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-image: var(--noise);
  opacity: 0.12;
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* ---------- top bar (slides in once you scroll) ----------
 * Thin and clear: a light frost that fades into the page instead of ending
 * in a line.
 */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
  transform: translateY(-110%);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}
.topbar::before {
  content: "";
  position: absolute;
  inset: 0 0 -18px 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(240, 246, 252, 0.16), rgba(240, 246, 252, 0.04));
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.scrolled .topbar, .subpage .topbar { transform: none; opacity: 1; }
.brand {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.topnav { min-width: 0; }
.topnav ul {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav ul::-webkit-scrollbar { display: none; }
.topnav li + li { border-left: 1px solid var(--line); }
.topnav a {
  display: block;
  padding: 0.1rem 1.05rem;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.topnav li:last-child a { padding-right: 0; }
.topnav a:hover, .topnav a[aria-current] { color: var(--ink); }
.topnav a[aria-current] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  height: var(--hero-h);
  min-height: 520px;
}

.title-canvas {
  position: absolute;
  display: block;
  pointer-events: none;
}

.title-fallback { display: none; }
html:not(.scene-ready) .title-fallback {
  display: block;
  position: absolute;
  left: var(--gutter);
  top: 30vh;
  font-weight: 300;
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.key-pages {
  position: absolute;
  left: var(--list-x);
  right: 0;
  top: var(--list-top);
  padding-left: clamp(1.4rem, 1.8vw, 2.4rem);
  border-left: 1px solid var(--line);
}
.key-pages a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: clamp(0.4rem, 1.2vh, 1rem) 0;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.key-pages .label {
  /* grows with the window so the list fills about a quarter of the screen,
     and is capped by height so it never runs into the glass below */
  font-size: clamp(1.15rem, min(2.3vw, 4vh), 3.2rem);
  font-weight: 400;
  line-height: 1.15;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.key-pages .hint {
  font-size: clamp(0.82rem, 0.95vw, 1.15rem);
  color: var(--ink-faint);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.key-pages a:hover, .key-pages a:focus-visible { color: var(--ink); }
.key-pages a:hover .label, .key-pages a:focus-visible .label { transform: translateX(4px); }
.key-pages a:hover .hint, .key-pages a:focus-visible .hint { opacity: 1; transform: translateX(4px); }

.hero-glass {
  position: absolute;
  left: max(14px, 1.5vw);
  top: var(--line-y);
  bottom: max(14px, 1.5vw);
  width: calc(50vw - max(14px, 1.5vw));
  padding: clamp(1.4rem, 2.6vw, 2.4rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}
.hero-lede {
  font-size: clamp(1.1rem, 1.6vw, 1.45rem);
  font-weight: 300;
  line-height: 1.35;
  max-width: 32ch;
}
.hero-now { font-size: 0.92rem; color: var(--ink-soft); }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin-top: 0.15rem; }
.hero-links a,
.card a,
.contact-links a {
  font-size: 0.95rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: var(--line);
  transition: text-decoration-color 0.2s;
}
.hero-links a:hover, .card a:hover, .contact-links a:hover { text-decoration-color: currentColor; }

.hero-corner {
  position: absolute;
  right: var(--gutter);
  bottom: max(10px, 1.2vw);
  display: flex;
  align-items: baseline;
  gap: clamp(1rem, 2.4vw, 2.2rem);
  color: var(--ink-faint);
}
.hero-dev {
  font-weight: 300;
  font-size: clamp(2.6rem, 5vw, 5rem);
  line-height: 0.85;
  letter-spacing: -0.02em;
}

/* digital clock: each digit sits in its own slot and falls into place */
.clock {
  display: flex;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1.8vw, 1.7rem);
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.clock-slot, .clock-sep {
  position: relative;
  display: inline-block;
  width: 1ch;
  height: 1em;
}
.clock-sep { width: 0.7ch; text-align: center; opacity: 0.7; }
.clock-glyph {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  will-change: transform;
}

/* ---------- pages ----------
 * One screen per page, so each scroll lands on the next stop.
 */

.hero, .page { scroll-snap-align: start; }

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 72px var(--gutter) 32px;
}
/* the last page leaves the ground and the planted umbrella clear */
.page-last { align-items: flex-start; padding-top: max(84px, 16vh); padding-bottom: calc(var(--ground-h) + 24px); }

.section {
  width: min(660px, 50vw);
  padding: clamp(1.6rem, 3vw, 2.6rem);
}

.section h2, .section-title {
  margin: 0 0 0.9rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.section p + p { margin-top: 0.8rem; }
.section-intro { color: var(--ink-soft); margin-bottom: 1.2rem; }

/* raw text on the glass, separated by hairlines */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  column-gap: 2rem;
  border-top: 1px solid var(--line);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 0 1.3rem;
  border-bottom: 1px solid var(--line);
}
.card h3 { font-size: 1.2rem; font-weight: 600; }
.card p:not(.meta) { font-size: 0.94rem; color: var(--ink-soft); line-height: 1.5; }
.card a { margin-top: auto; padding-top: 0.2rem; font-size: 0.9rem; }

.rows li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.rows li:last-child { border-bottom: 1px solid var(--line); }
.rows .meta { white-space: nowrap; }

.skills { margin-top: 1.3rem !important; }

/* betas: video beside its notes */
.beta {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}
.beta h3 { font-size: 1.25rem; font-weight: 600; }
.beta-text { display: grid; gap: 0.45rem; }
.beta-text a { font-size: 0.95rem; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: #1a1630;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.video-play img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-icon {
  position: absolute;
  left: 50%; top: 50%;
  width: 58px; height: 58px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(240, 246, 252, 0.28);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.25s, background 0.25s;
}
.play-icon::after {
  content: "";
  position: absolute;
  left: 23px; top: 18px;
  border-left: 18px solid #fff;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}
.video-play:hover .play-icon { transform: translate(-50%, -50%) scale(1.08); background: rgba(240, 246, 252, 0.4); }

.about-links { margin: 1.3rem 0 1.2rem; border-top: 1px solid var(--line); }
.about-links li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.about-links a, .contact-list a, .back {
  font-size: 1.1rem;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

/* ---------- subpages (contact, notes) ---------- */

.subpage body { background: linear-gradient(#6684a4, #7393b3 55%, #87a3c0) fixed; }
.subpage-main {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 72px 16px 40px;
}
.subpage-main .section { width: min(620px, 100%); }
.contact-list { margin: 1.2rem 0 1.6rem; border-top: 1px solid var(--line); }
.contact-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.after-rows { margin-top: 1.4rem; }
.credits { margin-top: 2rem; display: grid; gap: 0.35rem; }
.credits a { text-underline-offset: 3px; }

/* ---------- light cursor and grabbing ---------- */

.light-cursor, .light-cursor * { cursor: none !important; }
.cursor-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  pointer-events: none;
}
.dragging, .dragging * { user-select: none; -webkit-user-select: none; }
.over-umbrella:not(.light-cursor) body { cursor: grab; }
.dragging:not(.light-cursor) body { cursor: grabbing; }

/* ---------- small screens ---------- */

@media (max-width: 899px) {
  .topbar { height: 42px; padding: 0 12px; }

  .key-pages { padding-left: 1rem; }
  .key-pages a { padding: 0.32rem 0; }
  .key-pages .label { font-size: 1.05rem; }

  .hero-glass {
    bottom: auto;
    width: calc(100vw - 6.5rem);
    padding: 1.3rem;
    gap: 0.6rem;
  }
  .hero-lede { font-size: 1.05rem; }
  .hero-now { font-size: 0.85rem; }
  .hero-corner { right: 14px; }
  .hero-dev { font-size: 2.6rem; }
  .clock { display: none; }
  .brand { font-size: 0.7rem; letter-spacing: 0.03em; }
  .topnav a { padding: 0.1rem 0.42rem; font-size: 0.76rem; letter-spacing: 0; }
  .beta { grid-template-columns: 1fr; gap: 1rem; }

  .page { padding: 64px 12px 24px; justify-content: stretch; }
  .section { width: 100%; padding: 1.5rem 1.35rem; }

  /* projects swipe sideways so the page fits on one screen */
  .cards {
    display: flex;
    gap: 1.1rem;
    margin: 0 -1.35rem;
    padding: 0 1.35rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 1.35rem;
    scrollbar-width: none;
    border-top: 0;
  }
  .cards::-webkit-scrollbar { display: none; }
  .card {
    flex: 0 0 80%;
    scroll-snap-align: start;
    border-top: 1px solid var(--line);
  }
  /* leave room above the grass so the planted umbrella stays visible */
  .page-last { padding-top: 64px; padding-bottom: calc(var(--ground-h) + 30vh); }
}

/* touch screens have no hover, so the hints stay hidden there */
@media (hover: none) {
  .key-pages .hint { display: none; }
}
.layout-mobile .key-pages .hint { display: none; }
.key-pages { overflow-x: clip; }

@media (max-width: 420px) {
  .hero-now { display: none; }
}
