:root {
  --velvet: #0e0e0f;
  --obsidian: #09090a;
  --charcoal: #141417;
  --charcoal-soft: #17171a;
  --antique-gold: #ab8a4a;
  --antique-gold-soft: #7a6130;
  --muted-crimson: #6f2d34;
  --steel: #72777d;
  --warm-ivory: #e8dfcf;
  --text-soft: #c6bcab;
  --border: #6e5528;
  --panel-glass: rgba(19, 19, 21, 0.8);
  --site-max: 1120px;
  --ease-quiet: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-dramatic: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  font-family: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", serif;
  color: var(--warm-ivory);
  letter-spacing: 0.02em;
  background:
    radial-gradient(1200px 600px at 70% -10%, #261f13 0%, transparent 60%),
    radial-gradient(1100px 640px at -10% 20%, #1c1a16 0%, transparent 58%),
    linear-gradient(160deg, #121214 0%, #0e0e0f 44%, #080809 100%);
  background-attachment: fixed;
}

img {
  max-width: 100%;
}

/* ── Film grain overlay ─────────────────── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  background-image:
    radial-gradient(#ffffff12 0.7px, transparent 0.7px),
    radial-gradient(#00000024 0.7px, transparent 0.7px);
  background-size: 3px 3px, 4px 4px;
  background-position: 0 0, 1px 1px;
  mix-blend-mode: soft-light;
  animation: noiseShift 8s steps(4) infinite;
}

@keyframes noiseShift {
  0%   { background-position: 0 0, 1px 1px; }
  25%  { background-position: 1px 0, 0 1px; }
  50%  { background-position: 0 1px, 1px 0; }
  75%  { background-position: 1px 1px, 0 0; }
  100% { background-position: 0 0, 1px 1px; }
}

/* ── Cinematic border frame ─────────────── */
.frame {
  position: absolute;
  inset: 12px;
  min-height: calc(100% - 24px);
  border: 1px solid #4a3a1a;
  box-shadow:
    inset 0 0 0 1px #2d2414,
    inset 0 0 0 3px #14110b,
    0 0 0 1px #0f0d08;
  pointer-events: none;
  z-index: 1;
  animation: framePulse 6s ease-in-out infinite;
}

@keyframes framePulse {
  0%, 100% { border-color: #4a3a1a; }
  50%      { border-color: #5e4b24; }
}

/* ── Main layout ────────────────────────── */
.layout {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 40px), var(--site-max));
  margin: 0 auto;
  padding: 54px 0 76px;
}

/* ── Hero / heading ─────────────────────── */
.hero {
  text-align: center;
  margin-bottom: 32px;
}

.kicker {
  margin: 0;
  font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #a1998f;
  animation: fadeSlideIn 1s var(--ease-dramatic) both;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  line-height: 1;
}

h1 {
  margin-top: 10px;
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 600;
  color: #e7ddc8;
  text-shadow: 0 0 22px rgba(0, 0, 0, 0.8), 0 0 46px rgba(160, 124, 57, 0.1);
  background: linear-gradient(
    135deg,
    #e7ddc8 0%,
    #d4c49e 25%,
    #f0e6cc 50%,
    #c8b68a 75%,
    #e7ddc8 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 6s linear infinite, fadeSlideIn 1.2s var(--ease-dramatic) both;
  animation-delay: 0s, 0.15s;
}

@keyframes shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tagline {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 1.8vw, 1.18rem);
  font-style: italic;
  animation: fadeSlideIn 1.4s var(--ease-dramatic) both;
  animation-delay: 0.3s;
}

/* ── Stage card ─────────────────────────── */
.stage-card {
  position: relative;
  margin: 0 auto 30px;
  padding: 26px 16px 22px;
  border: 1px solid #655028;
  background:
    linear-gradient(180deg, rgba(24, 23, 21, 0.82), rgba(16, 16, 18, 0.9)),
    repeating-linear-gradient(90deg, #151515 0 2px, #141414 2px 4px);
  box-shadow:
    inset 0 0 0 1px #2c2212,
    inset 0 -40px 80px rgba(0, 0, 0, 0.45),
    0 22px 44px rgba(0, 0, 0, 0.45);
  animation: fadeSlideIn 1.6s var(--ease-dramatic) both;
  animation-delay: 0.45s;
}

.stage-card::before,
.stage-card::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--antique-gold);
  transition: border-color 300ms ease;
}

.stage-card:hover::before,
.stage-card:hover::after {
  border-color: #d4ad5a;
}

.stage-card::before {
  inset: 8px auto auto 8px;
  border-right: 0;
  border-bottom: 0;
}

.stage-card::after {
  inset: auto 8px 8px auto;
  border-left: 0;
  border-top: 0;
}

/* ── Nariani stage ──────────────────────── */
.nariani-stage {
  width: min(100%, 760px);
  min-height: 430px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.halo {
  position: absolute;
  width: clamp(260px, 42vw, 420px);
  height: clamp(260px, 42vw, 420px);
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(168, 135, 66, 0.18) 0%, rgba(97, 77, 39, 0.08) 45%, transparent 70%);
  filter: blur(2px);
  transform: translateY(-8px);
  animation: haloPulse 4s ease-in-out infinite;
}

@keyframes haloPulse {
  0%, 100% { opacity: 1; transform: translateY(-8px) scale(1); }
  50%      { opacity: 0.75; transform: translateY(-8px) scale(1.04); }
}

.ripple {
  width: clamp(300px, 48vw, 460px);
  height: clamp(112px, 18vw, 154px);
  background: radial-gradient(ellipse at center, rgba(28, 20, 13, 0.9) 0%, rgba(14, 14, 15, 0) 72%);
  filter: blur(11px);
  transform: translateY(112px) scale(1);
  opacity: 0.32;
  transition: opacity 280ms var(--ease-quiet), transform 340ms var(--ease-quiet);
}

/* ── Floating shadow (replaces ground) ──── */
.nariani-stage::after {
  content: "";
  position: absolute;
  bottom: 50px;
  width: clamp(200px, 36vw, 320px);
  height: 18px;
  background: radial-gradient(ellipse at center, rgba(171, 138, 74, 0.22) 0%, rgba(171, 138, 74, 0.06) 50%, transparent 80%);
  filter: blur(8px);
  animation: shadowBreathe 3s ease-in-out infinite;
}

@keyframes shadowBreathe {
  0%, 100% { transform: scaleX(1); opacity: 0.7; }
  50%      { transform: scaleX(1.12); opacity: 0.45; }
}

/* ── Ambient particles ──────────────────── */
.ambient-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-particles span {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(212, 173, 90, 0.5);
  border-radius: 50%;
  animation: particleFloat 8s linear infinite;
  opacity: 0;
}

.ambient-particles span:nth-child(1) { left: 15%; animation-delay: 0s; animation-duration: 7s; }
.ambient-particles span:nth-child(2) { left: 35%; animation-delay: 1.2s; animation-duration: 9s; }
.ambient-particles span:nth-child(3) { left: 55%; animation-delay: 2.8s; animation-duration: 6s; }
.ambient-particles span:nth-child(4) { left: 70%; animation-delay: 4s; animation-duration: 8s; }
.ambient-particles span:nth-child(5) { left: 85%; animation-delay: 1.6s; animation-duration: 10s; }
.ambient-particles span:nth-child(6) { left: 45%; animation-delay: 3.4s; animation-duration: 7.5s; }

@keyframes particleFloat {
  0%   { transform: translateY(100%) scale(0); opacity: 0; }
  10%  { opacity: 0.6; transform: translateY(80%) scale(1); }
  90%  { opacity: 0.3; }
  100% { transform: translateY(-20%) scale(0.5); opacity: 0; }
}

/* ── Sprite ─────────────────────────────── */
.sprite-shell {
  position: absolute;
  width: clamp(220px, 29vw, 286px);
  height: clamp(308px, 41vw, 396px);
  display: grid;
  place-items: center;
  transform-origin: center;
  transition: transform 240ms var(--ease-quiet);
}

.sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  user-select: none;
  pointer-events: none;
}

.layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 240ms var(--ease-quiet);
}

