/* ============================================================
   SPANDA — design system
   Wabi-sabi minimalism · Kashmir Shaivism warmth · I Ching sobriety
   ============================================================ */

:root {
  /* Ink & stone */
  --ink: #191d1c;
  --ink-soft: #2c322f;
  --stone: #8f8a7e;
  --stone-light: #b5afa2;

  /* Teal spectrum — true dark teal, midway between the first green and the blue */
  --teal-deep: #0f302e;
  --teal: #1c4b48;
  --teal-mid: #2e6b64;
  --sage: #7fa59e;
  --mist: #c6d3cf;

  /* Earth */
  --paper: #f6f2e9;
  --paper-warm: #efe8da;
  --sand: #d9cfbc;
  --clay: #b3a68e;

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Jost', 'Helvetica Neue', sans-serif;

  --max-w: 1260px;
  --ease: cubic-bezier(.22, .8, .3, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-weight: 300;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--teal-mid); color: var(--paper); }

/* ---------- Typography ---------- */
h1, h2, h3, .serif {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: .01em;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h3 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }

.eyebrow {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--teal-mid);
  margin-bottom: 1.2rem;
  font-weight: 400;
}
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 42em; }
.muted { color: var(--stone); }

/* ---------- Layout ---------- */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 clamp(1.2rem, 4vw, 3.6rem); }
section { padding: clamp(4rem, 10vh, 8rem) 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  transition: transform .4s var(--ease);
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 clamp(1.2rem, 4vw, 3.6rem);
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
/* Floating pill to recall the hidden menu */
.nav-pill {
  all: unset; position: fixed; top: 14px; right: 16px; z-index: 99;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  color: var(--teal); font-size: 1.15rem;
  opacity: 0; pointer-events: none; transform: translateY(-8px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
  box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--teal-deep) 40%, transparent);
}
.nav-pill.show { opacity: 1; pointer-events: auto; transform: none; }
.wordmark {
  font-family: var(--serif); font-size: 1.45rem; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 500;
}
.nav-links { display: flex; gap: 1.9rem; align-items: center; list-style: none; flex-wrap: nowrap; }
.nav-links a {
  font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  position: relative; padding: .3rem 0; font-weight: 300;
  white-space: nowrap;
}
@media (min-width: 861px) and (max-width: 1220px) {
  .nav-links { gap: 1.3rem; }
  .nav-links a { font-size: .72rem; letter-spacing: .06em; }
  .wordmark { font-size: 1.2rem; letter-spacing: .12em; }
}
.nav-links a::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
  background: var(--teal-mid); transition: width .35s var(--ease);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--teal); }

.lang-toggle {
  border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  border-radius: 999px; display: flex; overflow: hidden;
  font-size: .72rem; letter-spacing: .08em; cursor: pointer;
}
.lang-toggle button {
  all: unset; padding: .3rem .7rem; cursor: pointer; transition: all .3s;
}
.lang-toggle button.on { background: var(--ink); color: var(--paper); }

/* note: `all: unset` must come first or it would wipe the display rule —
   this was why the trigram appeared on desktop */
.burger { all: unset; cursor: pointer; font-size: 1.5rem; line-height: 1; display: none; }
@media (max-width: 860px) {
  .burger { display: block; }
  .nav-links {
    position: fixed; inset: 72px 0 auto 0; flex-direction: column;
    background: var(--paper); padding: 2rem 6vw 3rem;
    border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
    display: none; gap: 1.4rem; align-items: flex-start;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh; display: flex; align-items: center;
  position: relative; padding-top: 72px;
  background:
    radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--mist) 55%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--sand) 45%, transparent), transparent 55%),
    var(--paper);
}
.hero-inner { position: relative; z-index: 2; }
.hero h1 { max-width: 12em; }
.hero .lede { margin-top: 1.6rem; }

