/*
 * Living Entry — homepage only (docs/index.html).
 *
 * 1. The entry overlay: the Codex wakes on arrival (built by living-entry.js;
 *    this file only styles what the script injects).
 * 2. A breathing glow + gold rule shimmer for the hero.
 * 3. The guided path: step heads, continue leads, the path rail, the doors.
 * 4. Staged reveals. Sections are VISIBLE by default — the hidden state
 *    (.le-reveal-pending) is only ever applied by living-entry.js at runtime,
 *    so no-JS and reduced-motion visitors lose nothing.
 * 5. The witness line: a calm crossfade of teachings drawn verbatim from
 *    the site's own pages (rotation itself lives in living-witness.js).
 *
 * Motion uses transform/opacity only. Everything here is disabled or
 * neutralised under prefers-reduced-motion.
 */

:root {
  --le-gold: var(--gold, #f3c97a);
  --le-gold-deep: var(--gold-deep, #d99545);
  --le-teal: #7af3ff;
  --le-teal-deep: #2dd4bf;
  --le-beige: #f4f0de;
  --le-stone: #05070d;
  --le-stone-2: #0a0e18;
  --le-line: rgba(243, 201, 122, 0.28);
}

/* ------------------------------------------------------------------ */
/* Smooth anchor travel for the path (motion-safe only)                */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  html.home-page {
    scroll-behavior: smooth;
  }
}

/* ------------------------------------------------------------------ */
/* 1. Entry overlay                                                    */
/* ------------------------------------------------------------------ */

body.le-lock {
  overflow: hidden;
}

.le-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 38%, rgba(45, 212, 191, 0.07), transparent 55%),
    radial-gradient(circle at 50% 62%, rgba(243, 201, 122, 0.05), transparent 60%),
    linear-gradient(170deg, #0a0e18 0%, var(--le-stone) 70%);
  opacity: 1;
  transition: opacity 0.75s ease-in-out;
  cursor: pointer;
}

.le-overlay.le-leaving {
  opacity: 0;
  pointer-events: none;
}

.le-overlay-inner {
  display: grid;
  justify-items: center;
  gap: 1.1rem;
  text-align: center;
  max-width: 34rem;
}

.le-emblem-wrap {
  position: relative;
  width: min(58vw, 280px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

.le-emblem-wrap::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(122, 243, 255, 0.11) 0%, rgba(122, 243, 255, 0.035) 45%, transparent 68%);
  animation: le-breathe 4.6s ease-in-out infinite alternate;
  pointer-events: none;
}

.le-emblem {
  width: 100%;
  height: 100%;
  display: block;
}

.le-orbit {
  transform-box: fill-box;
  transform-origin: center;
  animation: le-spin 46s linear infinite;
}

.le-crack {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: le-draw 1.05s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: var(--d, 0s);
}

.le-eye {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: le-eye-open 1.15s cubic-bezier(0.22, 0.61, 0.21, 1) 0.4s forwards;
}

.le-pupil {
  transform-box: fill-box;
  transform-origin: center;
  animation: le-breathe 3.6s ease-in-out 1.2s infinite alternate;
}

.le-status {
  margin: 0;
  color: var(--le-gold);
  font-size: clamp(0.95rem, 2.6vw, 1.15rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: opacity 0.2s ease;
}

.le-status.le-status-swap {
  opacity: 0;
}

.le-data {
  margin: 0;
  color: var(--le-beige);
  font-size: clamp(0.92rem, 2.4vw, 1.05rem);
  line-height: 1.65;
}

.le-data strong {
  color: var(--le-teal);
  font-weight: 700;
}

.le-alive {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--le-beige);
  font-size: 1.12em;
  letter-spacing: 0.04em;
}

.le-hint {
  margin: 0.4rem 0 0;
  color: rgba(185, 193, 199, 0.75);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  animation: le-fade-in 0.8s ease 1.15s forwards;
}

