:root {
  --bg: #03040a;
  --text: #e8ecff;
  --muted: #8f98b8;
  --silver: #cfd7ff;
  --gold: #e8c978;
  --line: rgba(207, 215, 255, .16);
  --veil: rgba(3, 4, 10, .58);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(1.5rem, 5vw, 4rem);
  background:
    radial-gradient(circle at 48% 18%, rgba(232, 201, 120, .13), transparent 24%),
    radial-gradient(circle at 80% 70%, rgba(207, 215, 255, .09), transparent 30%),
    radial-gradient(circle at 18% 84%, rgba(119, 183, 255, .07), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 24%, rgba(255, 255, 255, .72), transparent),
    radial-gradient(1px 1px at 32% 76%, rgba(255, 255, 255, .48), transparent),
    radial-gradient(1px 1px at 54% 38%, rgba(255, 255, 255, .62), transparent),
    radial-gradient(1px 1px at 71% 18%, rgba(255, 255, 255, .42), transparent),
    radial-gradient(1px 1px at 88% 62%, rgba(255, 255, 255, .58), transparent);
  opacity: .32;
}

main {
  position: relative;
  width: min(1040px, 100%);
  margin: 0 auto;
}

a {
  color: var(--gold);
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  font-size: .72rem;
}

p a,
.subtitle a {
  color: var(--gold);
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: none;
  border-bottom: 1px solid rgba(232, 201, 120, .28);
}

p a:hover,
p a:focus,
.subtitle a:hover,
.subtitle a:focus {
  border-bottom-color: rgba(232, 201, 120, .72);
}

header {
  margin: 3rem 0 clamp(2.25rem, 6vw, 4rem);
}

h1 {
  margin: 0 0 .8rem;
  color: var(--gold);
  font-size: clamp(2.35rem, 7vw, 5.5rem);
  font-weight: 400;
  letter-spacing: .08em;
  line-height: 1;
}

.subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(.82rem, 2vw, 1rem);
  letter-spacing: .24em;
  line-height: 1.8;
  text-transform: uppercase;
}

.chamber-note {
  max-width: 720px;
  margin: 1.25rem 0 0;
  color: rgba(232, 236, 255, .74);
  font-size: clamp(1rem, 2.1vw, 1.18rem);
  line-height: 1.75;
}

.chamber-image {
  position: relative;
  overflow: hidden;
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  padding: .5rem;
  border: 1px solid rgba(207, 215, 255, .14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(207, 215, 255, .04), rgba(207, 215, 255, .012)),
    rgba(3, 4, 10, .42);
  box-shadow:
    0 0 30px rgba(0, 0, 0, .32),
    inset 0 0 18px rgba(207, 215, 255, .022);
}

.chamber-image::after {
  content: "";
  position: absolute;
  inset: .5rem;
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(3, 4, 10, .52), rgba(3, 4, 10, .12) 58%, rgba(3, 4, 10, .24)),
    linear-gradient(180deg, rgba(3, 4, 10, .04), rgba(3, 4, 10, .52));
  pointer-events: none;
}

.chamber-image img {
  display: block;
  width: 100%;
  height: min(58vh, 620px);
  object-fit: cover;
  object-position: center;
  border-radius: 5px;
}

.chamber-image .chamber-note {
  position: absolute;
  right: clamp(1.25rem, 5vw, 3.5rem);
  bottom: clamp(1.25rem, 5vw, 3rem);
  left: clamp(1.25rem, 5vw, 3.5rem);
  z-index: 1;
  max-width: 700px;
  margin: 0;
  color: rgba(245, 222, 168, .95);
  font-size: clamp(1.05rem, 2.2vw, 1.6rem);
  text-shadow:
    0 2px 18px rgba(3, 4, 10, .94),
    0 0 28px rgba(3, 4, 10, .7);
}

.chamber-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.artifact-card {
  min-height: 260px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(207, 215, 255, .055), rgba(207, 215, 255, .018)),
    var(--veil);
  box-shadow: 0 0 24px rgba(0, 0, 0, .26);
}

.artifact-link {
  display: block;
  color: inherit;
  font-size: inherit;
  letter-spacing: 0;
  text-transform: none;
  transition:
    border-color .25s ease,
    background .25s ease,
    transform .25s ease;
}

.artifact-link:hover,
.artifact-link:focus {
  border-color: rgba(232, 201, 120, .36);
  background:
    linear-gradient(180deg, rgba(232, 201, 120, .055), rgba(207, 215, 255, .02)),
    rgba(3, 4, 10, .64);
  transform: translateY(-2px);
}

.artifact-card::before {
  content: "";
  display: block;
  width: 2.6rem;
  height: 1px;
  margin-bottom: 1.45rem;
  background: linear-gradient(90deg, var(--gold), transparent);
}

