/* ═══════════════════════════════════════════════════════════════════
   Dailygreens — substance layer (post adversarial-pass refactor)

   Loaded AFTER main.css. Now LEAN: only the atmospheric upgrades
   that are actually deployed in HTML. The previous build defined
   7 surface tones, 6 utility classes, 10 named type classes that
   were never instantiated — they're stripped here.

   This file owns:
   - Body grain (split light/dark — D-Craft Failure 6)
   - Scroll progress bar
   - Preloader (counter + bar)
   - Persistent ring overlay (hero-clipped via JS)
   - Marquee track
   - Mix-blend nav
   - Magnetic CTA primary-flip
   - .section-dark surface for charcoal sections
   - Pulse dot
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ─── Editorial easing (additive, brand-locked) ─── */
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-elastic:   cubic-bezier(0.68, -0.6, 0.32, 1.6);

  /* ─── Dark surfaces (two tones — charcoal + obsidian) ─── */
  --charcoal: #0F1217;          /* near-black with green undertone */
  --obsidian: #050507;          /* true near-black, the deepest tone */
  --cream-on-dark: rgba(250, 246, 236, 0.92);
  --cream-muted-on-dark: rgba(250, 246, 236, 0.6);

  /* ─── Alpha utility (kept — these ARE used) ─── */
  --ink-08: rgba(26, 53, 40, 0.08);
  --bone-line-dark: rgba(250, 246, 236, 0.08);
}

/* ─────────────────────────────────────────────────────────────
   GRAIN — light variant on bone, dark variant on charcoal
   (D-Craft Failure 6: opacity was wrong on both surfaces)
   ───────────────────────────────────────────────────────────── */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 256px 256px;
}

/* On dark sections, multiply darkens grain into nothing — flip to screen. */
.section-dark::before,
.cinema::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 256px 256px;
}

/* ─────────────────────────────────────────────────────────────
   SCROLL PROGRESS — pinned 2px bar at top of viewport
   ───────────────────────────────────────────────────────────── */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  z-index: 10000;
  pointer-events: none;
}

.scroll-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ink), var(--butter, #D4A24B));
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

/* ─────────────────────────────────────────────────────────────
   PRELOADER — counter 0→100 + butter gradient bar
   (D-Rigor Failure 8: cut from 1.6s → 800ms — see substance.js)
   ───────────────────────────────────────────────────────────── */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--bone, #F4EFE6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 32px;
  transition: opacity 600ms var(--ease-out-quint), visibility 600ms var(--ease-out-quint);
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}