.layer.active {
  opacity: 1;
}

.eyes {
  position: absolute;
  top: 104px;
  width: 18px;
  height: 4px;
  opacity: 0;
  transition: opacity 200ms var(--ease-quiet), filter 220ms var(--ease-quiet);
  filter: drop-shadow(0 0 0 var(--muted-crimson));
  background:
    linear-gradient(to right, transparent 0, transparent 2px, #f4e8cf 2px, #f4e8cf 3px, transparent 3px, transparent 14px, #f4e8cf 14px, #f4e8cf 15px, transparent 15px),
    linear-gradient(to right, transparent 0, transparent 2px, #a32938 2px, #a32938 3px, transparent 3px, transparent 14px, #a32938 14px, #a32938 15px, transparent 15px);
}

/* ── Navigation links ───────────────────── */
.links {
  margin: 14px auto 20px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 34px;
  font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.links a,
.footer a {
  color: #c8c0b1;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 260ms ease, border-color 260ms ease, text-shadow 260ms ease;
}

.links a:hover,
.footer a:hover {
  color: #f0e5ce;
  border-color: rgba(171, 138, 74, 0.85);
  text-shadow: 0 0 12px rgba(171, 138, 74, 0.3);
}

.links a:focus-visible,
.footer a:focus-visible {
  outline: 1px solid rgba(171, 138, 74, 0.92);
  outline-offset: 3px;
}

/* ── Key map ────────────────────────────── */
.keymap {
  margin: 0;
  text-align: center;
  font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b2a89a;
}

.keymap kbd {
  display: inline-block;
  border: 1px solid rgba(171, 138, 74, 0.85);
  padding: 2px 8px;
  margin: 0 4px;
  border-radius: 3px;
  color: #e3d7c1;
  background: linear-gradient(180deg, #1d1a18, #121012);
  box-shadow: inset 0 0 0 1px #312613, 0 2px 0 #0a0908;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 120ms ease;
}

.keymap kbd:hover {
  border-color: #d4ad5a;
  box-shadow: inset 0 0 0 1px #312613, 0 2px 0 #0a0908, 0 0 8px rgba(171, 138, 74, 0.2);
}

.keymap span {
  color: #9f7c40;
  margin: 0 8px;
}

/* ── Posts / Panels ─────────────────────── */
.posts {
  display: grid;
  gap: 20px;
}

.panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(23, 23, 25, 0.94), rgba(15, 15, 16, 0.95)),
    linear-gradient(135deg, rgba(117, 88, 41, 0.05), transparent 45%);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 0 1px #2b2113, 0 10px 24px rgba(0, 0, 0, 0.35);
  padding: 22px 20px;
  overflow: hidden;
  /* scroll reveal */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--ease-dramatic), transform 600ms var(--ease-dramatic), box-shadow 300ms ease;
}

.panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.panel::before {
  inset: 4px;
  border: 1px dashed rgba(171, 138, 74, 0.58);
  opacity: 0.5;
  transition: opacity 300ms ease;
}

.panel:hover::before {
  opacity: 0.75;
}

.panel::after {
  inset: 0;
  opacity: 0;
  box-shadow: 0 0 4px rgba(212, 170, 92, 0.9), 0 0 12px rgba(212, 170, 92, 0.22);
  transition: opacity 220ms var(--ease-quiet);
}

.panel:hover::after {
  opacity: 0.7;
  animation: stitchGlow 1.8s linear infinite;
}

.panel:hover {
  box-shadow: inset 0 0 0 1px #2b2113, 0 14px 32px rgba(0, 0, 0, 0.45);
}

/* ── Meta labels ────────────────────────── */
.meta {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  color: #aba193;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  color: #e4d9c2;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.1rem;
  color: #ddd2bf;
}

.panel p {
  margin: 0;
  line-height: 1.6;
  color: var(--text-soft);
}

.manifesto p + p {
  margin-top: 14px;
}

/* ── Scroll manuscript ──────────────────── */
.scroll-manuscript {
  background:
    radial-gradient(circle at 14% 10%, rgba(177, 147, 85, 0.08), transparent 34%),
    linear-gradient(180deg, #171415 0%, #141214 100%);
}

.scroll-manuscript::before {
  inset: 6px;
  border: 1px solid rgba(171, 138, 74, 0.52);
}

.scroll-manuscript h2 {
  margin-bottom: 14px;
}

.scroll-manuscript p {
  font-size: clamp(1.02rem, 2vw, 1.14rem);
  line-height: 1.7;
  color: #d3c8b5;
}

/* ── Archive grid ───────────────────────── */
.archive-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brief {
  min-height: 150px;
  transition: transform 300ms var(--ease-quiet), box-shadow 300ms ease;
}

.brief:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 0 0 1px #2b2113, 0 16px 36px rgba(0, 0, 0, 0.5);
}

/* stagger reveal for archive cards */
.archive-grid .brief:nth-child(1) { transition-delay: 0s; }
.archive-grid .brief:nth-child(2) { transition-delay: 0.08s; }
.archive-grid .brief:nth-child(3) { transition-delay: 0.16s; }

/* ── Sprite interactions ────────────────── */
.sprite-shell.is-hovered {
  transform: translateY(-1px);
  animation: breathe 2.9s ease-in-out infinite;
}

.sprite-shell.is-hovered .eyes {
  opacity: 0.94;
  filter: drop-shadow(0 0 2px #e5c58a) drop-shadow(0 0 4px #8a2b3c);
}

.nariani-stage.is-hovered .ripple {
  opacity: 0.58;
  transform: translateY(112px) scale(1.06);
}

/* ── Footer ─────────────────────────────── */
.footer {
  margin-top: 36px;
  padding-top: 24px;
  text-align: center;
  font-family: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--antique-gold-soft), transparent);
}

