/* ─── Fonts ────────────────────────────────────────────────── */

@font-face {
  font-family: 'Porphyry';
  src: url('Porphyry-Regular/Porphyry-Regular.woff') format('woff'),
       url('Porphyry-Regular/Porphyry-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Romie';
  src: url('Romie Regular/WEB/Romie-Regular.woff2') format('woff2'),
       url('Romie Regular/WEB/Romie-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ─── Reset & Base ─────────────────────────────────────────── */

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

:root {
  --bg: #0d0d0d;
  --fg: #f0ede8;
  --fg-dim: rgba(240, 237, 232, 0.28);
  --fg-mid: rgba(240, 237, 232, 0.55);
  --accent-color: 0, 0, 0;
  --transition-speed: 600ms;
  --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Cormorant Garamond', 'Georgia', serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: pointer;
  transition: background-color 1.6s ease;
}

/* subtle accent bleed — very dark tint of current project color */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 60% at 50% 50%,
    rgba(var(--accent-color), 0.07) 0%,
    transparent 70%
  );
  pointer-events: none;
  transition: background 1.6s ease;
  z-index: 0;
}

/* ─── Oracle Stage ─────────────────────────────────────────── */

#oracle {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  padding: 2rem;
}

#stage {
  text-align: center;
  max-width: 640px;
  width: 100%;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity var(--transition-speed) var(--transition-ease),
    transform var(--transition-speed) var(--transition-ease);
}

#stage.exiting {
  opacity: 0;
  transform: translateY(-18px);
}

#stage.entering {
  opacity: 0;
  transform: translateY(14px);
}

/* ─── Koan ─────────────────────────────────────────────────── */

#koan {
  font-family: 'Porphyry', 'Georgia', serif;
  font-size: clamp(0.9rem, 2.4vw, 1.35rem);
  font-weight: 400;
  font-style: normal;
  text-transform: uppercase;
  line-height: 1.8;
  letter-spacing: 0.20em;
  text-wrap: balance;
  color: var(--fg);
  margin-bottom: 2.5rem;
  transition: color var(--transition-speed) var(--transition-ease);
}

/* ─── Meta (glyph + title link) ────────────────────────────── */

#meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

#glyph {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--fg-mid);
  letter-spacing: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition-speed) var(--transition-ease);
}

#glyph.visible {
  opacity: 1;
}

#project-link {
  font-family: 'Porphyry', serif;
  font-size: 0.62rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mid);
  text-decoration: none;
  transition: color 280ms ease;
}

#project-link:hover {
  color: var(--fg);
}

/* prevent click propagation area on link */
#project-link::after {
  content: '\2197';
  font-family: 'Porphyry', serif;
  font-size: 0.7em;
  margin-left: 0.3em;
  opacity: 0;
  transition: opacity 280ms ease;
  vertical-align: baseline;
}

#project-link:hover::after {
  opacity: 0.6;
}

/* ─── Counter ──────────────────────────────────────────────── */

#counter {
  position: fixed;
  bottom: 1.8rem;
  right: 2rem;
  font-family: 'Romie', serif;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fg-dim);
  z-index: 2;
  transition: opacity 400ms ease;
  pointer-events: none;
  user-select: none;
}

/* ─── All Toggle ───────────────────────────────────────────── */

#all-toggle {
  position: fixed;
  bottom: 1.8rem;
  left: 2rem;
  font-family: 'Romie', serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fg-dim);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: 10;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
  transition: color 280ms ease;
}

#all-toggle:hover {
  color: var(--fg);
}

/* ─── All Panel ────────────────────────────────────────────── */

#all-panel {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.97);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 480ms var(--transition-ease);
}

#all-panel.open {
  opacity: 1;
  pointer-events: all;
}

#all-close {
  position: absolute;
  top: 1.8rem;
  right: 2rem;
  font-family: 'Romie', serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fg-dim);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 280ms ease;
  line-height: 1;
}

#all-close:hover {
  color: var(--fg);
}

#project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  width: 100%;
  max-width: 480px;
}

#project-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(240, 237, 232, 0.06);
  transition: border-color 280ms ease;
}

#project-list li:last-child {
  border-bottom: none;
}

#project-list li:hover {
  border-bottom-color: rgba(240, 237, 232, 0.14);
}

.list-glyph {
  font-size: 0.7rem;
  color: var(--fg-dim);
  flex-shrink: 0;
  line-height: 1.8;
  opacity: 0;
  transition: opacity 280ms ease;
}

.list-glyph.visible {
  opacity: 1;
}

.list-link {
  font-family: 'Porphyry', serif;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mid);
  text-decoration: none;
  transition: color 280ms ease;
  flex: 1;
}

.list-link:hover {
  color: var(--fg);
}

.list-koan {
  font-family: 'Romie', serif;
  font-size: 0.8rem;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  color: rgba(240, 237, 232, 0.32);
  flex: 2;
  transition: color 280ms ease;
  text-align: right;
}

#project-list li:hover .list-koan {
  color: rgba(240, 237, 232, 0.55);
}

/* ─── Hint ─────────────────────────────────────────────────── */

#hint {
  position: fixed;
  bottom: 1.8rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Romie', serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  color: var(--fg-dim);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 800ms ease;
  z-index: 2;
}

#hint.hidden {
  opacity: 0;
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 480px) {
  #koan {
    font-size: clamp(0.72rem, 3.6vw, 0.95rem);
  }

  .list-koan {
    display: none;
  }

  #project-list {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #stage,
  #all-panel,
  body::before,
  body {
    transition: none;
  }
}
