/* ============================================================
   ΛTHENΛ — Library of Alexandria, re-indexed
   Holographic-antiquity UI. Brass + parchment on warm near-black.
   ============================================================ */

:root {
  --bg:        #07060a;
  --bg-2:      #0c0a12;
  --ink:       #f4ecda;   /* parchment text       */
  --ink-dim:   #d4c9ad;   /* body copy — kept high-contrast for readability */
  --brass:     #c9a24b;   /* canonical Athena gold */
  --brass-hi:  #f0d28a;
  --brass-lo:  #6e5a2c;
  --cyan:      #6fe0e8;   /* the "tech" accent     */
  --cyan-lo:   #2a6770;
  --cited:     #7fe6a8;
  --warn:      #f2c24e;
  --refuse:    #e08a82;

  /* per-chamber accent — set from JS on each room (default = atrium gold) */
  --accent:    #e8c77a;

  --plaque-bg: rgba(12, 11, 8, 0.62);
  --hair:      rgba(201, 162, 75, 0.34);
  --hair-soft: rgba(201, 162, 75, 0.16);

  --font-display: "Hanken Grotesk", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.18, 1);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body { position: fixed; inset: 0; }

#scene { position: fixed; inset: 0; z-index: 1; }
#scene canvas { display: block; }

/* ---------- atmosphere overlays ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

.fx-vignette {
  background:
    radial-gradient(130% 120% at 50% 38%, transparent 42%, rgba(0,0,0,0.62) 100%);
  mix-blend-mode: multiply;
}
/* readability scrim — darkens the side the text sits on so copy always has contrast */
.fx-readscrim {
  z-index: 12;
  background: linear-gradient(100deg,
    rgba(5,4,8,0.78) 0%, rgba(5,4,8,0.52) 24%, rgba(5,4,8,0.18) 50%, rgba(5,4,8,0) 66%);
}
.fx-scan {
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.16) 3px, rgba(0,0,0,0) 4px);
  opacity: 0.55; mix-blend-mode: overlay;
}
.fx-grain {
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#flash {
  z-index: 40; opacity: 0;
  background: radial-gradient(120% 100% at 50% 50%,
    rgba(245, 232, 200, 0.95) 0%, rgba(201, 162, 75, 0.7) 38%, rgba(8,7,4,0.96) 100%);
}

/* ============================================================
   LOADER
   ============================================================ */
#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1rem; background: var(--bg); color: var(--brass);
  transition: opacity 1s var(--ease);
}
#loader.gone { opacity: 0; pointer-events: none; }
.loader-mark {
  height: 88px; width: auto; display: block;
  filter: drop-shadow(0 0 20px rgba(232,199,122,0.55));
  animation: markIn 1.3s var(--ease) both;
}
@keyframes markIn {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to   { opacity: 1; transform: none; }
}
.loader-word {
  font-family: var(--font-display); font-weight: 700;
  letter-spacing: 0.18em; font-size: 1.6rem; padding-left: 0.18em; color: var(--brass-hi);
}
.loader-status {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.32em;
  text-transform: uppercase; color: var(--ink-dim);
}
.loader-bar {
  width: 190px; height: 1px; background: var(--hair-soft); overflow: hidden;
}
.loader-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, transparent, var(--brass-hi));
  box-shadow: 0 0 8px var(--brass);
}

/* ============================================================
   HUD CHROME
   ============================================================ */
.hud { position: fixed; z-index: 20; opacity: 0; transition: opacity 1.2s var(--ease) 0.3s; }
body.ready .hud { opacity: 1; }

.hud-top {
  top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem 2rem;
}
.brand {
  display: flex; align-items: center;
  background: none; border: 0; cursor: pointer; pointer-events: auto; padding: 0;
}
.brand-logo {
  height: 28px; width: auto; display: block; opacity: 0.92;
  filter: drop-shadow(0 1px 6px rgba(0,0,0,0.5));
  transition: opacity 0.3s var(--ease);
}
.brand:hover .brand-logo { opacity: 1; }

/* ---------- section nav (top-right) ---------- */
.nav {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end;
}
.nav-item {
  background: none; border: 0; cursor: pointer; pointer-events: auto;
  padding: 0.5rem 1rem; border-radius: 7px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  letter-spacing: -0.01em; color: var(--ink-dim);
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--accent); }
.nav-item.active:hover { background: none; }


/* ============================================================
   ROOM CONTENT — diegetic holographic plaques
   ============================================================ */
.stage {
  position: fixed; inset: 0; z-index: 15;
  display: flex; align-items: center;
  padding: 5rem clamp(1.9rem, 6vw, 7rem) 2rem;
  pointer-events: none;
}

.plaque {
  position: absolute;
  left: clamp(1.4rem, 5vw, 6rem);
  max-width: 680px;
  /* frosted-glass panel: blurs the 3D scene behind the text for readability */
  padding: 2.6rem 2.8rem;
  background: rgba(10, 9, 12, 0.42);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  opacity: 0; visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease), visibility 0s linear 0.8s;
}
.plaque.is-active {
  opacity: 1; visibility: visible;
  transform: translateY(0);
  transition: opacity 0.7s var(--ease) 0.05s, transform 0.8s var(--ease) 0.05s, visibility 0s;
  pointer-events: auto;
}
.plaque--hero { max-width: 720px; }
.plaque--wide { max-width: min(960px, 92vw); }