/* Enso — hand-drawn circle motif */
.enso {
  position: absolute; right: 4vw; top: 50%; transform: translateY(-50%);
  width: min(46vw, 560px); opacity: .9; z-index: 3; pointer-events: none;
}
.hero-inner { z-index: 4; }
@media (max-width: 860px) { .enso { opacity: .25; right: -20vw; width: 90vw; } }
/* Sumi-e ensō, bristle-simulated: ~26 individual bristle trails that
   converge and lift off toward the dry end — the way a loaded brush
   actually leaves ink. Painted in the site's dark teal. */
.enso .bristle { fill: none; stroke: var(--teal-deep); stroke-linecap: round; }
.enso .blob { fill: var(--teal-deep); opacity: .9; }
.enso .reveal-path {
  fill: none; stroke: #fff; stroke-width: 80; stroke-linecap: round;
  stroke-dasharray: 900; stroke-dashoffset: 900;
  animation: draw 2.6s var(--ease) .4s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Washi paper grain over the whole page ---------- */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.045'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ---------- Cursor halo — ink wash moving through the paper ----------
   Smaller, softer, and strongly irregular: each cloud is a wrapper the
   JS moves, whose inner shape rotates, skews and morphs on its own —
   like pigment dispersing in water. It sits in the background layer:
   photos, cards and embeds are lifted above it (z-index 3 below). */
.cursor-halo {
  position: fixed; top: 0; left: 0; pointer-events: none; z-index: 2;
  opacity: 0; transition: opacity 1.4s ease;
}
.cursor-halo.live { opacity: 1; }
.halo-blob { position: absolute; will-change: transform; }
.halo-blob::before {
  content: ''; display: block; width: 100%; height: 100%;
  filter: blur(42px); mix-blend-mode: multiply;
  animation: blobmorph 17s ease-in-out infinite;
}
.halo-blob.b1 { width: 340px; height: 300px; margin: -150px 0 0 -170px; }
.halo-blob.b1::before { background: color-mix(in srgb, var(--teal-mid) 12%, transparent); }
.halo-blob.b2 { width: 250px; height: 280px; margin: -140px 0 0 -125px; }
.halo-blob.b2::before {
  background: color-mix(in srgb, var(--sage) 11%, transparent);
  animation-duration: 23s; animation-direction: reverse;
}
.halo-blob.b3 { width: 190px; height: 170px; margin: -85px 0 0 -95px; }
.halo-blob.b3::before {
  background: color-mix(in srgb, var(--sand) 20%, transparent);
  animation-duration: 29s;
}
@keyframes blobmorph {
  0%, 100% { border-radius: 62% 38% 52% 48% / 44% 62% 38% 56%; transform: rotate(0deg) skew(0deg, 0deg) scale(1); }
  25%      { border-radius: 40% 60% 44% 56% / 62% 36% 64% 38%; transform: rotate(28deg) skew(4deg, -3deg) scale(1.12, .92); }
  50%      { border-radius: 55% 45% 66% 34% / 38% 58% 42% 62%; transform: rotate(-14deg) skew(-5deg, 2deg) scale(.9, 1.1); }
  75%      { border-radius: 46% 54% 38% 62% / 58% 44% 60% 40%; transform: rotate(17deg) skew(3deg, 5deg) scale(1.06, .95); }
}
/* keep the wash off photos, cards, embeds, the circle and the enso */
.photo, .card, iframe, .media-card, .breath-wrap, .breath, .sound-toggle,
.hexagram, .embed-frame, .post-card, .yt-facade {
  position: relative; z-index: 3;
}
@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  .cursor-halo { display: none; }
}

/* ---------- Logo mark: the O of AGHORA is the circle + bindu ----------
   The trailing letter-spacing after the H already adds .18em, so the
   flex gap stays 0 and the mark carries a matching .18em on its right —
   equal air on both sides of the O. */
