/* ============================================================================
   THE THRESHOLD — page surfaces: the Gate facade, the Rite, the Treasury.
   Density gradient (§13.D): loudest at the facade, quietest at the rite.
   ========================================================================= */

/* ==================== THE GATE (facade) ==================== */
.facade {
  position: relative;
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2vh 0 6vh;
}
.facade .crest-crown {
  margin: 1.5vh 0 0.5vh;
  color: var(--gold-burnished);
}
.facade .crest-crown svg {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 0 16px rgba(232, 147, 58, 0.35));
}
.title-mark {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-burnished);
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1;
  margin: 0.4rem 0 0;
  text-shadow: 0 0 30px rgba(232, 147, 58, 0.25);
}
.title-epithet {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-aged);
  font-size: clamp(0.6rem, 1.4vw, 0.86rem);
  margin: 0.9rem 0 0;
}

/* THE DOORWAY (S1 CSS-built arch + war-crop) is RETIRED in S1b — the painted
   plate carries it (see css/plates.css .facade). The .title-mark / .title-epithet
   base rules below are reused by the plate's live overlay. */
.scroll-cue {
  margin-top: 3vh;
  color: var(--gold-aged);
  animation: lampBreath 5s ease-in-out infinite;
}
.scroll-cue svg {
  width: 14px;
  height: 14px;
}