.preloader__mark {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.005em;
  color: var(--ink, #1A3528);
  opacity: 0.85;
}

.preloader__count {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-style: italic;
  font-size: clamp(96px, 14vw, 168px);
  letter-spacing: -0.04em;
  color: var(--ink, #1A3528);
  font-feature-settings: "tnum";
  line-height: 1;
}

.preloader__bar {
  width: clamp(180px, 22vw, 320px);
  height: 1px;
  background: var(--ink-08);
  position: relative;
  overflow: hidden;
}

.preloader__bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--ink, #1A3528), var(--butter, #D4A24B));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 800ms var(--ease-out-quint);
}

.preloader.is-counting .preloader__bar::after {
  transform: scaleX(1);
}

html.is-loading,
html.is-loading body {
  overflow: hidden;
  height: 100vh;
}

/* ─────────────────────────────────────────────────────────────
   PERSISTENT OVERLAY — slow-rotating triple ring, hero-only.
   Opacity driven by JS --overlay-fade (Verdant Pattern 2):
   holds 1 from 0–4% scroll, fades to 0 by 8%.
   ───────────────────────────────────────────────────────────── */

.persistent-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1;
  pointer-events: none;
  width: 1400px;
  height: 1400px;
  max-width: 95vw;
  max-height: 95vw;
  transform: translate(-50%, -50%) rotate(0deg);
  opacity: calc(0.06 * var(--overlay-fade, 1));
  color: var(--ink, #1A3528);
  animation: persistent-rotate 90s linear infinite;
  will-change: transform, opacity;
  transition: opacity 220ms linear;
}

@keyframes persistent-rotate {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.persistent-overlay svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .persistent-overlay {
    animation: none;
  }
}

/* ─────────────────────────────────────────────────────────────
   MARQUEE — italic Cormorant strip at hero scale
   ───────────────────────────────────────────────────────────── */

.marquee {
  overflow: hidden;
  background: var(--bone, #F4EFE6);
  color: var(--ink, #1A3528);
  padding: 28px 0;
  border-top: 1px solid var(--ink-08);
  border-bottom: 1px solid var(--ink-08);
  position: relative;
}

.marquee__track {
  display: flex;
  white-space: nowrap;
  gap: 48px;
  animation: marquee-scroll 48s linear infinite;
  will-change: transform;
}

.marquee__track > span {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(32px, 5.5vw, 64px);
  letter-spacing: -0.018em;
  line-height: 1;
  flex-shrink: 0;
  color: var(--ink, #1A3528);
}

.marquee__track > i {
  font-style: normal;
  color: var(--butter, #D4A24B);
  flex-shrink: 0;
  font-size: clamp(32px, 5.5vw, 64px);
  line-height: 1;
}

@keyframes marquee-scroll {
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee__track {
    animation: none;
  }
}

/* ─────────────────────────────────────────────────────────────
   MIX-BLEND NAV — inverts over any background.
   Apply class="nav is-blend" to header.
   ───────────────────────────────────────────────────────────── */

.nav.is-blend {
  mix-blend-mode: difference;
  isolation: isolate;
}

.nav.is-blend a,
.nav.is-blend .logo,
.nav.is-blend .logo-text span,
.nav.is-blend .nav-links a {
  color: #F4EFE6;
}

.nav.is-blend .nav-cta {
  border-color: #F4EFE6;
  color: #F4EFE6;
}

/* ─────────────────────────────────────────────────────────────
   PRIMARY CTA flip — ink fill default, butter on hover
   (D-Craft Failure 7: button variants collapsed elsewhere; this
   adds the brand butter-flip on the surviving primary.)
   ───────────────────────────────────────────────────────────── */

.btn.btn-primary {
  background: var(--ink, #1A3528);
  color: var(--cream, #FAF6EC);
  border: 1px solid var(--ink, #1A3528);
  transition: background 320ms var(--ease-out-quint),
              color 320ms var(--ease-out-quint),
              border-color 320ms var(--ease-out-quint),
              transform 220ms var(--ease-out-quint);
  box-shadow: 0 12px 32px -16px rgba(26, 53, 40, 0.32);
}

.btn.btn-primary:hover {
  background: var(--butter, #D4A24B);
  color: var(--ink, #1A3528);
  border-color: var(--butter, #D4A24B);
}

.btn.btn-primary.btn-light {
  background: var(--cream, #FAF6EC);
  color: var(--ink, #1A3528);
  border-color: var(--cream, #FAF6EC);
}

.btn.btn-primary.btn-light:hover {
  background: var(--butter, #D4A24B);
  color: var(--ink, #1A3528);
  border-color: var(--butter, #D4A24B);
}

.btn.btn-primary.btn-large {
  padding: 1.25rem 2.25rem;
  font-size: 1rem;
}

/* ─────────────────────────────────────────────────────────────
   .section-dark — charcoal surface with cream text
   Apply class="section-dark" to any <section> for a dark moment.
   (D-Craft Failure 2: was the 7-section bone flatline; this is
   the deployed dark token, the rest of the ladder stripped.)
   ───────────────────────────────────────────────────────────── */

.section-dark {
  background: var(--charcoal);
  color: var(--cream-on-dark);
  position: relative;
}

/* Obsidian variant — deepest tone. Use for refusal lists, closer CTAs,
   single-statement quote moments. */
.section-obsidian {
  background: var(--obsidian);
  color: var(--cream-on-dark);
  position: relative;
}

/* Both dark surfaces share these inversions */
.section-dark .eyebrow,
.section-obsidian .eyebrow,
.section-dark .chapter-marker,
.section-obsidian .chapter-marker {
  color: var(--cream-muted-on-dark);
}

.section-obsidian h1,
.section-obsidian h2,
.section-obsidian h3,
.section-obsidian .h1,
.section-obsidian .h2,
.section-obsidian .h3 {
  color: #F7F2E6;
}

.section-obsidian em {
  color: var(--cream-on-dark);
}

.section-obsidian p,
.section-obsidian .lead,
.section-obsidian .muted,
.section-obsidian .text-muted {
  color: rgba(250, 246, 236, 0.78);
}

.section-obsidian hr,
.section-obsidian .hairline {
  border-color: var(--bone-line-dark);
  background: var(--bone-line-dark);
}

.section-obsidian a {
  color: var(--butter, #D4A24B);
}

.section-dark .eyebrow {
  color: var(--cream-muted-on-dark);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark .h1,
.section-dark .h2,
.section-dark .h3 {
  color: #F7F2E6;
}

.section-dark em {
  color: var(--cream-on-dark);
}

.section-dark .muted,
.section-dark .text-muted,
.section-dark p,
.section-dark .lead {
  color: var(--cream-muted-on-dark);
}

.section-dark .lead,
.section-dark p {
  color: rgba(250, 246, 236, 0.85);
}

.section-dark hr,
.section-dark .hairline {
  border-color: var(--bone-line-dark);
  background: var(--bone-line-dark);
}

/* ─────────────────────────────────────────────────────────────
   PULSE DOT — "live" / "now" indicator
   ───────────────────────────────────────────────────────────── */

.pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--butter, #D4A24B);
  box-shadow: 0 0 0 0 var(--butter, #D4A24B);
  animation: pulse-dot-anim 2.4s var(--ease-out-quint) infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes pulse-dot-anim {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 162, 75, 0.45);
    transform: scale(1);
  }
  60% {
    box-shadow: 0 0 0 12px rgba(212, 162, 75, 0);
    transform: scale(1.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(212, 162, 75, 0);
    transform: scale(1);
  }
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — tighten substance layer on mobile
   ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .marquee__track > span,
  .marquee__track > i {
    font-size: clamp(22px, 6vw, 32px);
  }
  .marquee__track {
    gap: 32px;
  }
  .persistent-overlay {
    width: 110vw;
    height: 110vw;
    opacity: calc(0.04 * var(--overlay-fade, 1));
  }
  .preloader__count {
    font-size: clamp(64px, 18vw, 120px);
  }
}
