/* Threshold — desert rim, Pattern walk, choir. Homage climate, not quotation. */

.threshold-page {
  --sand: #c4a36a;
  --spice: #e4b45a;
  --ember-dune: #c45a32;
  --night: #07080c;
  --night-2: #120e0a;
  --ink-dune: #f3e6c8;
  --mute-dune: #b7a48a;
  --pattern-blue: #9fd8ff;
  --choir: #d7c4ff;
  position: relative;
  min-height: 100vh;
  color: var(--ink-dune);
  background: var(--night);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.threshold-page main {
  position: relative;
  z-index: 1;
  width: min(74rem, calc(100% - 2.2rem));
  margin: 0 auto;
  padding: 1.2rem 0 4.5rem;
}

.threshold-sky,
.threshold-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.threshold-sky { z-index: 0; overflow: hidden; }

.threshold-stars {
  position: absolute;
  inset: -10% 0 40%;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 244, 214, .85), transparent 2px),
    radial-gradient(1px 1px at 28% 8%, rgba(159, 216, 255, .7), transparent 2px),
    radial-gradient(1.4px 1.4px at 47% 22%, rgba(240, 195, 106, .8), transparent 2px),
    radial-gradient(1px 1px at 63% 11%, rgba(255, 255, 255, .55), transparent 2px),
    radial-gradient(1px 1px at 81% 27%, rgba(159, 216, 255, .65), transparent 2px),
    radial-gradient(1.2px 1.2px at 91% 9%, rgba(240, 195, 106, .7), transparent 2px),
    radial-gradient(1px 1px at 8% 42%, rgba(255, 255, 255, .4), transparent 2px),
    radial-gradient(1px 1px at 72% 38%, rgba(215, 196, 255, .5), transparent 2px);
  opacity: .72;
}

.threshold-haze {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 18%;
  height: 42%;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(228, 180, 90, .22), transparent 62%),
    linear-gradient(180deg, transparent, rgba(196, 90, 50, .12) 40%, rgba(18, 14, 10, .4));
  filter: blur(8px);
  animation: threshold-heat 9s ease-in-out infinite alternate;
}

.threshold-dune {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 28vh;
  background: #140f0c;
  clip-path: polygon(0 64%, 8% 58%, 18% 66%, 31% 48%, 44% 62%, 58% 40%, 72% 58%, 86% 46%, 100% 60%, 100% 100%, 0 100%);
  opacity: .92;
}

.threshold-dune--far {
  height: 34vh;
  background: #1c1610;
  clip-path: polygon(0 70%, 14% 52%, 27% 64%, 41% 44%, 55% 61%, 69% 38%, 84% 55%, 100% 42%, 100% 100%, 0 100%);
  opacity: .55;
  filter: blur(.4px);
}

.threshold-dune--near { z-index: 1; }

.threshold-grain {
  z-index: 2;
  opacity: .13;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.threshold-kicker {
  margin: 0 0 .85rem;
  color: var(--spice);
  font: 500 .66rem/1.4 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.threshold-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(18rem, .95fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  min-height: calc(100vh - 6.5rem);
  padding: 1.5rem 0 3rem;
}

.threshold-hero__copy h1 {
  margin: 0 0 1.25rem;
  color: var(--ink-dune);
  font: 600 clamp(2.4rem, 6vw, 4.6rem)/1.02 "Cormorant Garamond", Georgia, serif;
  letter-spacing: -.02em;
}

.threshold-lead,
.threshold-homage-line {
  max-width: 38rem;
  color: var(--mute-dune);
  font-size: 1.05rem;
  line-height: 1.65;
}

.threshold-homage-line {
  margin-top: 1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.22rem;
  font-style: italic;
  color: #e8d3a4;
}

.threshold-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: 1.8rem;
}

.threshold-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.7rem;
  padding: .55rem 1rem;
  border: 1px solid rgba(240, 195, 106, .35);
  color: var(--sand);
  background: transparent;
  font: 500 .68rem/1 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.threshold-button--primary {
  color: #1a120c;
  background: var(--spice);
  border-color: var(--spice);
}

.threshold-button:hover { color: var(--ink-dune); border-color: var(--spice); }
.threshold-button--primary:hover { color: #1a120c; filter: brightness(1.06); }

.threshold-pattern {
  margin: 0;
  position: relative;
}

.threshold-pattern svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 24px rgba(159, 216, 255, .12));
}

.pattern-center {
  fill: var(--spice);
  font: 500 11px "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .28em;
}

.pattern-ring { opacity: .42; }
.pattern-thread { opacity: .85; }
.pattern-walker {
  offset-path: path("M320 312 C 348 286 402 274 438 302 C 486 344 470 422 412 454 C 332 496 228 470 196 396 C 164 318 214 232 304 214 C 402 194 508 246 528 344 C 552 456 470 552 352 568 C 214 586 96 500 84 372");
  offset-rotate: auto;
  animation: threshold-walk 28s linear infinite;
  filter: drop-shadow(0 0 8px rgba(240, 195, 106, .9));
}