.wordmark { display: inline-flex; align-items: center; gap: 0; }
.wordmark svg.mark {
  width: .82em; height: .82em; flex: none;
  color: var(--teal); margin-right: .18em; transform: translateY(.02em);
}
footer .wordmark svg.mark { color: var(--sage); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: .95rem 2.4rem; margin-top: 2.4rem;
  border: 1px solid var(--ink); border-radius: 999px;
  font-size: .82rem; letter-spacing: .22em; text-transform: uppercase;
  transition: all .4s var(--ease); cursor: pointer; background: transparent;
  font-family: var(--sans); font-weight: 400; color: var(--ink);
}
.btn:hover { background: var(--ink); color: var(--paper); letter-spacing: .28em; }
.btn.solid { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--paper); }
.btn.solid:hover { background: var(--teal); border-color: var(--teal); }
.btn.light { border-color: var(--paper); color: var(--paper); }
.btn.light:hover { background: var(--paper); color: var(--teal-deep); }

/* ---------- Cards ---------- */
.card {
  background: var(--paper-warm);
  border: 1px solid color-mix(in srgb, var(--clay) 35%, transparent);
  border-radius: var(--radius, 12px);
  padding: 2.6rem 2.2rem;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
  position: relative;
}
.card[data-href] { cursor: pointer; }
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 48px -24px color-mix(in srgb, var(--teal-deep) 30%, transparent);
}
.card h3 { margin: 1.2rem 0 .8rem; }
.card p { font-size: .96rem; color: var(--ink-soft); }
.card .glyph {
  font-size: 1.6rem; color: var(--teal-mid); font-family: var(--serif);
  font-variant-emoji: text; /* keep ✒ as a glyph, not an emoji, on mobile */
}
.card a.more {
  display: inline-block; margin-top: 1.4rem; font-size: .8rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--teal);
  border-bottom: 1px solid var(--sage);
  transition: letter-spacing .3s var(--ease);
}
.card a.more:hover { letter-spacing: .24em; }

/* ---------- Dark sections ---------- */
.dark {
  background:
    radial-gradient(1000px 500px at 85% 0%, color-mix(in srgb, var(--teal) 50%, transparent), transparent 60%),
    var(--teal-deep);
  color: var(--paper);
}
.dark .eyebrow { color: var(--sage); }
.dark .lede, .dark p { color: color-mix(in srgb, var(--paper) 82%, var(--sage)); }
.dark .card { background: color-mix(in srgb, var(--paper) 6%, transparent); border-color: color-mix(in srgb, var(--paper) 14%, transparent); }
.dark .card p { color: color-mix(in srgb, var(--paper) 75%, transparent); }
.dark .card h3 { color: var(--paper); }

/* ---------- Photo placeholders ---------- */
.photo {
  aspect-ratio: 4 / 5; width: 100%;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--sand) 70%, transparent), color-mix(in srgb, var(--mist) 60%, transparent)),
    var(--paper-warm);
  border: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
  display: flex; align-items: center; justify-content: center;
  color: var(--stone); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
  overflow: hidden;
}
.photo.wide { aspect-ratio: 16 / 9; }
.photo.landscape { aspect-ratio: 3 / 2; }
.photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Hexagram (I Ching) ---------- */
.hexagram { display: flex; flex-direction: column-reverse; gap: 16px; width: 210px; margin: 0 auto; }
.hex-line { display: flex; gap: 16px; height: 15px; padding: 4px 0; box-sizing: content-box; cursor: pointer; }
.hex-line .bar {
  flex: 1; background: var(--paper); border-radius: 2px;
  transition: background .35s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease);
}
.hex-line:hover .bar {
  background: var(--sage);
  transform: scaleY(1.35);
  box-shadow: 0 0 18px color-mix(in srgb, var(--sage) 55%, transparent);
}
.hex-line.flip .bar { animation: flip .5s var(--ease); }
@keyframes flip {
  0% { transform: scaleX(0); opacity: 0; }
  100% { transform: scaleX(1); opacity: 1; }
}

/* ---------- Sound toggle (switch) ---------- */
.sound-toggle {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .9rem;
  font-family: var(--sans); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--mist);
}
.sound-toggle .track {
  width: 48px; height: 26px; border-radius: 999px; position: relative;
  border: 1px solid var(--sage); background: transparent;
  transition: background .35s var(--ease), border-color .35s var(--ease);
  flex: none;
}
.sound-toggle .track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--sage);
  transition: transform .35s var(--ease), background .35s var(--ease);
}
.sound-toggle:hover .track { border-color: var(--mist); }
.sound-toggle.on .track { background: var(--sage); border-color: var(--sage); }
.sound-toggle.on .track::after { transform: translateX(22px); background: var(--teal-deep); }