/* ── Keyframe animations ────────────────── */
@keyframes stitchGlow {
  0%   { box-shadow: 0 0 2px rgba(164, 128, 61, 0.9), 0 0 8px rgba(164, 128, 61, 0.18); }
  50%  { box-shadow: 0 0 8px rgba(208, 172, 104, 0.95), 0 0 14px rgba(208, 172, 104, 0.24); }
  100% { box-shadow: 0 0 2px rgba(164, 128, 61, 0.9), 0 0 8px rgba(164, 128, 61, 0.18); }
}

@keyframes breathe {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-1px); }
}

/* ── Responsive: ≤980px ─────────────────── */
@media (max-width: 980px) {
  .layout {
    width: min(calc(100% - 32px), var(--site-max));
    padding-top: 34px;
  }

  .nariani-stage {
    min-height: 390px;
  }

  .nariani-stage::after {
    bottom: 42px;
  }

  .eyes {
    top: 96px;
  }

  .archive-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Responsive: ≤680px ─────────────────── */
@media (max-width: 680px) {
  .frame {
    inset: 8px;
  }

  .stage-card {
    padding: 16px 10px 16px;
  }

  .nariani-stage {
    min-height: 344px;
  }

  .nariani-stage::after {
    bottom: 32px;
    width: clamp(160px, 60vw, 260px);
  }

  .sprite-shell {
    width: clamp(184px, 54vw, 234px);
    height: clamp(258px, 76vw, 322px);
  }

  .eyes {
    top: 86px;
    transform: scale(0.92);
  }

  .keymap {
    line-height: 1.85;
  }

  .panel {
    padding: 17px 14px;
  }
}

/* ── Reduced motion ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .panel {
    opacity: 1;
    transform: none;
  }

  h1 {
    background: none;
    -webkit-text-fill-color: #e7ddc8;
  }
}