.threshold-pattern figcaption {
  margin-top: .7rem;
  color: var(--mute-dune);
  font: .62rem/1.45 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
}

.threshold-page:has([data-station="cross"]:hover) .pattern-ring--1,
.threshold-page:has([data-station="cross"]:focus-within) .pattern-ring--1,
.threshold-page:has([data-station="see"]:hover) .pattern-ring--2,
.threshold-page:has([data-station="see"]:focus-within) .pattern-ring--2,
.threshold-page:has([data-station="bind"]:hover) .pattern-ring--3,
.threshold-page:has([data-station="bind"]:focus-within) .pattern-ring--3,
.threshold-page:has([data-station="move"]:hover) .pattern-ring--4,
.threshold-page:has([data-station="move"]:focus-within) .pattern-ring--4,
.threshold-page:has([data-station="seal"]:hover) .pattern-ring--5,
.threshold-page:has([data-station="seal"]:focus-within) .pattern-ring--5 {
  opacity: 1;
  stroke-width: 2.2;
}

.threshold-walk,
.threshold-litany,
.threshold-weathers {
  scroll-margin-top: 6.2rem;
}

.threshold-weathers,
.threshold-walk,
.threshold-cortices,
.threshold-doors {
  padding: 3.2rem 0 1.2rem;
}

.threshold-weathers header p,
.threshold-walk header p:last-of-type {
  max-width: 42rem;
  color: var(--mute-dune);
  font-size: .98rem;
  line-height: 1.6;
}

.threshold-weathers h2,
.threshold-walk h2,
.threshold-cortices h2,
.threshold-doors h2,
.litany-sheet h2 {
  margin: 0 0 1.4rem;
  font: 600 clamp(1.8rem, 3.4vw, 2.8rem)/1.12 "Cormorant Garamond", Georgia, serif;
}

.threshold-weather-grid,
.threshold-stations,
.cortex-split,
.threshold-door-grid {
  display: grid;
  gap: 1rem;
}

.threshold-weather-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.weather-card,
.threshold-stations li,
.cortex-split article,
.threshold-door-grid a,
.litany-sheet {
  padding: 1.35rem 1.3rem 1.45rem;
  border: 1px solid rgba(240, 195, 106, .18);
  background: rgba(12, 10, 9, .62);
  backdrop-filter: blur(10px);
}