/* ---------- Video cards ---------- */
.video-card { position: relative; display: block; }
.video-card .photo { aspect-ratio: 16 / 9; }

/* ---------- Breathing circle ---------- */
.breath-wrap { display: flex; flex-direction: column; align-items: center; gap: 1.6rem; }
.breath {
  width: 180px; height: 180px; border-radius: 50%;
  border: 1px solid var(--sage);
  background: radial-gradient(circle, color-mix(in srgb, var(--teal-mid) 35%, transparent), transparent 70%);
  animation: breathe 10s ease-in-out infinite;
}
.breath-label { font-family: var(--serif); font-size: 1.1rem; color: var(--sage); letter-spacing: .1em; }
@keyframes breathe {
  0%, 100% { transform: scale(.72); }
  40% { transform: scale(1.05); }
  55% { transform: scale(1.05); }
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.vis { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .12s; }
.reveal.d2 { transition-delay: .24s; }
.reveal.d3 { transition-delay: .36s; }

/* ---------- Divider ---------- */
.hr-brush {
  width: 90px; height: 2px; margin: 2.2rem 0;
  background: linear-gradient(90deg, var(--teal-mid), transparent);
}

/* ---------- Quote block ---------- */
.quote {
  font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-style: italic; font-weight: 400; max-width: 26em;
  margin: 0 auto; text-align: center; line-height: 1.5;
}
.quote-src { text-align: center; margin-top: 1.6rem; font-size: .8rem; letter-spacing: .24em; text-transform: uppercase; color: var(--stone); }

/* ---------- Forms / embeds ---------- */
.embed-frame {
  border: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
  background: var(--paper-warm); width: 100%; min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  color: var(--stone); font-size: .85rem; letter-spacing: .12em; text-align: center; padding: 2rem;
}
.newsletter input {
  all: unset; border-bottom: 1px solid var(--sage); padding: .8rem .2rem;
  width: min(360px, 100%); font-size: 1rem; color: inherit;
}
.newsletter { display: flex; gap: 1.4rem; flex-wrap: wrap; align-items: flex-end; margin-top: 2rem; }
.newsletter .btn { margin-top: 0; }

/* ---------- Media previews ---------- */
.media-card { position: relative; }
.media-card .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  border-radius: 50%; border: 1px solid var(--paper);
  background: color-mix(in srgb, var(--ink) 35%, transparent);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  color: var(--paper); font-size: 1.1rem; cursor: pointer;
  transition: transform .4s var(--ease), background .4s;
}
.media-card:hover .play { transform: scale(1.12); background: var(--teal-mid); }
.media-title { margin-top: 1rem; font-family: var(--serif); font-size: 1.15rem; }
.media-sub { font-size: .82rem; color: var(--stone); letter-spacing: .06em; }