/* ==================== THE GAME / COLLECTION flanking + faction band ==================== */
.band-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5vh;
  align-items: start;
}
@media (min-width: 900px) {
  .band-grid {
    grid-template-columns: 0.9fr 2.2fr 0.9fr;
    gap: 3vw;
  }
}
.pillar h3 {
  font-family: var(--display);
  letter-spacing: var(--track-display);
  text-transform: uppercase;
  color: var(--gold-burnished);
  font-size: 1.05rem;
  margin: 0 0 1.2rem;
  text-align: center;
}
.pillar-item {
  margin: 0 0 1.3rem;
}
.pillar-item .k {
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-burnished);
  font-size: 0.82rem;
}
.pillar-item .v {
  font-family: var(--text);
  color: var(--gold-burnished);
  opacity: 0.9; /* raised for legibility (§ owner ruling 6b) */
  font-size: 0.92rem;
  margin-top: 0.2rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* FOUR FACTIONS band — carved badges on bare stone (§ owner ruling, S1e).
   The ground-color panels retire: each badge carries its own gold-framed field;
   they sit on the stone with generous dark between. */
.faction-head {
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-burnished);
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  margin: 0 0 2.8rem;
}
.factions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.4rem 2rem;
}
@media (min-width: 720px) {
  .factions {
    grid-template-columns: repeat(4, 1fr);
    gap: 2.6rem;
  }
}
.faction {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* the carved badge — its own ground; sits ON the stone, no panel behind it */
.faction .badge {
  display: block;
  width: auto;
  height: clamp(180px, 24vw, 230px);
  margin: 0 auto 1rem;
  filter: drop-shadow(0 5px 16px rgba(0, 0, 0, 0.55));
}
.faction .fep {
  font-family: var(--text);
  color: var(--gold-burnished);
  opacity: 0.9;
  font-size: 0.78rem;
  margin: 0 0 1rem;
  min-height: 2.4em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.faction .explore {
  font-family: var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.62rem;
  color: var(--gold-aged);
  border: 1px solid var(--gold-aged);
  border-radius: 1px;
  padding: 0.4rem 1rem;
  background: transparent;
  cursor: not-allowed;
}
/* S6: the four faction Explore buttons are now LIVE links into the card showcase */
.faction a.explore {
  color: var(--gold-burnished);
  border-color: var(--gold-hairline);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--wake), border-color var(--wake);
}
.faction a.explore:hover {
  color: var(--flame-core);
  border-color: var(--flame-core);
}

/* ==================== JOIN THE SAGA (dormant, §14.1) ==================== */
.saga {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: center;
  text-align: center;
}
@media (min-width: 760px) {
  .saga {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
}
.saga .field {
  display: flex;
  gap: 0.6rem;
  max-width: 420px;
}
.saga input {
  flex: 1;
  background: rgba(11, 10, 8, 0.7);
  border: 1px solid var(--gold-aged);
  border-radius: 1px;
  color: var(--gold-aged);
  font-family: var(--text);
  padding: 0.6rem 0.8rem;
}
.saga input::placeholder {
  color: var(--gold-aged);
  opacity: 0.7;
}
.saga .dormant-note {
  font-family: var(--text);
  font-size: 0.7rem;
  color: var(--gold-aged);
  margin-top: 0.5rem;
  letter-spacing: 0.04em;
}

/* ==================== THE RITE (§8.3 — quieter register, §13.D) ==================== */
.rite-stage {
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 2rem;
  padding: 8vh 0;
}
.rite-mark {
  width: 132px;
  height: 132px;
  color: var(--gold-aged);
  transition: color 600ms ease, filter 600ms ease;
}
.rite-mark.burning {
  color: var(--gold-burnished);
  filter: drop-shadow(0 0 22px rgba(232, 147, 58, 0.5));
}
/* the ONE vermilion thread — drawn across the lintel on claim confirm */
.rite-thread {
  width: min(420px, 70vw);
  height: 2px;
  position: relative;
  overflow: hidden;
}
.rite-thread i {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, transparent, var(--vermilion), var(--flame-halo), transparent);
}
.rite-thread.drawn i {
  animation: threadDraw 1400ms ease forwards;
}
@keyframes threadDraw {
  to {
    transform: scaleX(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rite-thread.drawn i {
    animation: none;
    transform: scaleX(1);
  }
}
.rite-state-msg {
  font-family: var(--text);
  color: var(--gold-burnished);
  opacity: 0.85;
  max-width: 40ch;
}

/* ==================== THE TREASURY (§8.5 — the one dense hall) ==================== */
.chambers {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 4vh;
}
.chamber-gem {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--gold-aged);
  background: var(--cg, #241e15);
  cursor: pointer;
  transition: box-shadow var(--wake) ease, border-color var(--wake) ease;
  color: var(--gold-burnished);
  display: grid;
  place-items: center;
}
.chamber-gem[data-f="devas"] {
  --cg: #3a2a10;
}
.chamber-gem[data-f="asuras"] {
  --cg: #3a130c;
}
.chamber-gem[data-f="vanaras"] {
  --cg: #0f2a20;
}
.chamber-gem[data-f="nagas"] {
  --cg: #0c1826;
}
.chamber-gem[aria-pressed="true"],
.chamber-gem:hover,
.chamber-gem:focus-visible {
  border-color: var(--gold-burnished);
  box-shadow: 0 0 16px rgba(232, 147, 58, 0.35);
}
.chamber-gem svg {
  width: 22px;
  height: 22px;
}

.hall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2.4rem 1.6rem;
}
.plinth {
  text-align: center;
}
.plinth .frame {
  aspect-ratio: 5 / 7;
  border: 1px solid var(--gold-hairline);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--stone-relief), var(--stone-void));
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.plinth .frame .placeholder {
  padding: 0.8rem;
  color: var(--gold-aged);
}
.plinth .frame .placeholder svg {
  width: 30px;
  height: 30px;
  margin: 0 auto 0.5rem;
}
.plinth .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.plinth .stand {
  height: 8px;
  margin-top: 6px;
  background: linear-gradient(180deg, var(--gold-aged), transparent);
  opacity: 0.5;
}
.plinth .pname {
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-burnished);
  margin-top: 0.7rem;
}
.plinth .pep {
  font-family: var(--text);
  font-size: 0.66rem;
  color: var(--gold-aged);
  margin-top: 0.15rem;
}
.plinth .chain-link {
  font-family: var(--text);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--gold-aged);
  border-bottom: 1px solid transparent;
  margin-top: 0.4rem;
  display: inline-block;
}
.plinth .chain-link:hover,
.plinth .chain-link:focus-visible {
  color: var(--gold-burnished);
  border-bottom-color: var(--gold-hairline);
}

