/* Just Divine Journey site. Design tokens + calm system.
   Palette + type per Website Build Master Draft (Fable 5) 2026-07-07, section 4.
   Motion obeys the Regulation Principle: nothing startles a resting person. */

:root {
  /* Brand palette (Visual Identity, locked) */
  --cream: #F9EDDB;      /* page ground */
  --butter: #FFECC9;     /* raised cards */
  --sand: #D2CBB8;       /* rules, borders */
  --sage: #9F9E7D;       /* secondary text, glyphs */
  --forest: #627044;     /* primary text on light, buttons */
  --deep-forest: #3D4A28;/* hero grounds, footers */

  /* Derived, accessible pairings */
  --ink: #2C331F;        /* body text on cream, > 7:1 */
  --ink-soft: #55603C;   /* secondary text on cream, ~5:1 */
  --on-dark: #F4ECD9;    /* text on deep-forest grounds */
  --on-dark-soft: #CFD3BC;

  --maxw: 68rem;
  --measure: 38rem;      /* ~65-70ch reading column */
  --pad: clamp(1.25rem, 4vw, 3rem);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(61,74,40,.06), 0 12px 32px rgba(61,74,40,.08);

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --fade-in: 560ms;      /* within the 400-700ms doctrine band */
  --ease: cubic-bezier(.22, .61, .36, 1); /* ease-out, no overshoot */
}

/* Self-hosted fonts. Add the woff2 files to assets/fonts/ (vendored, no CDN).
   Fallbacks (Georgia, system-ui) render cleanly until they are added. */
@font-face {
  font-family: "Lora"; font-style: normal; font-weight: 400 600;
  font-display: swap; src: local("Lora"), url("../fonts/lora-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 400 600;
  font-display: swap; src: local("Montserrat"), url("../fonts/montserrat-latin.woff2") format("woff2");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.02rem, 0.98rem + 0.3vw, 1.15rem);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.18; color: var(--forest); letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 1.5rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { max-width: var(--measure); }
a { color: var(--forest); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--deep-forest); }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; display: block; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.center { text-align: center; }
.center p { margin-inline: auto; }
.lede { font-family: var(--serif); font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); line-height: 1.5; color: var(--ink-soft); }

/* ---- Nav (scrolls away; nothing chases the reader) ---- */
.site-nav { position: absolute; inset: 0 0 auto 0; z-index: 10; }
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; padding-block: 1.4rem; }
.brandmark { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--serif); font-size: 1.15rem; color: var(--forest); text-decoration: none; }
.brandmark img { height: 30px; width: auto; }
.nav-links { display: flex; gap: clamp(1rem, 3vw, 2rem); align-items: center; }
.nav-links a { font-size: .96rem; text-decoration: none; color: var(--ink-soft); }
.nav-links a:hover { color: var(--forest); }
.on-dark .brandmark, .on-dark .nav-links a { color: var(--on-dark); }
.on-dark .nav-links a:hover { color: #fff; }
/* Solid nav for pages with no dark hero (legal, long-form): in flow, cream ground. */
.site-nav.solid { position: static; background: var(--cream); border-bottom: 1px solid var(--sand); }

/* ---- Legal / long-form pages ---- */
.legal { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem); }
.legal .wrap { max-width: 48rem; }
.legal h1 { margin-bottom: .4rem; }
.legal .effective { color: var(--ink-soft); font-size: .92rem; margin: 0 0 2.5rem; }
.legal h2 { font-size: 1.3rem; margin: 2.4rem 0 .9rem; }
.legal p, .legal li { max-width: none; }
.legal ul { margin: 0 0 1.4rem 1.4rem; }
.legal li { margin-bottom: .5rem; }
.legal strong { font-weight: 600; }

