:root {
  --bg: #050505;
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --dark: #0b0b0b;
  --gutter: 24px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Fixed chrome ---------- */
.site-header,
.site-footer {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  z-index: 20;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.site-header { top: var(--gutter); align-items: flex-start; }
.site-footer { bottom: var(--gutter); flex-direction: column; gap: 2px; right: auto; }
.site-header a, .site-footer a { pointer-events: auto; }

.brand { display: flex; flex-direction: column; }
.nav { display: flex; gap: 16px; }
.nav a { color: var(--muted); transition: color 0.25s; }
.nav a.is-active, .nav a:hover { color: var(--fg); }

/* ---------- WebGL image planes ---------- */
.gl-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.75;
  pointer-events: none;
}

/* Invisible box each plane is drawn over; resize here to change image size */
.project-media {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(77vw, 107vh);
  aspect-ratio: 1.46;
  transform: translate(-50%, -50%);
  background-size: cover;
  background-position: center;
  visibility: hidden;
  pointer-events: none;
}
/* Flat fallback when WebGL isn't available */
.no-webgl .project-media,
.project-media.is-flat { visibility: visible; opacity: 0.6; }

/* ---------- Project sections ---------- */
main { position: relative; z-index: 10; }

.project {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 var(--gutter);
  user-select: none;
}

.project-inner { position: relative; display: flex; flex-direction: column; align-items: center; }

.project-kicker {
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0;
  transition: opacity 0.25s linear 0.35s;
}
.project.is-in .project-kicker { opacity: 1; }

.project-link { display: flex; flex-direction: column; align-items: center; }

.project-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(48px, 7.5vw, 104px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 32px;
  perspective: 600px;
}
.project-title .word { display: inline-block; white-space: nowrap; }
.project-title .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) rotateX(-60deg);
  transition: opacity 0.6s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: calc(var(--i) * 28ms);
}
.project.is-in .project-title .char { opacity: 1; transform: none; }

/* Circular arrow button */
.circle-btn {
  position: relative;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  overflow: hidden;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.75s ease-out 0.25s, transform 0.75s var(--ease-out) 0.25s;
}
.project.is-in .circle-btn { opacity: 1; transform: scale(1); }

.circle-bg, .circle-fill { position: absolute; inset: 0; border-radius: 50%; }
.circle-bg { background: rgba(11, 11, 11, 0.75); }
.circle-fill {
  background: var(--fg);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.45s var(--ease-out), opacity 0.3s;
}
.arrow {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.45s var(--ease-out), opacity 0.3s;
}
.arrow-b { color: var(--dark); opacity: 0; transform: translateX(-0.6em); }

.project-link:hover .circle-fill,
.project-link:focus-visible .circle-fill { opacity: 1; transform: scale(1); }
.project-link:hover .arrow-a,
.project-link:focus-visible .arrow-a { opacity: 0; transform: translateX(0.6em); }
.project-link:hover .arrow-b,
.project-link:focus-visible .arrow-b { opacity: 1; transform: none; }
.project-link:focus-visible { outline: none; }

/* ---------- Right-side indicator ---------- */
.indicator {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 20;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.indicator li { position: relative; }
.indicator button {
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 1px;
  transition: border-color 0.3s, width 0.3s var(--ease-out), height 0.3s var(--ease-out);
}
.indicator button:hover { border-color: var(--fg); }
.indicator li.is-active button { width: 12px; height: 12px; border-color: var(--fg); }

/* Frame that slides to the active square */
.indicator-frame {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border: 1px solid var(--fg);
  border-radius: 2px;
  pointer-events: none;
  transition: top 0.5s var(--ease-out);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px var(--gutter);
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox-frame {
  position: relative;
  width: min(1200px, 100%, calc((100vh - 144px) * 16 / 9));
  aspect-ratio: 16 / 9;
  transform: scale(0.96);
  transition: transform 0.5s var(--ease-out);
}
.lightbox.is-open .lightbox-frame { transform: none; }

.lightbox-media, .lightbox-media video, .lightbox-media iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}
.lightbox-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  color: var(--muted);
}

/* Sits just above the video's top-right corner */
.lightbox-close {
  position: absolute;
  bottom: 100%;
  right: 0;
  padding: 0 0 10px 10px;
  color: var(--muted);
  transition: color 0.25s;
}
.lightbox-close:hover { color: var(--fg); }

body.no-scroll { overflow: hidden; }

@media (max-width: 1023px) {
  /* Matches the reference: shorter sections on small screens, offset from the header */
  main { padding-top: 15vh; }
  .project { height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
}
