:root {
  --bg: #0a1420;
  --gold: #d4b87a;
  --text: #ece7d8;
  --text-faint: rgba(236, 231, 216, 0.45);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 200;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

main {
  position: relative;
  height: 100vh;
  width: 100vw;
  display: grid;
  place-items: center;
}

#trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Dot accents bloom at the spiral/square contact points. Same coordinate
   space as #trace, but a separate layer so the trail-fade doesn't smear or
   decay them. Sits above the trace, below the text. */
#accents {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  pointer-events: none;
}

.wordmark {
  position: relative;
  z-index: 2;
  font-size: clamp(1.6rem, 5vw, 3.5rem);
  font-weight: 200;
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: var(--text);
  opacity: 0;
  animation: fade-in 2s ease-out 19s forwards;
  text-transform: lowercase;
  user-select: none;
  pointer-events: none;
}

.phi {
  position: absolute;
  bottom: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--text-faint);
  opacity: 0;
  animation: fade-in 2s ease-out 19.7s forwards;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

/* Project links. They rise one-by-one, each on the beat where the spiral
   touches a square (driven from spiral.js). The stack is anchored at its
   bottom edge and items reveal by expanding from max-height 0, so each new
   name appears at the bottom and pushes the earlier ones upward. Reveal is
   one-shot (the .shown class is added once and never removed), so the links
   persist through every subsequent loop of the animation. */
/* Each project label is placed individually by JS (positionProjects in
   spiral.js) just outside its own contact point on the spiral, so the three
   names trace along the arc. A label reveals (fades in) the instant its
   contact point is struck, paired with the dot that blooms there. Reveal is
   one-shot — the names persist through every later loop. */
.projects {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  text-transform: lowercase;
  letter-spacing: 0.24em;
  font-size: 0.82rem;
}

.projects .proj {
  position: absolute;
  white-space: nowrap;
  color: var(--text-faint);
  text-decoration: none;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 1.1s ease-out, color 0.4s ease;
}

.projects .proj.shown {
  opacity: 1;
}

.projects .proj:hover {
  color: var(--gold);
}

footer {
  position: absolute;
  bottom: 1.75rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  color: var(--text-faint);
  opacity: 0;
  animation: fade-in 2s ease-out 20.2s forwards;
  text-transform: lowercase;
  z-index: 2;
}

footer a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.4s ease;
}

footer a:hover {
  color: var(--gold);
}

@keyframes fade-in {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark, .phi, footer, .projects .proj {
    animation: none;
    opacity: 1;
  }
}