/* selecting a chamber warms the hall ambient toward that ground (§8.5) */
#tre-hall {
  transition: box-shadow 600ms ease;
  border-radius: 2px;
  padding: 2vh 0;
}
body[data-chamber="devas"] #tre-hall {
  box-shadow: inset 0 0 220px 40px rgba(180, 118, 43, 0.1);
}
body[data-chamber="asuras"] #tre-hall {
  box-shadow: inset 0 0 220px 40px rgba(142, 47, 27, 0.12);
}
body[data-chamber="vanaras"] #tre-hall {
  box-shadow: inset 0 0 220px 40px rgba(31, 92, 70, 0.12);
}
body[data-chamber="nagas"] #tre-hall {
  box-shadow: inset 0 0 220px 40px rgba(20, 39, 61, 0.14);
}

.hall-empty {
  text-align: center;
  padding: 6vh 0;
}
.hall-empty .empty-plinth {
  width: 130px;
  aspect-ratio: 5 / 7;
  margin: 0 auto 1.6rem;
  border: 1px solid var(--gold-hairline);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--stone-lit), var(--stone-void));
  box-shadow: 0 0 40px rgba(232, 147, 58, 0.14);
}

/* ---- footer ---- */
.gate-foot {
  border-top: 1px solid var(--gold-hairline);
  padding: 6vh 0 8vh;
  color: var(--gold-aged);
  font-family: var(--text);
  text-align: center;
}
.gate-foot .line {
  color: var(--gold-burnished);
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ---- status/toast-free messaging: a quiet stone line under a button ---- */
.state-line {
  font-family: var(--text);
  font-size: 0.8rem;
  color: var(--gold-aged);
  margin-top: 0.9rem;
  min-height: 1.2em;
  letter-spacing: 0.03em;
}
.state-line a {
  color: var(--gold-burnished);
  border-bottom: 1px solid var(--gold-hairline);
}

/* ============================================================================
   S1g — MOBILE MASTER SECTIONS: dual-CTA doorway, three card scenes, the footer.
   Mid-register: quieter than the facade, warmer than the rite page.
   ========================================================================= */

/* -------------------- THE DUAL-CTA DOORWAY (mobile master §2) -------------------- */
.doorway {
  position: relative;
  overflow: hidden;
  padding: 9vh 0;
}
.doorway-plate {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.doorway-plate img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}
/* readability veil over the busy scene — radial, never a box */
.doorway::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(7, 6, 4, 0.82) 0%, rgba(7, 6, 4, 0.18) 26%, rgba(7, 6, 4, 0) 42%, rgba(7, 6, 4, 0) 58%, rgba(7, 6, 4, 0.18) 74%, rgba(7, 6, 4, 0.82) 100%),
    linear-gradient(180deg, rgba(7, 6, 4, 0.5), rgba(7, 6, 4, 0.2) 30%, rgba(7, 6, 4, 0.2) 70%, rgba(7, 6, 4, 0.55));
}
/* the painted braziers (rite_plate x8%/x92%, y78%) come alive */
.doorway-lamps {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(150px 150px at 8% 80%, rgba(255, 201, 107, 0.42), transparent 62%),
    radial-gradient(150px 150px at 92% 80%, rgba(255, 201, 107, 0.42), transparent 62%);
  animation: lampBreath 5.4s ease-in-out infinite;
}
.doorway-cols {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3vw;
  align-items: center;
  min-height: 44vh;
}
.doorway-col {
  text-align: center;
  padding: 0 1.5vw;
}
.doorway-title {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold-burnished);
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  line-height: 1.1;
  margin: 0 0 1rem;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.95);
}
.doorway-copy {
  font-family: var(--text);
  color: var(--gold-burnished);
  opacity: 0.92;
  max-width: 30ch;
  margin: 0 auto 1.6rem;
  font-size: clamp(0.88rem, 1.4vw, 1rem);
  line-height: 1.6;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.95);
}
@media (max-width: 719px) {
  .doorway-cols {
    grid-template-columns: 1fr;
    gap: 5vh;
    min-height: 0;
  }
  .doorway::after {
    background: linear-gradient(180deg, rgba(7, 6, 4, 0.68), rgba(7, 6, 4, 0.5) 40%, rgba(7, 6, 4, 0.5) 60%, rgba(7, 6, 4, 0.72));
  }
}

