/* ============================================================
   VERDANTIS — HOME
   BUILD 007: responsive hero architecture.
   BUILD 030: editorial chapters are padded, not full-viewport.
   Desktop overlay preserved. Tablet rail. Mobile status grid.
   Animate transform/opacity only. Pause via [data-page-hidden]
   and [data-hero-idle]. Preserve BUILD 003 performance budget.
   ============================================================ */

.page-home {
  background: var(--void);
}

.page-home .grain {
  display: none;
}

.page-home .site-header:not(.is-scrolled) {
  background: linear-gradient(
    to bottom,
    rgba(4, 8, 12, 0.55) 0%,
    rgba(4, 8, 12, 0.12) 70%,
    transparent 100%
  );
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  height: 100svh;
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
  color: var(--ink);
  background: #0a1418;
}

.hero-vista {
  position: absolute;
  inset: 0;
}

.hero-scene {
  position: absolute;
  inset: -3%;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layer-plate {
  inset: 0;
}

.plate-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 48% 52%;
  display: block;
}

/* Sun-side atmospheric light — transform + slow opacity only. */
.layer-shaft {
  background: linear-gradient(
    98deg,
    transparent 4%,
    rgba(255, 196, 130, 0.12) 14%,
    rgba(255, 210, 150, 0.2) 20%,
    rgba(255, 196, 130, 0.1) 28%,
    transparent 42%
  );
  animation:
    shaft-drift 26s linear infinite alternate,
    shaft-breathe 18s ease-in-out infinite;
}

/* Two haze sheets. Gradients, no blur, no mix-blend. */
.mist {
  position: absolute;
  pointer-events: none;
}

.mist-a {
  top: 38%;
  left: -15%;
  width: 70%;
  height: 42%;
  background: radial-gradient(
    ellipse at 40% 50%,
    rgba(230, 236, 240, 0.36) 0%,
    rgba(210, 222, 228, 0.14) 42%,
    transparent 72%
  );
  animation: mist-a 30s linear infinite alternate;
}

.mist-b {
  top: 46%;
  right: -18%;
  width: 58%;
  height: 38%;
  background: radial-gradient(
    ellipse at 60% 50%,
    rgba(220, 230, 224, 0.3) 0%,
    rgba(180, 200, 196, 0.12) 48%,
    transparent 74%
  );
  animation: mist-b 38s linear infinite alternate;
}

/* Top-edge readability only. No lower band behind the title. */
.layer-read {
  background: linear-gradient(to bottom, rgba(4, 8, 12, 0.28) 0%, transparent 14%);
}

.layer-frame {
  z-index: 3;
  inset: 1.1rem;
  border: 1px solid rgba(212, 196, 150, 0.12);
}

.layer-frame::before,
.layer-frame::after {
  content: "";
  position: absolute;
  width: 1.4rem;
  height: 1.4rem;
  border-color: rgba(212, 196, 150, 0.45);
  border-style: solid;
}

.layer-frame::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.layer-frame::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

/* ---------- Identity ---------- */

.hero-identity {
  position: absolute;
  z-index: 6;
  left: var(--gutter);
  bottom: clamp(5.5rem, 12vh, 8.5rem);
  max-width: 42rem;
}

.hero-locale {
  margin-bottom: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.8rem, 11vw, 9.5rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 0.86;
  text-transform: uppercase;
  text-shadow: 0 8px 36px rgba(4, 8, 12, 0.55);
}

.hero-tag {
  margin-top: 1.15rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.2vw, 1.7rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--interior);
}

.telemetry {
  position: absolute;
  z-index: 6;
  right: var(--gutter);
  bottom: clamp(5.5rem, 12vh, 8.5rem);
  min-width: 10.5rem;
  padding: 1.1rem 0 1.1rem 1.2rem;
  border-left: 1px solid var(--hairline-strong);
}

.telemetry-kicker {
  display: none;
}

.telemetry dl {
  display: grid;
  gap: 1.15rem;
  margin: 0;
}

.telemetry-item {
  display: grid;
  gap: 0.2rem;
}