/* ---------- Footer ---------- */
footer {
  background: var(--ink); color: color-mix(in srgb, var(--paper) 70%, transparent);
  padding: 4rem 0 2.5rem; font-size: .88rem;
}
footer .wordmark { color: var(--paper); }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr; } }
footer a:hover { color: var(--paper); }
footer ul { list-style: none; display: grid; gap: .5rem; margin-top: 1rem; }
.foot-note { margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid color-mix(in srgb, var(--paper) 12%, transparent); font-size: .75rem; letter-spacing: .08em; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---------- Page hero (interior pages) ---------- */
.page-hero { padding: calc(72px + clamp(4rem, 12vh, 8rem)) 0 clamp(3rem, 8vh, 5rem); }

/* ---------- Offering cards ---------- */
.offer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8rem; margin-top: 3rem; }
@media (max-width: 900px) { .offer-grid { grid-template-columns: 1fr; } }
.offer-card {
  cursor: pointer;
  display: flex; flex-direction: column;
  background: var(--paper-warm);
  border: 1px solid color-mix(in srgb, var(--clay) 35%, transparent);
  border-radius: var(--radius); padding: 2.4rem 2rem 1.8rem;
  position: relative; z-index: 3; overflow: hidden;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease), border-color .5s;
}
.offer-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 26px 50px -26px color-mix(in srgb, var(--teal-deep) 35%, transparent);
  border-color: color-mix(in srgb, var(--teal-mid) 45%, transparent);
}
/* thin teal brushstroke painting across the top edge on hover */
.offer-card::before {
  content: ''; position: absolute; top: 0; left: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--teal-mid), var(--sage) 60%, transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .7s var(--ease);
}
.offer-card:hover::before { transform: scaleX(1); }
.offer-card .mark {
  width: 26px; height: 26px; color: var(--sage); flex: none;
  transition: color .4s, transform .7s var(--ease);
}
.offer-card:hover .mark { color: var(--teal); transform: rotate(90deg); }
.offer-card .num {
  position: absolute; top: 1.7rem; right: 1.9rem;
  font-family: var(--serif); font-size: .85rem; letter-spacing: .3em;
  color: var(--stone-light);
}
.offer-card h3 { margin: 1.4rem 0 .8rem; }
.offer-card > p { font-size: .95rem; color: var(--ink-soft); margin-bottom: 1.6rem; }
.offer-foot {
  margin-top: auto; padding-top: 1.4rem;
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
}
.offer-foot .price { font-family: var(--serif); font-size: 1.15rem; color: var(--teal); }
.offer-foot .book {
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--stone); white-space: nowrap;
  transition: color .3s, letter-spacing .3s;
}
.offer-card:hover .book { color: var(--teal); letter-spacing: .26em; }

/* ---------- Photo tilt (3D response to cursor / gyroscope) ---------- */
.photo, .media-card { will-change: transform; }
.tiltable { transition: transform .5s var(--ease); }
.tiltable.tilting { transition: transform .12s ease-out; }

/* ---------- Meditation hero: photo matches text height ---------- */
body[data-page="med"] .page-hero .grid-2 { align-items: stretch; }
body[data-page="med"] .page-hero .photo {
  aspect-ratio: auto; height: 100%; min-height: 340px;
}

/* ---------- YouTube facade (site-styled preview before play) ---------- */
.yt-facade {
  display: block; width: 100%; border: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
  background: var(--teal-deep); cursor: pointer; overflow: hidden; padding: 0;
}
.yt-facade img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: .85; filter: saturate(.85);
  transition: transform .6s var(--ease), opacity .4s;
}
.yt-facade:hover img { transform: scale(1.04); opacity: 1; }
.yt-facade .fplay {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  border-radius: 50%; border: 1px solid var(--paper);
  background: color-mix(in srgb, var(--teal-deep) 55%, transparent);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  color: var(--paper); font-size: 1.1rem; pointer-events: none;
  transition: transform .4s var(--ease), background .4s;
}
.yt-facade:hover .fplay { transform: scale(1.12); background: var(--teal-mid); }

/* ---------- Substack post cards ---------- */
.post-card {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.8rem;
  padding: 1.8rem 0; border-bottom: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
  align-items: center; color: inherit;
}
.post-card .thumb {
  aspect-ratio: 3 / 2; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--clay) 35%, transparent);
}
.post-card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s var(--ease);
}
.post-card:hover .thumb img { transform: scale(1.05); }
.post-card h3 { transition: color .3s; }
.post-card:hover h3 { color: var(--teal); }
.post-card .post-sub { color: var(--ink-soft); font-size: .95rem; margin-top: .4rem; }
.post-card .post-date {
  font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--stone); margin-top: .8rem;
}
@media (max-width: 640px) {
  .post-card { grid-template-columns: 1fr; gap: 1rem; }
}