/* -------------------- THE THREE CARD SCENES (mobile master §4) -------------------- */
.scene-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4vh;
}
@media (min-width: 760px) {
  .scene-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 2vw;
  }
}
.scene-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* carved hairline-gold frame around the plate */
.scene-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--gold-hairline);
  border-radius: 2px;
  padding: 4px;
  background: rgba(4, 3, 1, 0.6);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}
.scene-frame::after {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold-hairline) 45%, transparent);
  border-radius: 1px;
}
.scene-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1px;
}
.scene-title {
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-burnished);
  font-size: 1.15rem;
  margin: 1.2rem 0 0.5rem;
}
.scene-copy {
  font-family: var(--text);
  color: var(--gold-burnished);
  opacity: 0.9;
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 32ch;
  margin: 0 auto 1.2rem;
  min-height: 3.6em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

/* -------------------- THE FOOTER (mobile master §5) -------------------- */
.site-foot {
  border-top: 1px solid var(--gold-hairline);
  background: linear-gradient(180deg, rgba(11, 10, 8, 0.4), var(--stone-void));
  padding: 6vh 0 5vh;
  margin-top: 4vh;
}
.foot-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1.4fr;
  gap: 2.4rem;
  align-items: start;
}
.foot-brand .foot-logo {
  display: block;
  width: 132px;
  height: auto;
}
.foot-tag {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--gold-burnished);
  font-size: 0.95rem;
  line-height: 1;
  margin: 0.8rem 0 0;
}
.foot-tag small {
  display: block;
  font-size: 0.48rem;
  letter-spacing: 0.28em;
  color: var(--gold-aged);
  margin-top: 5px;
}
.foot-icons {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.1rem;
}
.foot-icons .soc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--gold-aged);
  border-radius: 50%;
  color: var(--gold-aged);
}
.foot-icons .soc svg {
  width: 16px;
  height: 16px;
}
.foot-col h4 {
  font-family: var(--display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-burnished);
  margin: 0 0 1rem;
}
.foot-col a,
.foot-col .foot-link,
.foot-col .foot-soc {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--text);
  font-size: 0.82rem;
  color: var(--gold-burnished);
  opacity: 0.86;
  padding: 0.28rem 0;
  transition: color var(--wake) ease, opacity var(--wake) ease;
}
.foot-col a:hover,
.foot-col a:focus-visible {
  color: var(--flame-core);
  opacity: 1;
  text-shadow: 0 0 10px rgba(232, 147, 58, 0.5);
}
.foot-col .foot-soc svg {
  width: 15px;
  height: 15px;
}
/* sleeping (honest, non-clickable): aged gold, no pointer */
.foot-col .sleeping,
.foot-icons .sleeping {
  color: var(--gold-aged);
  opacity: 0.7;
  cursor: default;
}
.foot-col .foot-soc.sleeping svg {
  color: var(--gold-aged);
}
.foot-plaque {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  justify-content: center;
  text-align: left;
  padding: 1rem 1.2rem;
  border: 1px solid var(--gold-hairline);
  border-radius: 2px;
  background: rgba(4, 3, 1, 0.35);
}
.foot-plaque .foot-flame {
  flex: none;
  width: 22px;
  height: 28px;
  color: var(--flame-core);
  filter: drop-shadow(0 0 12px var(--flame-halo));
}
.foot-plaque p {
  font-family: var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--gold-burnished);
  margin: 0;
}
@media (max-width: 899px) {
  .foot-top {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 1.6rem;
  }
  .foot-brand {
    grid-column: 1 / -1;
  }
  .foot-plaque {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
@media (max-width: 520px) {
  .foot-top {
    grid-template-columns: 1fr;
  }
}