/* stagger children on reveal */
.plaque.is-active > * { animation: rise 0.8s var(--ease) backwards; }
.plaque.is-active > *:nth-child(1) { animation-delay: 0.12s; }
.plaque.is-active > *:nth-child(2) { animation-delay: 0.20s; }
.plaque.is-active > *:nth-child(3) { animation-delay: 0.30s; }
.plaque.is-active > *:nth-child(4) { animation-delay: 0.40s; }
.plaque.is-active > *:nth-child(5) { animation-delay: 0.50s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.kicker {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.34em;
  text-transform: uppercase; color: var(--accent);
  padding-bottom: 0.9rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color 0.6s var(--ease);
}
.kicker::before { content: "◆ "; opacity: 0.55; }

.plaque h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.3rem, 4.8vw, 3.7rem); line-height: 1.04;
  color: var(--ink); letter-spacing: -0.018em;
}
.plaque p {
  font-size: clamp(1.15rem, 1.55vw, 1.4rem); line-height: 1.5; font-weight: 400;
  color: var(--ink-dim); margin-top: 1.3rem; max-width: 44ch;
}
.plaque p b { color: var(--ink); font-weight: 600; }

/* ---------- hero ---------- */
.hero-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.9rem, 5.8vw, 4.6rem); line-height: 1.02;
  letter-spacing: -0.024em; color: var(--ink);
}
.hero-title em { color: var(--brass-hi); font-style: normal; }
.hero-sub {
  font-family: var(--font-body); font-size: clamp(1.5rem, 3.2vw, 2.4rem) !important;
  line-height: 1.18; color: var(--ink) !important; margin-top: 1.4rem !important;
  max-width: none !important;
}
.hero-sub em { color: var(--brass-hi); font-style: italic; }
.hero-body { max-width: 40ch; }

/* ---------- CTAs ---------- */
.cta {
  display: inline-flex; align-items: center; gap: 0.6rem;
  margin-top: 1.7rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; cursor: pointer; pointer-events: auto;
  padding: 0.95rem 1.7rem; color: var(--bg);
  background: linear-gradient(180deg, var(--brass-hi), var(--brass));
  border: 0; border-radius: 1px; text-decoration: none;
  box-shadow: 0 0 0 1px var(--brass), 0 0 26px rgba(201,162,75,0.3);
  transition: all 0.3s var(--ease);
  position: relative;
}
.cta:hover { box-shadow: 0 0 0 1px var(--brass-hi), 0 0 38px rgba(240,210,138,0.55); transform: translateY(-1px); }
.cta--major { padding: 1.1rem 2.2rem; font-size: 0.78rem; }
.cta--ghost {
  background: none; color: var(--brass);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.cta--ghost:hover { color: var(--brass-hi); box-shadow: inset 0 0 0 1px var(--brass); transform: translateY(-1px); }

/* ---------- hero actions: CTA + npx command ---------- */
.hero-actions { margin-top: 1.7rem; display: flex; flex-direction: column; gap: 0.95rem; align-items: flex-start; }
.hero-actions .cta { margin-top: 0; }

.cmd {
  display: inline-flex; align-items: center; gap: 0.65rem;
  font-family: var(--font-mono); font-size: 0.8rem;
  background: rgba(0,0,0,0.42); border: 1px solid var(--hair);
  color: var(--ink); padding: 0.7rem 0.85rem; border-radius: 5px;
  cursor: pointer; pointer-events: auto; transition: border-color 0.25s var(--ease);
}
.cmd:hover { border-color: var(--brass); }
.cmd-prompt { color: var(--brass); }
.cmd-text { color: var(--ink); letter-spacing: 0.01em; }
.cmd-copy {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-dim);
  border-left: 1px solid var(--hair-soft); padding-left: 0.65rem; margin-left: 0.2rem;
}
.cmd.copied { border-color: var(--cited); }
.cmd.copied .cmd-copy { color: var(--cited); }

/* ---------- request early access ---------- */
.access { margin-top: 1.6rem; }
.access-field { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.access-field input {
  flex: 1; min-width: 220px; border-radius: 5px;
  background: rgba(0,0,0,0.32); border: 1px solid var(--hair);
  padding: 0.9rem 1rem; color: var(--ink); font-family: var(--font-body); font-size: 1rem; outline: none;
}
.access-field input:focus { border-color: var(--brass); }
.access-field input::placeholder { color: var(--ink-dim); opacity: 0.6; }
.access-field .cta { margin-top: 0; white-space: nowrap; }
.access-note {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.08em;
  color: var(--ink-dim); margin-top: 0.8rem;
}
.access-note.err { color: var(--refuse); }
.access-done { font-size: 1.12rem; color: var(--cited); line-height: 1.5; }
.access-done b { color: var(--ink); }
.access-foot { font-size: 0.95rem !important; color: var(--ink-dim); margin-top: 1.5rem !important; }
.access-foot b { color: var(--ink); }
.inline-link { color: var(--brass); text-decoration: none; white-space: nowrap; }
.inline-link:hover { color: var(--brass-hi); }

/* ---------- ledger lists ---------- */
.ledger { list-style: none; margin-top: 1.6rem; display: flex; flex-direction: column; gap: 0.7rem; }
.ledger li {
  font-size: 1.28rem; color: var(--ink-dim); line-height: 1.3; font-weight: 500;
  padding-left: 1.2rem; border-left: 2px solid color-mix(in srgb, var(--accent) 38%, transparent);
  text-shadow: 0 1px 8px rgba(0,0,0,0.8);
}
.ledger li span {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent); display: inline-block;
  min-width: 8.5ch; margin-right: 0.5rem;
}