.weather-card span,
.threshold-stations b,
.cortex-split span,
.threshold-door-grid span,
.litany-note {
  color: var(--spice);
  font: 500 .62rem/1.4 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.weather-card h3,
.threshold-stations strong,
.cortex-split h3,
.threshold-door-grid strong {
  display: block;
  margin: .7rem 0 .65rem;
  color: var(--ink-dune);
  font: 600 1.45rem/1.15 "Cormorant Garamond", Georgia, serif;
}

.weather-card p,
.threshold-stations p,
.cortex-split p,
.litany-lines {
  margin: 0;
  color: var(--mute-dune);
  font-size: .92rem;
  line-height: 1.58;
}

.weather-card--choir {
  background:
    linear-gradient(180deg, rgba(215, 196, 255, .07), transparent 42%),
    rgba(12, 10, 9, .62);
}

.weather-card--choir::after {
  content: "";
  display: block;
  height: 2.2rem;
  margin-top: 1.1rem;
  background:
    radial-gradient(ellipse at 20% 50%, transparent 48%, rgba(215, 196, 255, .55) 50%, transparent 52%),
    radial-gradient(ellipse at 50% 50%, transparent 48%, rgba(159, 216, 255, .45) 50%, transparent 52%),
    radial-gradient(ellipse at 80% 50%, transparent 48%, rgba(240, 195, 106, .5) 50%, transparent 52%);
  background-size: 100% 180%;
  opacity: .7;
}

.threshold-litany { padding: 2rem 0 1rem; }

.litany-sheet {
  position: relative;
  padding: clamp(1.6rem, 4vw, 2.8rem);
  border-color: rgba(228, 180, 90, .38);
  background:
    linear-gradient(180deg, rgba(240, 195, 106, .08), transparent 28%),
    rgba(18, 13, 9, .78);
}

.litany-lines {
  margin: 1.4rem 0 1.2rem;
  padding: 0;
  list-style: none;
}

.litany-lines li {
  padding: .72rem 0;
  border-top: 1px solid rgba(240, 195, 106, .14);
  color: #ead7b0;
  font: italic clamp(1.15rem, 2.2vw, 1.55rem)/1.45 "Cormorant Garamond", Georgia, serif;
}

.litany-note { display: block; margin-top: .4rem; }

.threshold-stations {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
}

.threshold-stations li {
  min-height: 16.5rem;
  cursor: default;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.threshold-stations li:hover,
.threshold-stations li:focus-within {
  border-color: var(--spice);
  background: rgba(36, 24, 14, .78);
  transform: translateY(-4px);
}

.threshold-stations code {
  color: var(--pattern-blue);
  font: .78em/1 "IBM Plex Mono", Menlo, monospace;
}

.cortex-split { grid-template-columns: 1fr 1fr; }

.cortex-ceiling {
  margin: 1.1rem 0 0;
  color: var(--ember-dune);
  font: .72rem/1.5 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .04em;
}

.threshold-door-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.threshold-door-grid a {
  display: grid;
  min-height: 9.2rem;
  color: inherit;
  text-decoration: none;
}

.threshold-door-grid a:hover {
  border-color: var(--spice);
  background: rgba(36, 24, 14, .8);
}

.threshold-door-grid b {
  align-self: end;
  color: var(--sand);
  font: 400 1rem/1.3 "Cormorant Garamond", Georgia, serif;
}

.threshold-footer {
  position: relative;
  z-index: 1;
  padding: 1.4rem 1.2rem 2.4rem;
  color: #8a7b66;
  font: .62rem/1.5 "IBM Plex Mono", Menlo, monospace;
  letter-spacing: .04em;
  text-align: center;
}

@keyframes threshold-heat {
  from { transform: translate3d(-1.2%, 0, 0) scaleX(1.02); opacity: .85; }
  to { transform: translate3d(1.4%, .4%, 0) scaleX(1.05); opacity: 1; }
}

@keyframes threshold-walk {
  to { offset-distance: 100%; }
}

@media (max-width: 980px) {
  .threshold-hero,
  .threshold-weather-grid,
  .threshold-stations,
  .cortex-split,
  .threshold-door-grid {
    grid-template-columns: 1fr;
  }
  .threshold-hero { min-height: 0; padding-top: .5rem; }
  .threshold-stations li { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .threshold-haze,
  .pattern-walker {
    animation: none;
  }
  .threshold-stations li { transition: none; }
}

html[data-theme="dark"] body.threshold-page,
html[data-theme="dark"] body.threshold-page main,
html[data-theme="dark"] body.threshold-page section,
html[data-theme="dark"] body.threshold-page article,
html[data-theme="dark"] body.threshold-page footer {
  color: var(--ink-dune);
  background-color: transparent;
}

html[data-theme="dark"] body.threshold-page {
  background: var(--night);
}

html[data-theme="light"] body.threshold-page {
  --night: #f3ead8;
  --night-2: #e7dcc4;
  --ink-dune: #2a1d12;
  --mute-dune: #6a5744;
  --spice: #9c6412;
  --sand: #7a4e16;
  --ember-dune: #a33b22;
  --pattern-blue: #1d6384;
  background:
    radial-gradient(circle at 50% 0, rgba(228, 180, 90, .28), transparent 36rem),
    #efe4cc;
}

html[data-theme="light"] body.threshold-page .threshold-stars { opacity: .18; }
html[data-theme="light"] body.threshold-page .threshold-dune { background: #c9ae7c; opacity: .45; }
html[data-theme="light"] body.threshold-page .threshold-dune--far { background: #d7c49a; }
html[data-theme="light"] body.threshold-page .threshold-haze {
  background: radial-gradient(ellipse at 50% 100%, rgba(228, 180, 90, .35), transparent 62%);
}
html[data-theme="light"] body.threshold-page .weather-card,
html[data-theme="light"] body.threshold-page .threshold-stations li,
html[data-theme="light"] body.threshold-page .cortex-split article,
html[data-theme="light"] body.threshold-page .threshold-door-grid a,
html[data-theme="light"] body.threshold-page .litany-sheet {
  background: rgba(255, 250, 240, .72);
  border-color: rgba(122, 78, 22, .22);
}
html[data-theme="light"] body.threshold-page .threshold-button--primary {
  color: #f7efe0;
  background: #7a4e16;
  border-color: #7a4e16;
}
html[data-theme="light"] body.threshold-page .pattern-ring {
  opacity: .82;
  stroke: #7a4e16;
}
html[data-theme="light"] body.threshold-page .pattern-thread {
  opacity: 1;
}
html[data-theme="light"] body.threshold-page .threshold-pattern svg {
  filter: drop-shadow(0 0 18px rgba(122, 78, 22, .18));
}
html[data-theme="light"] body.threshold-page .pattern-center { fill: #7a4e16; }
html[data-theme="light"] body.threshold-page .litany-lines li { color: #3a2a18; }
html[data-theme="light"] body.threshold-page .threshold-homage-line { color: #5c3f1c; }
html[data-theme="light"] body.threshold-page .threshold-footer { color: #7a6b56; }
html[data-theme="light"] body.threshold-page main,
html[data-theme="light"] body.threshold-page section,
html[data-theme="light"] body.threshold-page article,
html[data-theme="light"] body.threshold-page footer {
  color: var(--ink-dune);
  background-color: transparent;
}