h2 {
  margin: 0 0 1.35rem;
  color: var(--silver);
  font-size: clamp(1.16rem, 2.5vw, 1.5rem);
  font-weight: 400;
  letter-spacing: .12em;
}

h3 {
  margin: 0 0 .75rem;
  color: var(--silver);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
}

p {
  margin: 0 0 .9rem;
  color: rgba(232, 236, 255, .84);
  font-size: 1.05rem;
  line-height: 1.65;
}

p:last-child {
  margin-bottom: 0;
}

.gold {
  color: var(--gold);
}

.status {
  display: inline-block;
  margin-bottom: 1.1rem;
  color: var(--gold);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.section {
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.closing-line {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  color: var(--gold);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  letter-spacing: .08em;
}

.leaf-record {
  width: min(760px, 100%);
}

.record-image {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  padding: .5rem;
  border: 1px solid rgba(207, 215, 255, .14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(207, 215, 255, .045), rgba(207, 215, 255, .014)),
    rgba(3, 4, 10, .42);
  box-shadow:
    0 0 28px rgba(0, 0, 0, .3),
    inset 0 0 18px rgba(207, 215, 255, .025);
}

.record-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
}

.leaf-section {
  margin-top: clamp(2rem, 5vw, 3.25rem);
  padding-top: clamp(1.5rem, 4vw, 2.25rem);
  border-top: 1px solid rgba(207, 215, 255, .12);
}

.leaf-section h2 {
  margin-bottom: 1rem;
}

.guide-note { color: var(--muted); font-size: .92rem; line-height: 1.7; }
.turn-sequence { margin: 1.8rem 0; padding-left: 1.7rem; }
.turn-sequence li { padding: .4rem 0 1.1rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.turn-sequence li::marker { color: var(--gold); font-size: 1.2rem; }
.turn-sequence h3 { line-height: 1.5; letter-spacing: .08em; }
.guide-question { margin: 1.5rem 0; border-left: 2px solid var(--gold); padding: .2rem 1rem; }
.guide-question summary { cursor: pointer; color: var(--gold); padding: .75rem 0; line-height: 1.6; }
.guide-question p { margin-top: .75rem; }
.rule-table-scroll { overflow-x: auto; margin: 1.5rem 0; }
.rule-table { width: 100%; min-width: 620px; border-collapse: collapse; line-height: 1.65; font-size: 1rem; }
.rule-table caption { text-align: left; color: var(--muted); padding: 0 0 1rem; }
.rule-table th, .rule-table td { padding: 1rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rule-table thead { color: var(--gold); background: rgba(232, 201, 120, .04); }
.rule-table tbody th { color: var(--silver); font-weight: 400; }
.recovery-paths { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.recovery-paths a { padding: 1rem; border: 1px solid var(--line); border-radius: 4px; line-height: 1.5; }

.record-list {
  display: grid;
  gap: .65rem;
  margin: 1.4rem 0;
  padding: 0;
}

.record-list div {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1rem;
  padding: .7rem 0;
  border-top: 1px solid rgba(207, 215, 255, .1);
}

.record-list div:last-child {
  border-bottom: 1px solid rgba(207, 215, 255, .1);
}

.record-list dt {
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.record-list dd {
  margin: 0;
  color: var(--silver);
}

.canonical-line {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  color: var(--gold);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  line-height: 1.7;
  letter-spacing: .08em;
}

.record-footer {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid rgba(207, 215, 255, .12);
}

.record-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin: 0;
}

.record-meta div {
  min-width: 0;
}

.record-meta dt {
  margin: 0 0 .35rem;
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.record-meta dd {
  margin: 0;
  color: var(--silver);
  font-size: .9rem;
  line-height: 1.4;
}

.whisper-record {
  padding-top: clamp(1.5rem, 4vw, 2.25rem);
  border-top: 1px solid rgba(207, 215, 255, .12);
}

.whisper-source {
  margin-bottom: 1.35rem;
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .18em;
  line-height: 1.8;
  text-transform: uppercase;
}

.whisper-line {
  min-height: 3.4em;
  color: rgba(207, 215, 255, .9);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-style: italic;
  letter-spacing: .08em;
  text-shadow: 0 0 16px rgba(192, 132, 255, .2);
  transition: opacity .36s ease, transform .36s ease;
}

.whisper-line.is-changing {
  opacity: 0;
  transform: translateY(4px);
}

.loom-card {
  position: relative;
  min-height: 132px;
  display: block;
  padding: 1rem;
  border: 1px solid rgba(207, 215, 255, .12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(207, 215, 255, .04), rgba(207, 215, 255, .012)),
    rgba(3, 4, 10, .42);
  box-shadow: 0 0 18px rgba(0, 0, 0, .18);
  opacity: 0;
  transform: translateY(4px);
  transition:
    border-color .25s ease,
    background .25s ease,
    opacity .7s ease,
    transform .7s ease;
}

.loom-card::before {
  content: "";
  position: absolute;
  top: 1.35rem;
  left: -1.45rem;
  width: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 201, 120, .52));
  opacity: 0;
  transition: width .9s ease var(--loom-thread-delay, 0ms), opacity .9s ease var(--loom-thread-delay, 0ms);
}

.loom-card.is-woven {
  opacity: 1;
  transform: translateY(0);
}

.loom-card.is-woven::before {
  width: 1.15rem;
  opacity: .72;
}

.loom-card:hover,
.loom-card:focus {
  border-color: rgba(232, 201, 120, .38);
  background:
    linear-gradient(180deg, rgba(232, 201, 120, .06), rgba(207, 215, 255, .018)),
    rgba(3, 4, 10, .56);
  transform: translateY(-2px);
}

.loom-card strong {
  display: block;
  color: var(--silver);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: .12em;
  line-height: 1.4;
}

.loom-type {
  display: block;
  margin-top: .75rem;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.loom-empty {
  color: var(--muted);
  font-style: italic;
}

.compact-page {
  padding: 0;
}

.compact-page::before {
  display: none;
}

.compact-page main {
  width: 100%;
}

.compact-hero {
  position: relative;
  min-height: 94svh;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: clamp(1.25rem, 4vw, 3rem);
  isolation: isolate;
}

.compact-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(3, 4, 10, .2), rgba(3, 4, 10, .06) 42%, rgba(3, 4, 10, .26)),
    linear-gradient(180deg, rgba(3, 4, 10, .04), rgba(3, 4, 10, .18) 74%, var(--bg));
  pointer-events: none;
}

.compact-hero img,
.compact-hero video {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.compact-hero-video {
  pointer-events: none;
}

.compact-hero-video[hidden] {
  display: none;
}

.compact-return {
  position: absolute;
  top: clamp(1.25rem, 3vw, 2.25rem);
  left: clamp(1.25rem, 3vw, 2.25rem);
  color: rgba(232, 201, 120, .84);
  text-shadow: 0 0 18px rgba(3, 4, 10, .86);
}

.compact-hero-text {
  width: min(560px, 44vw);
  margin-left: clamp(44vw, 50vw, 56vw);
  margin-top: clamp(3rem, 12vh, 8rem);
  color: var(--gold);
  text-shadow:
    0 2px 18px rgba(3, 4, 10, .92),
    0 0 28px rgba(3, 4, 10, .62);
}

.compact-hero-text h1 {
  margin-bottom: 1.25rem;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 1.04;
}

.compact-hero-text p {
  margin: 0 0 .45rem;
  color: rgba(245, 222, 168, .94);
  font-size: clamp(1.05rem, 2vw, 1.55rem);
  letter-spacing: .08em;
  line-height: 1.55;
}

.compact-reveal,
.recognized-text {
  opacity: 0;
  animation: compactRecognize 1.25s ease forwards;
  animation-delay: 1s;
}

.compact-content {
  width: min(760px, calc(100% - clamp(3rem, 10vw, 8rem)));
  margin-right: auto;
  margin-left: auto;
}

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

@media (prefers-reduced-motion: reduce) {
  .compact-reveal,
  .recognized-text {
    opacity: 1;
    animation: none;
  }
}

@media (max-width: 980px) {
  .pillar-grid,
  .chamber-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-hero-text {
    width: min(520px, calc(100% - 34vw));
    margin-left: clamp(18vw, 34vw, 42vw);
  }
}

@media (max-width: 680px) {
  .pillar-grid,
  .chamber-grid {
    grid-template-columns: 1fr;
  }

  .artifact-card {
    min-height: auto;
  }

  .record-meta {
    grid-template-columns: 1fr;
  }

  .record-list div {
    grid-template-columns: 1fr;
    gap: .25rem;
  }

  .compact-hero {
    min-height: 92svh;
    align-items: end;
    padding-bottom: clamp(4rem, 14vh, 7rem);
  }

  .compact-hero img,
  .compact-hero video {
    object-position: 34% center;
  }

  .compact-hero-text {
    width: min(100%, 24rem);
    margin: 0;
  }

  .compact-hero-text h1 {
    font-size: clamp(2rem, 12vw, 3.4rem);
  }

  .compact-hero-text p {
    font-size: .98rem;
    letter-spacing: .06em;
  }

  .chamber-image img {
    height: min(48vh, 420px);
  }

  .chamber-image .chamber-note {
    font-size: 1rem;
    line-height: 1.6;
  }

  .compact-content {
    width: min(100% - 2.5rem, 760px);
  }
}