@keyframes le-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes le-eye-open {
  from { opacity: 0; transform: scale(0.55) rotate(-14deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes le-breathe {
  from { opacity: 0.55; transform: scale(1); }
  to { opacity: 1; transform: scale(1.07); }
}

@keyframes le-spin {
  to { transform: rotate(360deg); }
}

@keyframes le-fade-in {
  to { opacity: 1; }
}

/* ------------------------------------------------------------------ */
/* 2. Hero: breathing glow + the heading's gold rule                   */
/* ------------------------------------------------------------------ */

.home-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 55% 42% at 24% 12%, rgba(45, 212, 191, 0.13), transparent 62%),
    radial-gradient(ellipse 46% 38% at 78% 20%, rgba(243, 201, 122, 0.10), transparent 65%);
  animation: le-breathe 10s ease-in-out infinite alternate;
  pointer-events: none;
}

.home-hero h1 {
  position: relative;
}

.home-hero h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.34em;
  width: min(430px, 72%);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--le-gold-deep), var(--le-gold) 55%, transparent);
}

.home-hero h1::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.34em;
  width: min(120px, 22%);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #fff3d6, transparent);
  opacity: 0;
  animation: le-shimmer 7s ease-in-out infinite;
  pointer-events: none;
}

@keyframes le-shimmer {
  0% { transform: translateX(-130%); opacity: 0; }
  12% { opacity: 0.9; }
  46% { transform: translateX(380%); opacity: 0.9; }
  58%, 100% { transform: translateX(380%); opacity: 0; }
}

/* ------------------------------------------------------------------ */
/* 3. Guided path: step heads + continue leads                         */
/* ------------------------------------------------------------------ */

.le-path-head {
  padding-bottom: 0;
}

.le-path-head-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1rem, 3vw, 1.8rem);
  align-items: start;
  padding-top: clamp(1.2rem, 3vw, 2rem);
  border-top: 1px solid var(--le-line);
}

.le-step-badge {
  display: grid;
  place-items: center;
  width: clamp(3rem, 7vw, 4rem);
  height: clamp(3rem, 7vw, 4rem);
  border: 1px solid var(--le-line);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, rgba(122, 243, 255, 0.10), transparent 70%),
    var(--le-stone-2);
  color: var(--le-gold);
  font-size: clamp(1.05rem, 2.6vw, 1.5rem);
  font-weight: 800;
  box-shadow: inset 0 0 18px rgba(243, 201, 122, 0.08);
}

.le-path-head h2 {
  margin: 0.1rem 0 0.45rem;
}