/* ---------- Offer detail modal ---------- */
.offer-modal { position: fixed; inset: 0; z-index: 300; visibility: hidden; }
.offer-modal.open { visibility: visible; }
.offer-modal .veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 120% at 50% 45%,
      color-mix(in srgb, var(--teal-deep) 42%, transparent),
      color-mix(in srgb, var(--teal-deep) 72%, transparent));
  backdrop-filter: blur(10px) saturate(1.05); -webkit-backdrop-filter: blur(10px) saturate(1.05);
  opacity: 0; transition: opacity .45s ease;
}
.offer-modal.open .veil { opacity: 1; }
.offer-modal .panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -46%) scale(.97); opacity: 0;
  width: min(680px, calc(100% - 2rem));
  max-height: min(88vh, 860px); overflow-y: auto;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.04'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 1px solid color-mix(in srgb, var(--clay) 40%, transparent);
  border-radius: 16px; padding: 3rem 2.6rem 2.4rem;
  box-shadow: 0 44px 90px -34px rgba(10, 30, 28, .55);
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}
.offer-modal.open .panel { opacity: 1; transform: translate(-50%, -50%) scale(1); }
/* teal brushstroke painting across the top edge as the panel opens */
.offer-modal .panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--sage) 55%, transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .9s var(--ease) .2s;
}
.offer-modal.open .panel::before { transform: scaleX(1); }
/* content settles in sequence, like objects placed on a table */
.offer-modal .panel > *:not(.mclose) {
  opacity: 0; transform: translateY(12px);
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}
.offer-modal.open .panel > *:not(.mclose) { opacity: 1; transform: none; }
.offer-modal.open .panel > *:nth-child(3) { transition-delay: .1s; }
.offer-modal.open .panel > *:nth-child(4) { transition-delay: .16s; }
.offer-modal.open .panel > *:nth-child(5) { transition-delay: .22s; }
.offer-modal.open .panel > *:nth-child(6) { transition-delay: .3s; }
.offer-modal.open .panel > *:nth-child(7) { transition-delay: .4s; }
.offer-modal.open .panel > *:nth-child(8) { transition-delay: .48s; }
.offer-modal .mclose {
  all: unset; position: absolute; top: 1.3rem; right: 1.5rem;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--stone); font-size: 1.05rem;
  transition: color .3s, background .3s, transform .45s var(--ease);
}
.offer-modal .mclose:hover {
  color: var(--teal); transform: rotate(90deg);
  background: color-mix(in srgb, var(--sage) 18%, transparent);
}
.offer-modal .m-head { display: flex; align-items: center; gap: .9rem; }
.offer-modal .m-head .mark {
  width: 30px; height: 30px; color: var(--teal); flex: none;
  transition: transform 1.1s var(--ease) .25s;
  transform: rotate(-90deg);
}
.offer-modal.open .m-head .mark { transform: rotate(0deg); }
.offer-modal .m-num {
  font-family: var(--serif); font-size: .85rem; letter-spacing: .3em;
  color: var(--sage);
}
.offer-modal .m-title { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-top: .5rem; line-height: 1.2; }
.offer-modal .m-price { font-family: var(--serif); font-size: 1.15rem; color: var(--teal); margin-top: .7rem; }
.offer-modal .m-long { margin-top: 1.4rem; color: var(--ink-soft); line-height: 1.75; }
.offer-modal .m-cal { margin-top: 2rem; min-height: 220px; }
.offer-modal .m-mail { margin-top: 1.6rem; }
@media (max-width: 640px) {
  /* bottom sheet on phones */
  .offer-modal .panel {
    left: 0; right: 0; top: auto; bottom: 0; width: 100%;
    transform: translateY(6%); border-radius: 16px 16px 0 0;
    max-height: 92svh; padding: 2.2rem 1.4rem 2rem;
  }
  .offer-modal.open .panel { transform: translateY(0); }
}

/* ---------- Page transitions ----------
   Navigation is fluid (content swapped in place, shell persists);
   #page cross-fades during the swap. */