/* ---------- the Oracle ---------- */
.oracle { margin-top: 1.7rem; }
.oracle-field {
  display: flex; align-items: center; gap: 0.6rem; border-radius: 5px;
  background: rgba(0,0,0,0.32); border: 1px solid var(--hair);
  padding: 0.85rem 1rem;
  box-shadow: inset 0 0 22px rgba(0,0,0,0.4);
}
.oracle-field:focus-within { border-color: var(--brass); box-shadow: 0 0 30px rgba(201,162,75,0.22); }
.oracle-prompt { color: var(--brass); font-family: var(--font-mono); }
.oracle-field input {
  flex: 1; background: none; border: 0; outline: none;
  color: var(--ink); font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: 0.02em;
}
.oracle-field input::placeholder { color: var(--ink-dim); opacity: 0.6; }
.oracle-send {
  background: none; border: 1px solid var(--hair); color: var(--brass);
  width: 34px; height: 30px; cursor: pointer; border-radius: 1px; transition: all 0.25s var(--ease);
}
.oracle-send:hover { border-color: var(--brass); color: var(--brass-hi); }
.oracle-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }
.chip {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.06em;
  color: var(--ink-dim); background: none; border: 1px solid var(--hair-soft);
  padding: 0.42rem 0.7rem; cursor: pointer; border-radius: 1px; transition: all 0.25s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--hair); }

.oracle-answer {
  margin-top: 1rem; padding: 1rem 1.1rem;
  border-left: 2px solid var(--cited);
  background: linear-gradient(90deg, rgba(127,230,168,0.07), transparent);
}
.oracle-answer[data-state="refuse"] { border-left-color: var(--refuse); background: linear-gradient(90deg, rgba(224,138,130,0.08), transparent); }
.oracle-answer[data-state="warn"]   { border-left-color: var(--warn);   background: linear-gradient(90deg, rgba(242,194,78,0.08), transparent); }
.oracle-badge {
  font-family: var(--font-mono); font-size: 0.58rem; letter-spacing: 0.22em;
  text-transform: uppercase; margin-bottom: 0.55rem; display: inline-flex; align-items: center; gap: 0.4rem;
}
.oracle-text { font-size: 1.1rem !important; color: var(--ink) !important; margin-top: 0 !important; min-height: 1.4em; }
.oracle-text .caret { color: var(--brass); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.oracle-source {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em;
  color: var(--ink-dim); margin-top: 0.7rem;
}
.oracle-source b { color: var(--cyan); font-weight: 500; }

/* ---------- trust grid ---------- */
.trust-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-top: 1.8rem;
}
.trust-card {
  padding: 1.4rem 1.3rem;
  background: rgba(255,255,255,0.045); border: 1px solid var(--hair-soft);
  border-radius: 5px; position: relative; overflow: hidden;
}
.trust-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, currentColor); opacity: 0.05;
}
.trust-mark { font-size: 1.5rem; line-height: 1; margin-bottom: 0.7rem; }
.trust-card h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.18rem; color: var(--ink);
  letter-spacing: -0.01em; margin-bottom: 0.5rem;
}
.trust-card p { font-size: 1.02rem !important; margin-top: 0 !important; color: var(--ink-dim); line-height: 1.44; font-weight: 500; }
.trust--cited  { color: var(--cited);  border-top: 2px solid var(--cited); }
.trust--warn   { color: var(--warn);   border-top: 2px solid var(--warn); }
.trust--refuse { color: var(--refuse); border-top: 2px solid var(--refuse); }
.trust-card h3, .trust-card p { color: var(--ink); }
.trust-card .trust-mark { color: inherit; }

.archive-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }

.noscript {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--bg); color: var(--ink); font-family: var(--font-mono); padding: 2rem; text-align: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .nav { gap: 0.1rem; }
  .nav-item { font-size: 0.82rem; padding: 0.35rem 0.5rem; }
  .brand-logo { height: 22px; }
  .stage { padding: 5rem 1.2rem 1.4rem; align-items: flex-end; padding-bottom: 2rem; }
  .plaque { left: 1.2rem; right: 1.2rem; max-width: none; padding: 1.6rem 1.5rem; transform: translateY(22px); }
  .plaque.is-active { transform: none; }
  .trust-grid { grid-template-columns: 1fr; gap: 0.7rem; }
  .plaque--wide { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-scan, .fx-grain { display: none; }
}