.telemetry-item dt {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.telemetry-item dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.telemetry-item dd[data-status="stable"] {
  color: var(--emerald);
}

/* ---------- Opening sequence ---------- */

body.is-intro .layer-plate {
  opacity: 0.22;
}

body.is-intro .layer-shaft,
body.is-intro .layer-mist,
body.is-intro .layer-read,
body.is-intro .hero-identity,
body.is-intro .telemetry,
body.is-intro .layer-frame {
  opacity: 0;
}

body.is-awakening .layer-plate {
  animation: intro-fade 2s var(--ease-out) both;
}

body.is-awakening .layer-read,
body.is-awakening .layer-shaft {
  animation: intro-fade 1.6s 0.35s var(--ease-out) both;
}

body.is-awakening .layer-mist {
  animation: intro-fade 1.6s 0.7s var(--ease-out) both;
}

body.is-awakening .hero-identity {
  animation: intro-rise 1.5s 0.36s var(--ease-out) both;
}

body.is-awakening .telemetry,
body.is-awakening .layer-frame {
  animation: intro-fade 1.1s 1.06s var(--ease-out) both;
}

body.is-ready .layer-plate,
body.is-ready .layer-shaft,
body.is-ready .layer-mist,
body.is-ready .layer-read,
body.is-ready .hero-identity,
body.is-ready .telemetry,
body.is-ready .layer-frame {
  opacity: 1;
}

/* ---------- Teaser chapters ---------- */

.chapter {
  position: relative;
  padding: calc(var(--header-h) + 3rem) var(--gutter) 5rem;
  overflow: hidden;
}

.chapter-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chapter-inner {
  position: relative;
  z-index: 1;
  max-width: 46rem;
}

.chapter-index {
  margin-bottom: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  color: var(--ink-faint);
}

.chapter h2 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.4rem);
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: 0.02em;
  max-width: 12ch;
}

.chapter .lede {
  margin-top: 1.6rem;
}

.chapter-living .chapter-bg {
  background:
    radial-gradient(ellipse at 80% 20%, rgba(45, 90, 70, 0.22), transparent 50%),
    linear-gradient(180deg, #071016 0%, #0c1c18 40%, #10241e 100%);
}

.chapter-living .canopy-wash {
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(12, 32, 24, 0.65), transparent);
}

.chapter-energy #energy-title {
  max-width: none;
}

@media (max-width: 720px) {
  .energy-title-break {
    display: none;
  }
}

.chapter-energy .chapter-bg {
  background:
    radial-gradient(ellipse at 20% 80%, rgba(212, 164, 90, 0.16), transparent 45%),
    linear-gradient(180deg, #0a1210 0%, #121c1c 50%, #1a2018 100%);
}

.chapter-energy .core-glow {
  position: absolute;
  width: 55vw;
  height: 55vw;
  right: -10%;
  bottom: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 164, 90, 0.18), transparent 62%);
  animation: glow-breathe 12s var(--ease-in-out) infinite;
}

/* Tablet only: the desktop glow is mostly off-canvas and too faint
   for WebKit to hold after compositing. Keep desktop/phone intact. */
@media (min-width: 721px) and (max-width: 1180px) {
  .chapter-energy .core-glow {
    width: 64vw;
    height: 64vw;
    right: -2%;
    bottom: -4%;
    background: radial-gradient(circle, rgba(212, 164, 90, 0.28), transparent 62%);
  }
}

.chapter-habitat .chapter-bg {
  background: linear-gradient(180deg, #0b1418 0%, #161814 55%, #2a2218 100%);
}

.chapter-habitat .window-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(232, 196, 138, 0.07) 58%, transparent 72%);
}

.civic-close {
  position: relative;
  padding: 7rem var(--gutter) 6rem;
  border-top: 1px solid var(--hairline);
  background: linear-gradient(180deg, #071016, #04080c);
}

.civic-close h2 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  font-weight: 500;
  max-width: 16ch;
  margin-bottom: 2.5rem;
}

.civic-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 40rem;
}

.civic-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  letter-spacing: 0.04em;
  color: var(--ink);
  transition: color var(--duration) var(--ease-out), padding-left var(--duration) var(--ease-out);
}

.civic-list li:last-child a {
  border-bottom: 1px solid var(--hairline);
}

.civic-list a span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-width: 0;
  text-align: right;
}

.civic-list a:hover,
.civic-list a:focus-visible {
  color: var(--ink);
  padding-left: 0.6rem;
}