body { animation: pagein .4s ease; }
@keyframes pagein { from { opacity: 0; } }
#page { transition: opacity .16s ease, transform .16s ease; }
#page.page-out { opacity: 0; transform: translateY(-12px); }
#page.in-up { animation: pageInUp .38s var(--ease); }
@keyframes pageInUp { from { opacity: 0; transform: translateY(16px); } }
/* directional page-turn for gate → gate navigation */
#page.out-fwd  { opacity: 0; transform: translateX(-30px); }
#page.out-back { opacity: 0; transform: translateX(30px); }
#page.in-fwd  { animation: pageInFwd .38s var(--ease); }
#page.in-back { animation: pageInBack .38s var(--ease); }
@keyframes pageInFwd  { from { opacity: 0; transform: translateX(34px); } }
@keyframes pageInBack { from { opacity: 0; transform: translateX(-34px); } }

/* ---------- Rounded imagery ---------- */
:root { --radius: 12px; }
.photo, .yt-facade, .post-card .thumb, iframe, .embed-frame { border-radius: var(--radius); }

/* ---------- Smart width: media breathes wider, reading sits narrower ---------- */
.wrap.wide { max-width: min(1520px, 100%); }
.wrap.narrow { max-width: 900px; }

/* ---------- Hexagram oracle panel ---------- */
.hex-info { margin-top: 2.4rem; min-height: 7em; }
.hex-info .hex-today {
  font-size: .72rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--sage); opacity: .85; margin-bottom: .6rem;
}
.hex-info .hex-num {
  font-family: var(--serif); font-size: 1rem; color: var(--sage);
  letter-spacing: .3em;
}
.hex-info .hex-title {
  font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  color: var(--paper); margin-top: .3rem; font-weight: 500;
}
.hex-info .hex-sentence {
  color: color-mix(in srgb, var(--paper) 78%, var(--sage));
  font-size: .98rem; max-width: 34em; margin: .8rem auto 0; line-height: 1.7;
}
.hex-info.swap > * { animation: hexswap .5s var(--ease); }
.hex-deeper {
  display: inline-block; margin-top: 1.2rem;
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sage); border-bottom: 1px solid color-mix(in srgb, var(--sage) 55%, transparent);
  padding-bottom: .2rem; transition: color .3s, letter-spacing .3s;
}
.hex-deeper:hover { color: var(--paper); letter-spacing: .28em; }

/* ---------- Gate pages ----------
   Everything sized so number, figure, text and navigation share one screen. */