.le-path-idea {
  margin: 0;
  max-width: 62ch;
  color: var(--muted, #b9c1c7);
  line-height: 1.7;
}

.le-seq {
  margin: 0.9rem 0 0;
  color: rgba(185, 193, 199, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.le-seq .le-seq-on {
  color: var(--le-gold);
}

.le-path-lead {
  padding-top: 0;
  padding-bottom: clamp(1.6rem, 4vw, 2.6rem);
}

.le-lead-link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.35rem 1.2rem;
  padding: clamp(1.05rem, 2.6vw, 1.5rem) clamp(1.2rem, 3vw, 1.8rem);
  border: 1px solid var(--le-line);
  border-radius: 1.1rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(243, 201, 122, 0.10), transparent 55%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  color: var(--le-beige);
  text-decoration: none;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.le-lead-link:hover,
.le-lead-link:focus-visible {
  border-color: rgba(243, 201, 122, 0.6);
  transform: translateY(-2px);
}

.le-lead-kicker {
  grid-column: 1 / -1;
  color: var(--le-teal);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.le-lead-text {
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  font-weight: 700;
  line-height: 1.4;
}

.le-lead-note {
  grid-column: 1 / 2;
  color: var(--muted, #b9c1c7);
  font-size: 0.92rem;
  line-height: 1.6;
}

.le-lead-arrow {
  grid-row: 2 / 4;
  grid-column: 2 / 3;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--le-line);
  border-radius: 50%;
  color: var(--le-gold);
  font-size: 1.25rem;
}

/* ------------------------------------------------------------------ */
/* 4. Path rail                                                        */
/* ------------------------------------------------------------------ */

.le-rail {
  position: fixed;
  left: 1.05rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 0.8rem 0.6rem;
  border: 1px solid rgba(243, 201, 122, 0.16);
  border-radius: 999px;
  background: rgba(5, 7, 13, 0.72);
  backdrop-filter: blur(10px);
}

.le-rail a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: rgba(185, 193, 199, 0.78);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.le-rail-dot {
  flex: none;
  width: 0.62rem;
  height: 0.62rem;
  border: 1px solid var(--le-gold);
  border-radius: 50%;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.le-rail a:hover,
.le-rail a:focus-visible {
  color: var(--le-beige);
}

.le-rail a.is-active {
  color: var(--le-gold);
}

.le-rail a.is-active .le-rail-dot {
  background: var(--le-gold);
  box-shadow: 0 0 12px rgba(243, 201, 122, 0.65);
}

@media (max-width: 1099.98px) {
  html.home-page body {
    padding-bottom: 4.25rem;
  }

  .le-rail {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    transform: none;
    flex-direction: row;
    justify-content: space-around;
    gap: 0.2rem;
    padding: 0.5rem 0.4rem calc(0.5rem + env(safe-area-inset-bottom));
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .le-rail a {
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    gap: 0.3rem;
    padding: 0.3rem 0.25rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
  }
}

/* ------------------------------------------------------------------ */
/* 5. The doors                                                        */
/* ------------------------------------------------------------------ */

.le-doors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: clamp(0.9rem, 2vw, 1.4rem);
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}

.le-door {
  display: block;
  padding: clamp(1.2rem, 2.6vw, 1.7rem);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(122, 243, 255, 0.06), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  color: var(--le-beige);
  text-decoration: none;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.le-door:hover,
.le-door:focus-visible {
  border-color: rgba(243, 201, 122, 0.55);
  transform: translateY(-3px);
}

.le-door-glyph {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  margin-bottom: 0.9rem;
  border: 1px solid var(--le-line);
  border-radius: 0.85rem;
  background: rgba(243, 201, 122, 0.07);
  color: var(--le-gold);
  font-size: 1.3rem;
}

.le-door strong {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 1.12rem;
}

.le-door p {
  margin: 0 0 0.9rem;
  color: var(--muted, #b9c1c7);
  font-size: 0.92rem;
  line-height: 1.65;
}

.le-door-enter {
  color: var(--le-teal);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.le-doors-close {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  text-align: center;
  color: var(--muted, #b9c1c7);
  line-height: 1.7;
}

/* ------------------------------------------------------------------ */
/* 6. Staged reveals — visible by default, JS arms the hidden state    */
/* ------------------------------------------------------------------ */

#main > section,
#main > .le-path-lead {
  transition: opacity 0.85s ease, transform 0.85s cubic-bezier(0.22, 0.61, 0.21, 1);
}

#main > section.le-reveal-pending,
#main > .le-path-lead.le-reveal-pending {
  opacity: 0;
  transform: translateY(26px);
}

/* ------------------------------------------------------------------ */
/* 7. The witness line — the hero keeps moving, calmly                 */
/*                                                                     */
/* Teachings and observations harvested verbatim from the site's own   */
/* pages (each line names its source in data-source). All lines are    */
/* stacked in one grid cell, so the block's height is set by the       */
/* longest line and never changes as they crossfade — zero layout      */
/* shift. The first line carries .is-active in the markup: without     */
/* JS, and under reduced motion, it simply stands there. Rotation      */
/* itself lives in living-witness.js.                                  */
/* ------------------------------------------------------------------ */

.living-witness {
  margin: 1.5rem 0 0.25rem;
  padding: 1rem 1.15rem 1.1rem;
  border: 1px solid rgba(243, 201, 122, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(244, 240, 222, 0.05);
}

.living-witness-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep, #d99545);
}

.living-witness-stage {
  display: grid;
}

.living-witness-line {
  grid-area: 1 / 1;
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.55;
  color: rgba(244, 240, 222, 0.92);
  opacity: 0;
  transition: opacity 1.1s ease;
  pointer-events: none;
}

.living-witness-line.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------------------------------------------ */
/* Reduced motion: nothing breathes, nothing hides, nothing glides     */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .le-overlay,
  .le-emblem-wrap::before,
  .le-orbit,
  .le-crack,
  .le-eye,
  .le-pupil,
  .le-hint,
  .home-hero::after,
  .home-hero h1::before {
    animation: none !important;
  }

  .le-crack {
    stroke-dashoffset: 0;
  }

  .le-eye,
  .le-hint {
    opacity: 1;
  }

  #main > section,
  #main > .le-path-lead {
    transition: none;
  }

  #main > section.le-reveal-pending,
  #main > .le-path-lead.le-reveal-pending {
    opacity: 1;
    transform: none;
  }

  .le-lead-link,
  .le-door {
    transition: none;
  }

  .living-witness-line {
    transition: none;
  }

  .le-lead-link:hover,
  .le-door:hover {
    transform: none;
  }
}

/* ---- Living activity panel ---------------------------------------- */
/* "The Codex Today": today's coordinate, the latest growth-record     */
/* additions, and the line for the day — all real site data, filled    */
/* by living-entry.js; the static markup already carries real values.  */
.le-activity {
  border: 1px solid rgba(243, 201, 122, 0.25);
  background: linear-gradient(180deg, rgba(16, 21, 34, 0.72), rgba(8, 11, 19, 0.88));
  border-radius: 14px;
  padding: 1.1rem 1.2rem 1.2rem;
}
.le-act-today {
  font-size: 1.02rem;
  color: #f4f0de;
  margin: 0.2rem 0 0.9rem;
}
.le-act-label {
  display: inline-block;
  color: #05070d;
  background: #f3c97a;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 0.45rem;
  vertical-align: 0.12em;
}
.le-act-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.6rem;
}
@media (max-width: 640px) {
  .le-act-grid { grid-template-columns: 1fr; }
}
.le-act-slot h3 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d99545;
}
.le-act-growth {
  margin: 0;
  padding-left: 1.05rem;
  color: #cfd6e4;
  font-size: 0.92rem;
}
.le-act-growth li { margin: 0.28rem 0; }
.le-act-growth a { display: inline-flex; align-items: center; min-height: 44px; }
.le-act-growth time { color: #8fa3bf; font-size: 0.82rem; margin-right: 0.3rem; }
.le-act-telling {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(122, 243, 255, 0.22);
  border-radius: 10px;
  background: rgba(10, 16, 28, 0.5);
}
.le-act-telling h3 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #d99545;
}
.le-act-telling-main {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #f4f0de;
}
.le-act-telling-practice { margin: 0.45rem 0 0; color: #cfd6e4; line-height: 1.5; }
.le-act-telling-note { margin: 0.55rem 0 0; font-size: 0.82rem; color: #8fa3bf; }
.le-act-telling-note a { color: #7af3ff; }
@media (prefers-reduced-motion: no-preference) {
  .le-act-telling { animation: le-telling-breathe 7s ease-in-out infinite; }
  @keyframes le-telling-breathe {
    0%, 100% { border-color: rgba(122, 243, 255, 0.16); }
    50% { border-color: rgba(243, 201, 122, 0.38); }
  }
}
.le-act-teaching { margin: 0; }
.le-act-teaching p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  color: #f4f0de;
}
.le-act-slot figcaption {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: #7af3ff;
}