/* ---- Hero ---- */
.hero { position: relative; color: var(--on-dark); background: linear-gradient(160deg, #45532E 0%, var(--deep-forest) 60%, #333f22 100%); overflow: clip; }
/* Painted-realm layer (injected by app.js into every .hero). The outer layer
   parallaxes on scroll; the inner layer ken-burns "breathes". When no still is
   set yet, the inner layer shows a soft brand-gradient placeholder. Both stop
   entirely under prefers-reduced-motion (Regulation Principle). */
.hero-art { position: absolute; inset: 0; z-index: 0; overflow: hidden; will-change: transform; }
.hero-art-inner {
  position: absolute; inset: -10%;
  background-size: cover; background-position: center; will-change: transform;
  background-image:
    radial-gradient(120% 90% at 78% 8%, rgba(255,236,201,.30), transparent 55%),
    radial-gradient(90% 70% at 12% 100%, rgba(159,158,125,.32), transparent 60%);
}
/* Legibility scrim over the painted still, weighted to the left where the text
   sits so the art breathes on the right. Only present when a still is set. */
.hero-art.has-img::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(100deg, rgba(43,51,31,.82) 0%, rgba(43,51,31,.48) 44%, rgba(43,51,31,.16) 100%),
    linear-gradient(180deg, rgba(43,51,31,.30) 0%, transparent 46%, rgba(43,51,31,.34) 100%);
}
@keyframes kenburns { from { transform: scale(1.06); } to { transform: scale(1.14) translateY(-2%); } }
@media (prefers-reduced-motion: no-preference) {
  .hero-art-inner { animation: kenburns 46s ease-in-out infinite alternate; }
}
.hero .wrap { position: relative; z-index: 1; padding-block: clamp(7rem, 16vh, 11rem) clamp(3.5rem, 9vw, 6rem); }
.hero h1 { color: var(--on-dark); max-width: 20ch; }
.hero .sub { color: var(--on-dark-soft); font-size: clamp(1.1rem, 1rem + .5vw, 1.35rem); max-width: 44ch; margin-top: 1.1rem; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; align-items: center; }
.underline-note { color: var(--on-dark-soft); font-size: .92rem; margin-top: 1rem; }
.hero-dusk { background: linear-gradient(155deg, #4a4030 0%, var(--deep-forest) 55%, #2e3a20 100%); }
.hero-dusk .wrap { padding-block: clamp(6rem, 14vh, 9rem) clamp(3rem, 8vw, 5rem); }

/* ---- Music embeds: click-to-load facade (no third-party request until press) ---- */
.embed-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 52rem) { .embed-grid { grid-template-columns: repeat(3, 1fr); } }
.embed { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--sand); border-radius: var(--radius); overflow: hidden; background: linear-gradient(160deg, #45532E, var(--deep-forest)); }
.embed .embed-play { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem; background: transparent; border: 0; color: var(--on-dark); cursor: pointer; font-family: var(--serif); font-size: 1.02rem; line-height: 1.3; text-align: center; padding: 1rem; }
.embed .glyph { width: 52px; height: 52px; border-radius: 999px; border: 1.5px solid rgba(244,236,217,.7); display: grid; place-items: center; transition: background var(--fade-in) var(--ease); }
.embed .glyph::before { content: ""; border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent var(--on-dark); margin-left: 3px; }
.embed .embed-play:hover .glyph { background: rgba(244,236,217,.16); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed.held .embed-play { cursor: default; color: var(--on-dark-soft); }
.embed.held .glyph { display: none; }

/* Channel cards row */
.channels { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 2.5rem; }
@media (min-width: 46rem) { .channels { grid-template-columns: 1fr 1fr; } }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .8rem 1.5rem; border-radius: 999px; font-family: var(--sans); font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; transition: background var(--fade-in) var(--ease), color var(--fade-in) var(--ease), border-color var(--fade-in) var(--ease); }
.btn-primary { background: var(--butter); color: var(--deep-forest); }
.btn-primary:hover { background: #ffe4b0; color: var(--deep-forest); }
.btn-ghost { background: transparent; color: var(--on-dark); border-color: rgba(244,236,217,.5); }
.btn-ghost:hover { border-color: var(--on-dark); color: #fff; }
.on-light .btn-primary { background: var(--forest); color: var(--cream); }
.on-light .btn-primary:hover { background: var(--deep-forest); }

/* ---- Cards (the two doors) ---- */
.cards { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 46rem) { .cards { grid-template-columns: 1fr 1fr; } }
.trio { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 52rem) { .trio { grid-template-columns: repeat(3, 1fr); } }
.trio .card h3 { font-size: 1.12rem; margin-top: .15rem; }
.phase-days { display: block; font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--sage); }
.card { background: var(--butter); border: 1px solid var(--sand); border-radius: var(--radius); padding: clamp(1.5rem, 3vw, 2.25rem); box-shadow: var(--shadow); transition: transform 300ms var(--ease); }
.card:hover { transform: translateY(-4px); }
.card h3 { margin-top: 0; }
.card a { font-weight: 600; text-decoration: none; }
.card a:hover { text-decoration: underline; }

/* ---- FAQ accordion (simple fade, no icon spin) ---- */
.faq { max-width: var(--measure); margin-inline: auto; }
.faq details { border-top: 1px solid var(--sand); padding: .35rem 0; }
.faq details:last-child { border-bottom: 1px solid var(--sand); }
.faq summary { cursor: pointer; list-style: none; padding: 1rem 2rem 1rem 0; font-family: var(--serif); font-size: 1.12rem; color: var(--forest); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); font-family: var(--sans); font-weight: 400; color: var(--sage); transition: opacity var(--fade-in) var(--ease); }
.faq details[open] summary::after { content: "\2013"; }
.faq .answer { padding: 0 0 1.1rem; color: var(--ink-soft); animation: fade var(--fade-in) var(--ease); }

/* ---- Footer ---- */
.site-footer { background: var(--deep-forest); color: var(--on-dark-soft); padding-block: clamp(2.5rem, 6vw, 4rem); }
.site-footer .thesis { font-family: var(--serif); font-size: 1.15rem; color: var(--on-dark); max-width: 40ch; }
.site-footer .foot-links { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 1.5rem; }
.site-footer a { color: var(--on-dark-soft); font-size: .92rem; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .fine { margin-top: 1.5rem; font-size: .82rem; color: var(--sage); }

/* ---- Consent banner (calm, two equal buttons, no dark pattern) ---- */
.consent { position: fixed; inset: auto 1rem 1rem 1rem; z-index: 50; max-width: 34rem; margin-inline: auto; background: var(--cream); color: var(--ink); border: 1px solid var(--sand); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 .85rem; font-size: .92rem; max-width: none; }
.consent .row { display: flex; gap: .75rem; flex-wrap: wrap; }
.consent .btn { min-height: 42px; padding: .55rem 1.2rem; font-size: .92rem; flex: 1 1 auto; }
/* Equal visual weight, both outline, no dark-pattern nudge toward Allow
   (truth-first applies to consent UX too). */
.consent .btn-primary, .consent .btn-secondary { background: transparent; color: var(--forest); border-color: var(--forest); }

/* ---- Motion: reveal on scroll, gentle ---- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.reveal { opacity: 0; transform: translateY(12px); transition: opacity var(--fade-in) var(--ease), transform var(--fade-in) var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .card, .btn, .faq .answer, .reveal, .embed .glyph { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
  .card:hover { transform: none; }
}

/* ============================================================
   Rev 1 (2026-07-08): the continuous realm, day-cycle scroll (section 4B).
   One painted canvas per page; all content floats over it; the background
   traverses time of day by scroll (opacity cross-fade, GPU-cheap).
   Built + driven by app.js from body[data-realm="layerA,layerB,..."].
   ============================================================ */
.realm { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: var(--deep-forest); }
.realm-layer { position: absolute; inset: 0; background-size: cover; background-position: 62% center; opacity: 0; will-change: opacity; }
.realm-layer.first { opacity: 1; }
/* Always-on scrim: darkens the quiet LEFT third for legible cream text, plus a
   soft top/bottom vignette. A soft gradient, never a white card. */
.realm-scrim { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(102deg, rgba(43,51,31,.46) 0%, rgba(43,51,31,.30) 26%, rgba(43,51,31,.15) 52%, rgba(43,51,31,.04) 78%, transparent 100%),
    linear-gradient(180deg, rgba(43,51,31,.32) 0%, transparent 16%, transparent 78%, rgba(30,38,20,.22) 100%); }

body[data-realm] { background: var(--deep-forest); color: var(--on-dark); }
body[data-realm] .site-nav .brandmark, body[data-realm] .site-nav .nav-links a { color: var(--on-dark); }
body[data-realm] .site-nav .nav-links a:hover { color: #fff; }

/* Hero + sections transparent so the one canvas shows through everywhere.
   Rev 1 polish: tighter vertical rhythm (less dead space), wider measure. */
body[data-realm] .hero { background: none; overflow: visible; position: relative; }
body[data-realm] .hero .wrap { padding-block: clamp(4.5rem, 11vh, 7.5rem) clamp(2rem, 5vw, 3.5rem); }
body[data-realm] .section { background: transparent !important; position: relative; padding-block: clamp(1.75rem, 4vw, 3.25rem); }
body[data-realm] .section .wrap { max-width: 60rem; }
body[data-realm] .section p, body[data-realm] .lede, body[data-realm] .hero .sub { max-width: 46rem; }

/* Content sits above a per-section localized soft scrim so text stays legible over
   bright paint (lamp-glow, lit window, pale walls), reinforced by a soft text halo. */
body[data-realm] .hero > *, body[data-realm] .section > * { position: relative; z-index: 1; }
body[data-realm] .hero::before, body[data-realm] .section::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 82% at 22% 46%, rgba(22,28,14,.54) 0%, rgba(22,28,14,.30) 42%, transparent 74%); }
body[data-realm] h1, body[data-realm] h2, body[data-realm] h3 { color: var(--on-dark); }
body[data-realm] main :is(h1,h2,h3,p,.lede,.underline-note,li,summary) {
  text-shadow: 0 1px 2px rgba(14,20,8,.72), 0 2px 15px rgba(14,20,8,.5); }
body[data-realm] .section p, body[data-realm] .underline-note { color: var(--on-dark-soft); }
body[data-realm] .lede { color: var(--on-dark); }
body[data-realm] main a { color: var(--butter); }
body[data-realm] .section.center { text-align: left; }
body[data-realm] .section.center p, body[data-realm] .section.center .lede { margin-inline: 0; }
body[data-realm] .section.center .cta-row { justify-content: flex-start; }
body[data-realm] .phase-days { color: var(--butter); }

/* Cloud-panels: translucent butter, the only boxed elements. No solid cards. */
body[data-realm] .card { background: rgba(255,236,201,.13); border-color: rgba(255,236,201,.26); box-shadow: none; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
body[data-realm] .card h3 { color: var(--on-dark); }
body[data-realm] .card p { color: var(--on-dark-soft); }
body[data-realm] .card a { color: var(--butter); }
body[data-realm] .faq { background: rgba(255,236,201,.11); border: 1px solid rgba(255,236,201,.2); border-radius: var(--radius); padding: .4rem 1.3rem; -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
body[data-realm] .faq details { border-top-color: rgba(255,236,201,.18); }
body[data-realm] .faq details:last-child { border-bottom-color: rgba(255,236,201,.18); }
body[data-realm] .faq summary { color: var(--on-dark); }
body[data-realm] .faq summary::after { color: var(--butter); }
body[data-realm] .faq .answer { color: var(--on-dark-soft); }
body[data-realm] .embed { border-color: rgba(255,236,201,.22); background: rgba(43,51,31,.4); }

/* Footer blends into the realm: transparent at top so the canvas continues, then
   resolves to a night tone at the very bottom. No hard flat block. */
body[data-realm] .site-footer { background: linear-gradient(180deg, transparent 0%, rgba(30,38,20,.42) 34%, rgba(20,26,12,.9) 100%); }
body[data-realm] .site-footer .thesis, body[data-realm] .site-footer a, body[data-realm] .site-footer .fine { text-shadow: 0 1px 8px rgba(14,20,8,.55); }

@media (prefers-reduced-motion: reduce) { .realm-layer { transition: none !important; } }
