:root {
  --bg: #07060d;
  --fg: #f3f0ff;
  --muted: #8b86a3;
  --line: rgba(255, 255, 255, 0.1);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
  min-height: 100vh;
  isolation: isolate;
}

/* Decorative layers never intercept the existing title and card controls. */
#bgcanvas, .background-veil {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#bgcanvas { display: block; z-index: 0; }
.background-veil {
  z-index: 1;
  background:
    radial-gradient(115% 78% at 50% 0%, transparent 32%, rgba(5, 6, 10, .7) 100%),
    linear-gradient(rgba(5, 6, 10, .78), rgba(5, 6, 10, .78));
}
.site-content { position: relative; z-index: 2; }

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

/* ---------- Title ---------- */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(64px, 12vh, 140px) 24px clamp(48px, 8vh, 96px);
  display: flex;
  justify-content: center;
}
.title {
  position: relative;
  /* font-size drives the canvas text size (read in main.js) */
  font-size: clamp(56px, 13vw, 168px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.title canvas, .projects-heading canvas { display: block; }
.title-letters { position: absolute; inset: 0; }
.title-letter {
  position: absolute;
  top: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  touch-action: manipulation;
}
.title-letter:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.falling-title {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}
.motion-notice {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 101;
  width: min(360px, calc(100vw - 40px));
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #171322;
  color: var(--fg);
  box-shadow: 0 12px 40px #0008;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Bio ---------- */
.bio {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px clamp(56px, 8vw, 88px);
}
.bio-content { position: relative; max-width: 760px; }
.bio h2 {
  margin-bottom: 24px;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.bio p { font-size: clamp(17px, 2vw, 20px); line-height: 1.7; }
.bio p + p { margin-top: 20px; }
/* Opacity preserves the real text's layout, selection and accessibility. */
.bio-content.is-revealing .bio-copy { opacity: 0; }
.bio-reveal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Project cards ---------- */
.projects {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 96px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.projects-heading {
  grid-column: 1 / -1;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.card {
  display: block;
  color: inherit;
  text-decoration: none;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  isolation: isolate;
  opacity: 0;
  transform: translateY(24px);
  transition: transform .5s var(--ease), border-color .4s, opacity .8s var(--ease);
}
.card.shown { opacity: 1; transform: none; }
.card.shown:hover, .card.shown.active {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
}
.card:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
}
.card canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: -1;
}
.card .info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 20px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
.card h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }

@media (max-width: 720px) {
  .projects { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .hero, .bio, .projects { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .bio-content.is-revealing .bio-copy { opacity: 1; }
  .bio-reveal { display: none; }
  .card { transition: none; }
}
