/* Autumn Portals · fact chambers — same world, another room. */

:root {
  --ink: #0d0906;
  --gold: #d4a94e;
  --gold-bright: #eccf8a;
  --parchment: #f3e7cb;
  --parchment-dim: #cdbb96;
  --halo: 236, 207, 138;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Jost", "Avenir Next", "Helvetica Neue", sans-serif;
  --font-h1: "Shanghai Modeng", "上海摩登", "ZCOOL XiaoWei", "Cormorant Garamond", serif;
  --font-h2: "Ma Shan Zheng", "Cormorant Garamond", serif;
  --font-body: "Jost", "Avenir Next", "Helvetica Neue", sans-serif;
}

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

html { background: var(--ink); }
body {
  min-height: 100vh;
  color: var(--parchment);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(212, 169, 78, .35); }
a { color: inherit; text-decoration: none; }

/* —— chamber backdrop ———————————————————— */

.backdrop, .backdrop::after {
  position: fixed; inset: 0;
  z-index: -3;
}
.backdrop {
  background-size: cover;
  background-position: center;
}
.backdrop::after {
  content: "";
  background:
    linear-gradient(102deg, rgba(13, 9, 6, .88) 0%, rgba(13, 9, 6, .55) 46%, rgba(13, 9, 6, .32) 100%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 52%, rgba(6, 3, 1, .6) 100%);
}
body.fossil    .backdrop { background-image: url("../assets/img/bg-fossil.jpg"); }
body.survivors .backdrop { background-image: url("../assets/img/bg-survivors.jpg"); }
body.golden    .backdrop { background-image: url("../assets/img/bg-golden.jpg"); }

/* the old tree stands behind everything, as a soft memory */
.tree-ghost {
  position: fixed;
  right: -10vw; bottom: -8vh;
  width: 72vw; min-width: 640px;
  aspect-ratio: 1600 / 1000;
  background: url("../assets/img/tree-ghost.svg") center / contain no-repeat;
  opacity: .5;
  animation: ghostBreath 11s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
  /* the crown is wide enough to reach under the text column — dissolve its left
     side rather than narrowing it, which would shrink the tree at small widths */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .5) 18%, #000 38%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .5) 18%, #000 38%);
}
body.survivors .tree-ghost { filter: hue-rotate(-16deg) brightness(.92); }
body.golden    .tree-ghost { filter: hue-rotate(4deg) brightness(1.08); }
@keyframes ghostBreath {
  0%, 100% { opacity: .42; transform: scale(1); }
  50%      { opacity: .62; transform: scale(1.012); }
}

/* the one glow language, shared with the Enter button and the grove's lanterns */
@keyframes haloBreath {
  0%, 100% { opacity: .35; transform: scale(.94); }
  50%      { opacity: 1;   transform: scale(1.06); }
}

#grain {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 50;
  opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— chrome ————————————————————————————————— */

/* The rail is fixed while the scroll runs under it, so without this the copy is
   read straight through "AUTUMN PORTALS". Paints above main (z-index auto) and
   below the rail itself (z-index 10). */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 168px;
  background: linear-gradient(180deg,
    rgba(13, 9, 6, .94) 0%,
    rgba(13, 9, 6, .74) 42%,
    rgba(13, 9, 6, .34) 74%,
    transparent 100%);
  pointer-events: none;
  z-index: 9;
}

.brand {
  position: fixed; top: 34px; left: 42px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; letter-spacing: .18em; text-transform: uppercase;
  z-index: 10;
}
.brand .ring {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid var(--gold);
  box-shadow: 0 0 12px rgba(var(--halo), .5);
}
.page-label {
  position: fixed; top: 38px; right: 44px;
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--parchment-dim);
  z-index: 10;
}
.back-link {
  position: fixed; top: 92px; left: 42px;
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--parchment-dim);
  transition: color .4s;
  z-index: 10;
}
.back-link:hover { color: var(--gold-bright); }
.back-link .arrow { font-family: var(--serif); font-size: 16px; }
.hanzi {
  position: fixed; top: 50%; right: 40px;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-h2);
  font-size: 18px; letter-spacing: .9em;
  color: rgba(212, 169, 78, .5);
  user-select: none;
  z-index: 5;
}