.civic-list a:hover span,
.civic-list a:focus-visible span {
  color: var(--amber);
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Keyframes ---------- */

@keyframes shaft-drift {
  from { transform: translate3d(-4%, 0, 0); }
  to { transform: translate3d(5.5%, 0, 0); }
}

@keyframes shaft-breathe {
  0%, 100% { opacity: 0.62; }
  50% { opacity: 1; }
}

@keyframes mist-a {
  from { transform: translate3d(0, 0, 0); opacity: 0.52; }
  to { transform: translate3d(-12%, 2.5%, 0); opacity: 1; }
}

@keyframes mist-b {
  from { transform: translate3d(0, 0, 0); opacity: 0.48; }
  to { transform: translate3d(11%, -2%, 0); opacity: 0.95; }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes intro-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes intro-rise {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .plate-img {
    object-position: 62% 48%;
  }
}

/* Short desktop viewports only — do not compress tablet/mobile identity. */
@media (max-height: 700px) and (min-width: 901px) {
  .hero-title {
    font-size: clamp(2.6rem, 8vw, 5.5rem);
  }

  .hero-identity {
    bottom: clamp(4.5rem, 10vh, 6.5rem);
  }
}

/* Shared below desktop overlay: hide descend cue, tighten frame. */
@media (max-width: 900px) {
  .page-home .site-header:not(.is-scrolled) {
    background: linear-gradient(
      to bottom,
      rgba(4, 8, 12, 0.78) 0%,
      rgba(4, 8, 12, 0.24) 68%,
      transparent 100%
    );
  }

  .layer-frame {
    inset: 0.55rem;
  }

  .telemetry {
    scroll-margin-top: var(--header-h);
  }
}

/* Tablet — cinematic vista + horizontal civic status rail. */
@media (max-width: 900px) and (min-width: 721px) {
  .hero {
    min-height: 0;
  }

  .hero-identity {
    left: var(--gutter);
    right: var(--gutter);
    bottom: 8.6rem;
    max-width: 38rem;
  }

  .hero-title {
    letter-spacing: 0.14em;
  }

  .hero-tag {
    margin-top: 1rem;
  }

  .telemetry {
    left: 0;
    right: 0;
    bottom: 0;
    min-width: 0;
    width: 100%;
    padding: 0.95rem var(--gutter) 1.15rem;
    border-left: 0;
    border-top: 1px solid var(--hairline);
    background: linear-gradient(to top, rgba(4, 8, 12, 0.22), rgba(4, 8, 12, 0.04) 70%, transparent);
  }

  .telemetry-kicker {
    display: block;
    margin: 0 0 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .telemetry dl {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
  }

  .telemetry-item {
    padding: 0 1.1rem;
    border-left: 1px solid var(--hairline);
  }

  .telemetry-item dt {
    letter-spacing: 0.16em;
  }

  .telemetry-item:first-child {
    padding-left: 0;
    border-left: 0;
  }

  .telemetry-item dd {
    font-size: 0.86rem;
    white-space: nowrap;
  }

  .plate-img {
    object-position: 70% 46%;
  }
}

/* Mobile — photographic vista, then 2×2 status field below. */
@media (max-width: 720px) {
  .hero {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .hero-vista {
    position: relative;
    height: 100svh;
    height: 100dvh;
    min-height: 28rem;
    overflow: hidden;
  }

  .hero-identity {
    left: var(--gutter);
    right: var(--gutter);
    bottom: 1.8rem;
    max-width: none;
  }

  .hero-locale {
    margin-bottom: 0.75rem;
    letter-spacing: 0.28em;
  }

  .hero-title {
    font-size: clamp(2.7rem, 11.2vw, 3.85rem);
    letter-spacing: 0.08em;
    max-width: 100%;
  }

  .hero-tag {
    margin-top: 0.8rem;
    font-size: clamp(1.05rem, 4.4vw, 1.3rem);
    letter-spacing: 0.16em;
  }

  .telemetry {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    min-width: 0;
    width: 100%;
    padding: 1.45rem var(--gutter) 1.7rem;
    border-left: 0;
    border-top: 1px solid var(--hairline);
    background: var(--void);
  }

  .telemetry-kicker {
    display: block;
    margin: 0 0 0.95rem;
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  .telemetry dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .telemetry-item {
    padding: 1.05rem 0 1.1rem;
  }

  .telemetry-item:nth-child(odd) {
    padding-right: 1rem;
    border-right: 1px solid var(--hairline);
  }

  .telemetry-item:nth-child(even) {
    padding-left: 1rem;
  }

  .telemetry-item:nth-child(n + 3) {
    border-top: 1px solid var(--hairline);
  }

  .telemetry-item dd {
    font-size: 0.88rem;
  }

  .layer-shaft {
    display: none;
  }

  .plate-img {
    object-position: 74% 44%;
  }

  .chapter {
    min-height: auto;
    padding: 6rem var(--gutter) 5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .layer-shaft,
  .mist,
  .core-glow,
  body.is-awakening .layer-plate,
  body.is-awakening .layer-shaft,
  body.is-awakening .layer-mist,
  body.is-awakening .layer-read,
  body.is-awakening .hero-identity,
  body.is-awakening .telemetry,
  body.is-awakening .layer-frame {
    animation: none !important;
  }

  body.is-intro .layer-plate,
  body.is-intro .layer-shaft,
  body.is-intro .layer-mist,
  body.is-intro .layer-read,
  body.is-intro .hero-identity,
  body.is-intro .telemetry,
  body.is-intro .layer-frame {
    opacity: 1 !important;
    transform: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

html.reduce-motion .layer-shaft,
html.reduce-motion .mist,
html.reduce-motion .core-glow {
  animation: none !important;
}

html[data-page-hidden] .layer-shaft,
html[data-page-hidden] .mist,
html[data-page-hidden] .core-glow,
html[data-hero-idle] .layer-shaft,
html[data-hero-idle] .mist {
  animation-play-state: paused;
}