body { transition: background-color .4s ease; } /* paper ↔ deep teal glides during swaps */
body[data-page="gate"], body[data-page="oracle"], body[data-page="gates"] { background: var(--teal-deep); }
/* gates index on the dark ground */
body[data-page="gates"] h1 { color: var(--paper); }
body[data-page="gates"] .lede { color: color-mix(in srgb, var(--paper) 80%, var(--sage)); }
body[data-page="gates"] .eyebrow { color: var(--sage); }
/* cards stay warm paper on the dark ground - stone tiles on deep water */
/* ghost card that opens into the gate page */
.gate-cell.ghost { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; }
.gate-number {
  font-family: var(--serif); font-weight: 400; line-height: 1;
  font-size: clamp(3rem, 6.5vw, 4.2rem); color: var(--sage);
  margin-bottom: 1rem;
}
.gate-hero { padding: calc(72px + 1.2rem) 0 1.8rem; min-height: 100svh; display: flex; align-items: center; }
.gate-hero .hexagram { pointer-events: none; width: 160px; gap: 10px; margin: 0 auto 1.2rem; }
.gate-hero .hex-line { height: 10px; gap: 10px; padding: 2px 0; }
.gate-hero h1 { font-size: clamp(2rem, 4vw, 2.6rem) !important; margin-top: .4rem !important; }
.gate-hero .lede { font-size: 1.08rem; }
.gate-hero .gate-meta { font-size: .76rem; letter-spacing: .16em; }
.gate-hero p:not(.gate-number):not(.gate-meta) { font-size: 1.03rem; line-height: 1.68; }
.gate-hero .wrap > p[style*="max-width"] { margin-top: 1rem !important; }
.gate-meta {
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--sage); line-height: 2;
}
.gate-spectrum {
  font-family: var(--serif); font-size: 1.02rem; letter-spacing: .06em;
  color: color-mix(in srgb, var(--paper) 75%, var(--sage)); margin-top: 1.2rem;
}
.gate-nav {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 1.2rem 2rem; margin-top: 1.6rem;
  font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
}
/* oracle page */
#oracle-hex { width: 165px; gap: 11px; margin: 2.2rem auto 1.6rem; min-height: 132px; }
#oracle-hex .hex-line { cursor: default; }
#oracle-info[hidden] { display: none; }
@media (max-width: 640px) {
  .gate-number { font-size: 2.7rem; margin-bottom: 1rem; }
  .gate-hero { padding-top: calc(72px + 1rem); }
  .gate-hero .hexagram, #oracle-hex { width: 132px; gap: 9px; }
  .gate-hero .hex-line { height: 8px; gap: 9px; }
  .gate-meta { font-size: .62rem; letter-spacing: .12em; line-height: 1.9; }
  .gate-nav { gap: .9rem 1.3rem; font-size: .68rem; }
  .gate-spectrum { font-size: .88rem; }
  .gates-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: .6rem; }
  .gate-cell { padding: .85rem .4rem; }
}
.gate-nav a { color: var(--sage); transition: color .3s; }
.gate-nav a:hover { color: var(--paper); }
.gates-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .8rem;
}
.gate-cell {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center;
  padding: 1.25rem .6rem 1.05rem; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--clay) 45%, transparent);
  background: var(--paper-warm);
  transition: transform .45s var(--ease), border-color .45s, box-shadow .45s var(--ease);
}
.gate-cell::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--teal-mid), var(--sage) 60%, transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s var(--ease);
}
.gate-cell:hover::before { transform: scaleX(1); }
.gate-cell:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--teal-mid) 55%, transparent);
  box-shadow: 0 24px 44px -20px rgba(0, 0, 0, .5);
}
.gate-cell .mini-hex {
  display: flex; flex-direction: column-reverse; gap: 3px; width: 30px; margin-bottom: .2rem;
}
.gate-cell .mini-hex .ml { display: flex; gap: 3px; height: 3px; }
.gate-cell .mini-hex .ml span {
  flex: 1; background: color-mix(in srgb, var(--teal-mid) 75%, transparent);
  border-radius: 1px; transition: background .35s;
}
.gate-cell:hover .mini-hex .ml span { background: var(--teal); }
.gate-cell .gnum { font-family: var(--serif); font-size: 1.35rem; color: var(--teal); line-height: 1.1; }
.gate-cell .gtitle { font-size: .74rem; letter-spacing: .06em; color: var(--ink-soft); line-height: 1.35; }
@keyframes hexswap { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Facade caption ---------- */
.yt-facade .fcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2rem 1rem .9rem;
  background: linear-gradient(transparent, color-mix(in srgb, var(--teal-deep) 82%, transparent));
  color: var(--paper); font-family: var(--serif); font-size: 1.02rem;
  text-align: center; line-height: 1.35; pointer-events: none;
}

/* ---------- Mobile refinements ---------- */
@media (max-width: 640px) {
  section { padding: 3.2rem 0; }
  .hero { min-height: 92svh; }
  .enso { opacity: .22; }
  h1 { font-size: clamp(2.3rem, 11vw, 3rem); }
  .lede { font-size: 1.02rem; }
  .grid-2, .grid-3 { gap: 1.6rem; }
  .offer-row { grid-template-columns: 1fr; gap: .5rem; padding: 1.5rem 0; }
  .offer-row .price { font-size: 1.1rem; }
  .quote { font-size: 1.35rem; }
  .card { padding: 2rem 1.6rem; }
  .btn { padding: .85rem 1.9rem; letter-spacing: .18em; }
  .foot-note { flex-direction: column; align-items: flex-start; }
  body[data-page="med"] .page-hero .photo { min-height: 240px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .enso .reveal-path { stroke-dashoffset: 0; }
  html { scroll-behavior: auto; }
}