/* —— the scroll of facts ———————————————————— */

main {
  max-width: 780px;
  padding: 21vh 6vw 16vh calc(6vw + 20px);
}

.eyebrow {
  display: flex; align-items: center; gap: 16px;
  font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 3vh;
}
.eyebrow::before {
  content: "";
  width: 44px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}

h1 {
  font-family: var(--font-h1);
  font-weight: 400;
  font-size: clamp(44px, 5.4vw, 74px);
  line-height: 1.08;
}
h1 em { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--gold-bright); }

.lede {
  margin-top: 3.4vh;
  max-width: 560px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.5;
  color: var(--parchment-dim);
}

.facts { margin-top: 9vh; display: grid; gap: 7.5vh; }

.fact { position: relative; padding-left: 74px; max-width: 620px; }
.fact .index {
  position: absolute; left: 0; top: -4px;
  font-family: var(--font-h2);
  font-size: 30px; color: rgba(236, 207, 138, .55);
}
.fact .index::after {
  content: "";
  position: absolute; left: 4px; top: 46px; bottom: -46px;
  width: 1px;
  background: linear-gradient(180deg, rgba(212, 169, 78, .5), transparent);
}
.fact:last-child .index::after { display: none; }
.fact h2 {
  font-family: var(--font-h2);
  font-weight: 400;
  font-size: clamp(25px, 2.4vw, 34px);
  color: var(--gold-bright);
  margin-bottom: 1.6vh;
}
.fact p {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15.5px;
  letter-spacing: .03em;
  line-height: 1.8;
  color: var(--parchment);
  opacity: .88;
}
.fact p strong { font-weight: 400; color: var(--gold-bright); }

/* entrance: lines of ink rising */
.rise { opacity: 0; transform: translateY(26px); animation: rise 1.1s cubic-bezier(.2, .7, .25, 1) forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* —— onward ————————————————————————————————— */

.onward {
  margin-top: 11vh;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  max-width: 620px;
}
.next-link {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 15px 30px;
  border: 1px solid rgba(236, 207, 138, .4);
  border-radius: 999px;
  font-size: 12px; letter-spacing: .12em; text-indent: .12em; text-transform: uppercase;
  background: rgba(16, 10, 5, .35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  position: relative;
  transition: color .4s, border-color .4s, box-shadow .4s;
}
.next-link::before {
  content: "";
  position: absolute; inset: -20px;
  border-radius: 999px;
  background: radial-gradient(ellipse at center, rgba(var(--halo), .3) 0%, rgba(var(--halo), .1) 44%, transparent 70%);
  animation: haloBreath 3.4s ease-in-out infinite;
  pointer-events: none;
}
.next-link:hover { color: var(--gold-bright); border-color: var(--gold-bright); box-shadow: 0 0 26px rgba(var(--halo), .3); }
.tree-return {
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--parchment-dim);
  transition: color .4s;
}
.tree-return:hover { color: var(--gold-bright); }

.season-mark {
  position: fixed; bottom: 26px; right: 44px;
  font-family: var(--font-h2); font-size: 17px;
  color: rgba(212, 169, 78, .5);
  z-index: 10;
}

@media (max-width: 760px) {
  .brand { top: 22px; left: 22px; font-size: 11px; letter-spacing: .26em; }
  .page-label { top: 24px; right: 20px; font-size: 10px; }
  .back-link { top: 68px; left: 22px; }
  .hanzi { display: none; }
  main { padding: 17vh 7vw 14vh; }
  .fact { padding-left: 52px; }
  .fact .index { font-size: 24px; }
  .tree-ghost { width: 130vw; min-width: 0; right: -40vw; opacity: .12; }
  .onward { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .rise { animation-duration: .01s; }
  .tree-ghost { animation: none; }
  .next-link::before { animation-duration: 8s; }   /* matches the portal's reduced-motion halo */
}
