/* ════════════════════════════════════════════════════════════
   CHAI — LIGHT VERSION (wordmark logo, cream-dominant)
   Editorial humanities-AI lab. NTU 2026—2029.
   ════════════════════════════════════════════════════════════ */

:root {
  /* Earth & cream */
  --cream:        #FAEFD0;
  --cream-soft:  #F4EFDD;
  --cream-warm:  #FEF4A8;
  --paper:        #FBF5E2;

  /* Forest greens */
  --ink:          #2E3A1F;   /* primary text */
  --ink-soft:    #4A5A38;
  --green:        #5C7A3C;
  --green-bright:#7FA254;
  --sage:         #B8D49A;

  /* Accents */
  --gold:         #E8C24A;
  --gold-warm:   #F1D87A;
  --burnt:        #C8963C;

  /* Semantic */
  --bg:           var(--cream);
  --bg-elev:     var(--cream-soft);
  --fg:           var(--ink);
  --fg-soft:     var(--ink-soft);
  --accent:       var(--green);
  --accent-bright: var(--green-bright);
  --hairline:    rgba(46,58,31,0.18);
  --hairline-strong: rgba(46,58,31,0.4);

  /* Typography
     Bricolage Grotesque (+ Noto Sans TC): big confident geometric sans for
       the hero title and major section titles — the original look.
     Fraunces: humanist serif for body, paragraph text and small headings.
     IBM Plex Sans: clean utility sans for UI/nav.
     IBM Plex Mono: small-caps style labels and section numbers. */
  --f-headline: 'Bricolage Grotesque', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  --f-display:  'Fraunces', 'Times New Roman', Georgia, serif;
  --f-serif:    'Fraunces', Georgia, serif;
  --f-sans:     'IBM Plex Sans', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  --f-mono:     'IBM Plex Mono', ui-monospace, monospace;

  /* Optical-size adjustments for Fraunces */
  --opsz-hero:    144;     /* large display optical size */
  --opsz-h1:      96;
  --opsz-h2:      48;
  --opsz-body:    14;      /* book / reading optical size */

  /* Scale (fluid) */
  --t-hero:    clamp(2.4rem, 7.6vw, 7rem);
  --t-h1:      clamp(2rem, 4.6vw, 4.2rem);
  --t-h2:      clamp(1.55rem, 3vw, 2.4rem);
  --t-h3:      clamp(1.18rem, 1.55vw, 1.4rem);
  --t-lead:    clamp(1.05rem, 1.45vw, 1.3rem);
  --t-body:    1rem;
  --t-small:   0.78rem;

  /* Layout */
  --pad-x:     clamp(1.25rem, 4vw, 4rem);
  --max-w:     1280px;
}

/* ─────────────── reset ─────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-sans);
  font-feature-settings: "ss01", "cv11";   /* IBM Plex Sans stylistic alt */
  font-optical-sizing: auto;
  font-size: var(--t-body);
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(232,194,74,0.18), transparent 60%),
    radial-gradient(900px 500px at 95% 8%, rgba(127,162,84,0.10), transparent 65%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* subtle paper-grain texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image:
    radial-gradient(rgba(46,58,31,0.045) 1px, transparent 1px),
    radial-gradient(rgba(46,58,31,0.03) 1px, transparent 1px);
  background-size: 3px 3px, 7px 7px;
  background-position: 0 0, 1px 1px;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ─────────────── typography helpers ─────────────── */
/* Fraunces optical-sizing per role.
   Larger sizes use higher opsz (more delicate, contrasty letterforms).
   Smaller sizes use lower opsz (heavier, more legible at body size). */
.serif {
  font-family: var(--f-sans);
  font-weight: 400;
  font-variation-settings: "opsz" var(--opsz-body);
}
h1, h2, h3, .page-title, .section-title, .subsection-title,
.p-title, .p-name, .oc-h, .pd-side h2, .partners li strong,
.t-title, .contact-big, .marquee-track, .hero-title {
  font-optical-sizing: auto;
}
.mono  {
  font-family: var(--f-mono);
  font-size: var(--t-small);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.small { font-size: 0.7rem; }
.zh { font-family: var(--f-headline); font-weight: 600; opacity: 0.78; font-style: normal; }

/* Language-specific labels are supplied through data-i18n. */
.cta-zh,
.zh { display: none; }

/* ═══════════════════════════════════════════════════════════
   NAV
   ═══════════════════════════════════════════════════════════ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 0.75rem var(--pad-x);
  /* Glass that disappears into the page — no color tint, just a soft veil */
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  background: linear-gradient(180deg, rgba(250,239,208,0.92) 0%, rgba(250,239,208,0.65) 80%, rgba(250,239,208,0) 100%);
  border-bottom: 1px solid transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: relative;
  /* Soft radial halo that visually anchors the logo into the page atmosphere */
  isolation: isolate;
}
.brand::before {
  content: "";
  position: absolute;
  inset: -28% -38%;
  background:
    radial-gradient(ellipse at center,
      rgba(232,194,74,0.18) 0%,
      rgba(232,194,74,0.06) 35%,
      transparent 70%);
  z-index: -1;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.5s, transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.brand:hover::before { opacity: 1; transform: scale(1.05); }
.brand-mark {
  height: 60px;
  width: auto;
  transition: transform 0.5s cubic-bezier(.2,.7,.2,1), filter 0.5s;
  /* mix-blend-mode multiply makes the dark green parts of the logo
     stamp into the cream paper like ink — they share the page atmosphere
     rather than sitting on top of it. */
  mix-blend-mode: multiply;
  filter: contrast(1.04) saturate(1.05);
}
.brand:hover .brand-mark {
  transform: none;
}
.brand-mark #robot-head-animated {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: translateY(0);
}
.brand:hover .brand-mark #robot-head-animated {
  animation: robotHeadPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes robotHeadPop {
  0% {
    transform: translateY(3px);
  }
  70% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0);
  }
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.8rem);
}
.nav-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--fg);
  border-radius: 999px;
  transition: background 0.25s, color 0.25s;
  position: relative;
}
.nav-link .num {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--burnt);
  position: relative;
  top: -0.55em;
}
.nav-link:hover { background: rgba(46,58,31,0.06); }
.nav-link.is-active {
  background: var(--ink);
  color: var(--cream);
}
.nav-link.is-active .num { color: var(--gold); }

.nav-utility { display: flex; align-items: center; gap: 0.75rem; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--hairline-strong);
  background: transparent;
  border-radius: 999px;
  color: var(--fg);
  transition: background 0.25s;
}
.lang-toggle:hover { background: rgba(46,58,31,0.06); }
.lang-pill {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.lang-divider { opacity: 0.35; font-size: 0.7rem; }
body[data-lang="en"] .lang-pill[data-lang-pill="en"],
body[data-lang="zh"] .lang-pill[data-lang-pill="zh"] {
  opacity: 1;
  color: var(--accent);
}

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
}
.menu-btn span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--fg);
  transition: transform 0.3s, opacity 0.3s;
}
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* mobile drawer */
.mobile-drawer {
  position: fixed;
  inset: 88px 0 0 0;
  z-index: 40;
  background: var(--cream);
  padding: 2rem var(--pad-x);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(.6,0,.2,1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer nav { display: flex; flex-direction: column; gap: 0.2rem; }
.m-link {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--f-sans);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 500;
}
.m-link .num {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  color: var(--burnt);
  letter-spacing: 0.1em;
}
.m-foot { padding: 1.5rem 0; opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════
   PAGES (SPA swap)
   ═══════════════════════════════════════════════════════════ */
main {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x) 4rem;
  z-index: 2;
}

.page { animation: pageIn 0.6s cubic-bezier(.2,.7,.2,1) both; }
.page[hidden] { display: none !important; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Scroll-revealed sections — staggered subtly to feel earned, not mechanical */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.9s cubic-bezier(.2,.7,.2,1),
    transform 0.9s cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-reveal-delay="1"] { transition-delay: 0.08s; }
.reveal[data-reveal-delay="2"] { transition-delay: 0.16s; }
.reveal[data-reveal-delay="3"] { transition-delay: 0.24s; }

@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ═══════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════ */
.hero {
  position: relative;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(4rem, 9vw, 7rem);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.7rem;
  color: var(--ink-soft);
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.hero-meta .dot { font-size: 0.5rem; color: var(--gold); }

.hero-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: var(--t-hero);
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin: 0 0 clamp(1.25rem, 2.5vw, 2rem);
  max-width: min(100%, 16ch);
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
  color: var(--ink);
  animation: rise 0.9s cubic-bezier(.2,.7,.2,1) 0.1s both;
}
.hero-title .accent { color: var(--ink); }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-title { animation: none; }
}
.hero-title .line {
  display: block;
  /* allow wrapping on small screens — the strike/highlight stay coherent */
}
.hero-title em {
  font-style: italic;
  font-family: var(--f-sans);
  font-weight: 400;
}
.hero-title .strike {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--burnt);
  text-decoration-thickness: 0.12em;
  text-decoration-skip-ink: none;
  /* mask in via a wide ::after pretending to "wipe" the strike on load */
  position: relative;
}
.hero-title .highlight {
  position: relative;
  padding: 0 0.1em;
  white-space: nowrap;
}
.hero-title .highlight::before {
  content: "";
  position: absolute;
  inset: 12% -0.08em;
  background: var(--gold);
  z-index: -1;
  transform: skew(-6deg);
  border-radius: 4px;
  opacity: 0.85;
}

.hero-sub {
  font-family: var(--f-sans);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  font-size: var(--t-lead);
  font-weight: 380;
  line-height: 1.55;
  max-width: 52ch;
  color: var(--ink-soft);
  margin: 0 0 clamp(2rem, 4vw, 3rem);
  animation: rise 0.9s cubic-bezier(.2,.7,.2,1) 0.25s both;
  letter-spacing: 0.005em;
}
.hero-sub::first-letter {
  font-style: normal;
  font-weight: 450;
}
@media (prefers-reduced-motion: reduce) {
  .hero-sub { animation: none; }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.98rem;
  letter-spacing: 0.005em;
  border: 1px solid transparent;
  transition: transform 0.25s cubic-bezier(.2,.7,.2,1), background 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover { transform: translateY(-1px); }
.btn .arrow { transition: transform 0.3s; }
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary {
  background: var(--ink);
  color: var(--cream);
}
.btn-primary:hover { background: var(--green); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn-ghost:hover { background: rgba(46,58,31,0.08); }
.cta-zh { font-size: 0.78rem; opacity: 0.7; margin-left: 0.2rem; }

/* hero decorative branch */
.hero-branch {
  position: absolute;
  right: -2vw;
  bottom: -2vw;
  width: clamp(280px, 38vw, 520px);
  height: auto;
  color: var(--green);
  opacity: 0.5;
  pointer-events: none;
}
.hero-branch .leaf-group { opacity: 0.85; }

/* ═══════════════════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════════════════ */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin: clamp(3rem, 7vw, 6rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}
.section-num { color: var(--burnt); flex-shrink: 0; }
.section-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
}
.section-lede {
  font-size: var(--t-lead);
  max-width: 56ch;
  color: var(--ink-soft);
  margin: 0 0 2rem;
}

/* ═══════════════════════════════════════════════════════════
   PILLAR PREVIEW (home)
   ═══════════════════════════════════════════════════════════ */
.pillar-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}
.pillar-card {
  position: relative;
  padding: clamp(1.5rem, 3vw, 2rem) 1.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), border-color 0.3s, background 0.3s;
  overflow: hidden;
}
.pillar-card::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.pillar-card:hover { transform: translateY(-4px); border-color: var(--green); }
.pillar-card:hover::before { opacity: 0.15; }
.p-num {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--burnt);
  margin-bottom: 1rem;
}
.p-title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-h3);
  line-height: 1.2;
  margin: 0 0 0.8rem;
}
.p-desc {
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   PODCAST EMBED
   ═══════════════════════════════════════════════════════════ */
.podcast-embed {
  position: relative;
  padding: 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
}
.embed-note {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════
   PULL QUOTE
   ═══════════════════════════════════════════════════════════ */
.pull-quote {
  margin: clamp(4rem, 8vw, 6rem) 0 2rem;
  padding: clamp(2rem, 4vw, 3rem) 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.pull-quote::before {
  content: "“";
  position: absolute;
  top: -0.2em;
  left: -0.3em;
  font-family: var(--f-serif);
  font-size: 14rem;
  color: var(--gold);
  opacity: 0.25;
  line-height: 1;
  pointer-events: none;
}
.pull-quote blockquote {
  margin: 0;
  position: relative;
  z-index: 1;
}
.pull-quote p {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.3;
  max-width: 28ch;
  margin: 0 0 1.5rem;
  font-weight: 400;
}
.pull-quote cite {
  font-style: normal;
  color: var(--ink-soft);
}

/* ═══════════════════════════════════════════════════════════
   PAGE HEADERS (subsequent pages)
   ═══════════════════════════════════════════════════════════ */
.page-header {
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
}
.page-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: var(--t-h1);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0.6rem 0 1.5rem;
  max-width: 18ch;
}
.page-lede {
  font-size: var(--t-lead);
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   RESEARCH — pillar-detail rows (asymmetric)
   ═══════════════════════════════════════════════════════════ */
.pillar-detail {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--hairline);
}
.pillar-detail:last-child { border-bottom: 1px solid var(--hairline); }
.pd-side {
  position: sticky;
  top: 6rem;
  align-self: flex-start;
}
.pd-side > .mono {
  display: block;
  font-size: 0.78rem;
  color: var(--burnt);
  margin-bottom: 0.8rem;
}
.pd-side h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
}
.tag {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  font-size: 0.65rem;
  color: var(--ink-soft);
}
.pd-body p { font-size: 1.05rem; line-height: 1.65; color: var(--ink-soft); margin: 0 0 1.2rem; max-width: 60ch; }
.bullet-list {
  list-style: none;
  margin: 1.5rem 0 0; padding: 0;
}
.bullet-list li {
  padding: 0.9rem 0;
  padding-left: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--f-serif);
  position: relative;
  font-size: 0.98rem;
  line-height: 1.5;
}
.bullet-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 1.4rem;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.bullet-list li:last-child { border-bottom: 1px solid var(--hairline); }

/* ═══════════════════════════════════════════════════════════
   PEOPLE & NETWORK
   ═══════════════════════════════════════════════════════════ */
.subsection { margin: clamp(2rem, 5vw, 4rem) 0; }
.subsection-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}

.people-grid {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.person {
  padding: clamp(1.2rem, 2vw, 1.8rem);
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.3s;
}
.person:hover { background: rgba(232,194,74,0.1); }
.person.hiring {
  background: linear-gradient(135deg, rgba(232,194,74,0.18), rgba(127,162,84,0.12));
}
.p-role { color: var(--burnt); margin-bottom: 0.8rem; }
.p-name {
  font-family: var(--f-display);
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 0.4rem;
}
.p-dept {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.partners {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}
.partners li {
  padding: clamp(1.2rem, 2vw, 1.8rem);
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 0.3s;
}
.partners li:hover { background: rgba(46,58,31,0.05); }
.partners li strong {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 1.1rem;
}
.partners li .mono { color: var(--burnt); }

/* ═══════════════════════════════════════════════════════════
   EVENTS / JOIN
   ═══════════════════════════════════════════════════════════ */
.timeline {
  list-style: none;
  margin: 0; padding: 0;
  border-top: 1px solid var(--hairline);
}
.t-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  padding: clamp(1.5rem, 3vw, 2.5rem) 0;
  border-bottom: 1px solid var(--hairline);
  transition: background 0.3s;
}
.t-item:hover { background: rgba(46,58,31,0.03); }
.t-date {
  color: var(--burnt);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  padding-top: 0.2rem;
}
.t-tag {
  display: inline-block;
  margin-bottom: 0.6rem;
  padding: 0.2rem 0.6rem;
  background: var(--ink);
  color: var(--cream);
  font-size: 0.62rem;
  border-radius: 4px;
}
.t-title {
  font-size: clamp(1.1rem, 1.8vw, 1.4rem);
  line-height: 1.3;
  margin-bottom: 0.5rem;
}
.t-loc { color: var(--ink-soft); font-size: 0.72rem; }

.open-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}
.open-card {
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  position: relative;
  transition: border-color 0.3s, transform 0.3s;
}
.open-card:hover { border-color: var(--green); transform: translateY(-3px); }
.oc-tag { color: var(--burnt); margin-bottom: 1rem; }
.oc-h {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 1.3rem;
  margin: 0 0 0.8rem;
}
.open-card p {
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}

.contact-block { margin: clamp(3rem, 6vw, 5rem) 0 2rem; }
.contact-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
}
.contact-grid > div > .mono.small {
  color: var(--burnt);
  display: block;
  margin-bottom: 0.8rem;
}
.contact-big {
  display: inline-block;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  border-bottom: 2px solid var(--gold);
  transition: color 0.3s, border-color 0.3s;
}
.contact-big:hover { color: var(--green); border-color: var(--green); }
.contact-grid p { font-size: 1.05rem; line-height: 1.6; color: var(--ink-soft); margin: 0; }

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */
.site-foot {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  background: var(--bg);
  position: relative;
  z-index: 2;
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--pad-x) 1.5rem;
  color: var(--ink-soft);
}

.foot-marquee {
  overflow: hidden;
  border-top: 1px solid var(--hairline);
  padding: 1.5rem 0;
}
.marquee-track {
  display: flex;
  gap: 2rem;
  white-space: nowrap;
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  animation: scroll 35s linear infinite;
  color: var(--ink);
}
.marquee-track span:nth-child(even) { color: var(--gold); }
@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 980px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
  .brand-mark { height: 48px; }

  .pillar-grid,
  .open-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .partners    { grid-template-columns: repeat(2, 1fr); }

  .pillar-detail { grid-template-columns: 1fr; gap: 1.5rem; }
  .pd-side { position: static; }
  .contact-grid { grid-template-columns: 1fr; }

  .t-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .t-date { font-size: 0.78rem; }

  .hero-title .strike::after { height: 6px; }
  .hero-branch { width: 60vw; right: -10vw; }
}

@media (max-width: 560px) {
  :root {
    --pad-x: 1rem;
    --t-hero: clamp(1.85rem, 8.2vw, 2.4rem);
    --t-h1: clamp(1.6rem, 6.5vw, 2.2rem);
    --t-h2: clamp(1.3rem, 4.6vw, 1.7rem);
  }
  /* belt-and-braces: prevent any overflow */
  html, body { max-width: 100vw; overflow-x: hidden; }
  .hero-title {
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.08;
  }
  .hero-sub { max-width: 100%; }

  /* Section header stacks vertically on mobile */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .page-header { padding-top: 2rem; }
  .site-nav {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }
  .brand-mark { height: 38px; }
  .nav-utility { gap: 0.4rem; }
  .lang-toggle {
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
  }
  .lang-pill { font-size: 0.65rem; }

  .people-grid { grid-template-columns: 1fr; }
  .partners    { grid-template-columns: 1fr; }

  .hero-title { max-width: none; }
  .hero-branch { display: none; }

  .pull-quote::before { font-size: 7rem; left: 0; top: 0; }
  .pull-quote p { font-size: 1.45rem; max-width: 22ch; }
  .marquee-track { font-size: 1.4rem; }
  .foot-row { font-size: 0.65rem; gap: 0.4rem; }

  .btn { padding: 0.75rem 1rem; font-size: 0.9rem; }
  .cta-zh { display: none; }  /* keep buttons compact on mobile */

  .open-card { padding: 1.25rem; }
  .pillar-card { padding: 1.3rem 1.2rem; }

  /* Mobile drawer adjustment */
  .mobile-drawer { inset: 68px 0 0 0; padding: 1.5rem 1.1rem; }
}

/* iPad-specific tweak */
@media (min-width: 768px) and (max-width: 1024px) {
  .pillar-grid { grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
  .open-grid { grid-template-columns: repeat(3, 1fr); }
  .people-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ════════════════════════════════════════════════════════════
   THEME TOGGLE — overrides when body[data-theme="dark"]
   The LIGHT site defaults to the cream theme; toggling switches
   the whole palette to the deep-forest theme so you can preview
   how the wordmark logo reads on a dark background.
   ════════════════════════════════════════════════════════════ */

body[data-theme="dark"] {
  /* color tokens — mirror of chai-site-dark :root */
  --cream:          #FAEFD0;
  --cream-soft:     #F4EFDD;
  --bg:             #1A2614;
  --bg-elev:        #243017;
  --bg-deepest:     #14200E;
  --fg:             #FAEFD0;
  --fg-soft:        #B8D49A;
  --ink:            #FAEFD0;          /* "max-contrast" text on dark */
  --ink-soft:       #B8D49A;
  --paper:          #243017;
  --green:          #7FA254;
  --green-bright:   #A3C470;
  --sage:           #B8D49A;
  --burnt:          #D4A85F;
  --hairline:       rgba(250,239,208,0.12);
  --hairline-strong: rgba(250,239,208,0.32);

  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(232,194,74,0.10), transparent 60%),
    radial-gradient(900px 500px at 95% 8%, rgba(127,162,84,0.18), transparent 65%),
    radial-gradient(1400px 800px at 50% 110%, rgba(20,32,14,0.5), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

body[data-theme="dark"]::before {
  /* swap paper-grain dots → faint gold constellation on the night */
  background-image:
    radial-gradient(rgba(232,194,74,0.18) 0.8px, transparent 1.2px),
    radial-gradient(rgba(184,212,154,0.10) 0.6px, transparent 1px);
  background-size: 28px 28px, 13px 13px;
  background-position: 0 0, 7px 9px;
  mix-blend-mode: normal;
  opacity: 0.4;
}

body[data-theme="dark"] .site-nav {
  background: linear-gradient(180deg, rgba(20,32,14,0.88) 0%, rgba(20,32,14,0.55) 80%, rgba(20,32,14,0) 100%);
}

/* Logo on dark: no multiply (would disappear); render as white + warm halo */
body[data-theme="dark"] .brand-mark {
  mix-blend-mode: normal;
  filter:
    brightness(0) invert(1)
    drop-shadow(0 0 14px rgba(232,194,74,0.20));
}
body[data-theme="dark"] .brand::before {
  background: radial-gradient(ellipse at center,
    rgba(250,239,208,0.20) 0%,
    rgba(232,194,74,0.10) 30%,
    rgba(127,162,84,0.06) 55%,
    transparent 75%);
}

/* High-contrast UI elements that flip with theme */
body[data-theme="dark"] .nav-link:hover     { background: rgba(250,239,208,0.08); }
body[data-theme="dark"] .nav-link.is-active { background: var(--cream); color: var(--bg-deepest); }
body[data-theme="dark"] .nav-link.is-active .num { color: var(--burnt); }
body[data-theme="dark"] .lang-toggle:hover  { background: rgba(250,239,208,0.08); }
body[data-theme="dark"] .btn-primary        { background: var(--cream); color: var(--bg-deepest); }
body[data-theme="dark"] .btn-primary:hover  { background: var(--gold-warm); }
body[data-theme="dark"] .btn-ghost          { color: var(--fg); }
body[data-theme="dark"] .btn-ghost:hover    { background: rgba(250,239,208,0.06); }
body[data-theme="dark"] .t-tag              { background: var(--cream); color: var(--bg-deepest); }
body[data-theme="dark"] .marquee-track      { color: var(--cream); }
body[data-theme="dark"] .marquee-track span:nth-child(4n+1) { color: var(--sage); }
body[data-theme="dark"] .hero-branch        { color: var(--sage); opacity: 0.45; }
body[data-theme="dark"] .person:hover       { background: rgba(232,194,74,0.10); }
body[data-theme="dark"] .partners li:hover  { background: rgba(250,239,208,0.05); }
body[data-theme="dark"] .t-item:hover       { background: rgba(250,239,208,0.04); }
body[data-theme="dark"] .open-card:hover    { border-color: var(--green); }
body[data-theme="dark"] .mobile-drawer      { background: var(--bg); }

/* Theme toggle button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.4s cubic-bezier(.2,.7,.2,1);
  position: relative;
  overflow: hidden;
}
.theme-toggle:hover { background: rgba(46,58,31,0.06); transform: rotate(15deg); }
body[data-theme="dark"] .theme-toggle:hover { background: rgba(250,239,208,0.08); }
.theme-icon {
  width: 18px;
  height: 18px;
  position: absolute;
  transition: opacity 0.4s, transform 0.5s cubic-bezier(.2,.7,.2,1);
}
.theme-icon-sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.theme-icon-moon { opacity: 1; transform: rotate(0)     scale(1); }
body[data-theme="dark"] .theme-icon-sun  { opacity: 1; transform: rotate(0)    scale(1); }
body[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

/* ════════════════════════════════════════════════════════════
   MARKDOWN-RENDERED BODY STYLES
   The .markdown-body class is on every section's article wrapper.
   Content inside is generated from /content/<lang>/<slug>.md by
   marked.js + the frontmatter loader in script.js.
   ════════════════════════════════════════════════════════════ */

.markdown-body {
  font-family: var(--f-sans);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--fg);
  max-width: 68ch;
  margin: 0 auto;
}
.page[data-page="vision"] .markdown-body { max-width: 70ch; margin-top: clamp(2rem, 5vw, 4rem); }

/* Structured frontmatter blocks (team grid, layer stack, principles grid,
   hermeneutic loop) live OUTSIDE the prose column so they can use the full
   page width — landscape cards, not cramped squares. */
.page-structured {
  width: 100%;
  max-width: var(--max-w);
  margin: clamp(2rem, 5vw, 4rem) auto;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 3rem);
}

.markdown-body > * + * { margin-top: 1rem; }
.markdown-body > h1 + *,
.markdown-body > h2 + *,
.markdown-body > h3 + * { margin-top: 0.6rem; }

.markdown-body h2 {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--fg);
  margin: clamp(2.5rem, 5vw, 4rem) 0 1.2rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 5rem;
}
.markdown-body h3 {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  line-height: 1.2;
  letter-spacing: -0.012em;
  color: var(--fg);
  margin: 2rem 0 0.6rem;
}
.markdown-body h4 {
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  margin: 1.4rem 0 0.4rem;
  color: var(--fg-soft);
}
.markdown-body p {
  color: var(--ink-soft);
  font-variation-settings: "opsz" var(--opsz-body, 14);
}
.markdown-body strong { color: var(--fg); font-weight: 600; }
.markdown-body em { font-style: italic; }
.markdown-body a {
  color: var(--accent, var(--green));
  text-decoration: underline;
  text-decoration-color: rgba(127, 162, 84, 0.4);
  text-underline-offset: 2px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.markdown-body a:hover {
  color: var(--burnt);
  text-decoration-color: var(--burnt);
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5rem;
  color: var(--ink-soft);
}
.markdown-body li { margin: 0.4rem 0; }
.markdown-body ul li::marker { color: var(--gold); }
.markdown-body ol li::marker { color: var(--burnt); font-family: var(--f-mono); font-size: 0.85em; }

.markdown-body blockquote {
  margin: 2rem 0;
  padding: 1.2rem 1.6rem;
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(232,194,74,0.07) 0%, transparent 80%);
  border-radius: 0 12px 12px 0;
  font-family: var(--f-serif);
  font-style: italic;
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.4;
  color: var(--fg);
}
.markdown-body blockquote > * + * { margin-top: 0.6rem; }
.markdown-body blockquote p:last-child {
  font-style: normal;
  font-family: var(--f-sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.markdown-body code {
  font-family: var(--f-mono);
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  background: rgba(46,58,31,0.06);
  border-radius: 4px;
  color: var(--ink);
}
body[data-theme="dark"] .markdown-body code {
  background: rgba(250,239,208,0.08);
  color: var(--cream);
}

.markdown-body hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  position: relative;
  overflow: visible;
}
.markdown-body hr::after {
  content: "⁂";
  display: block;
  position: absolute;
  top: -0.7em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  padding: 0 0.6em;
  color: var(--burnt);
  font-family: var(--f-serif);
  font-size: 1.2rem;
  letter-spacing: 0.2em;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: var(--f-sans);
  font-size: 0.95rem;
  border-top: 1px solid var(--hairline);
}
.markdown-body th {
  text-align: left;
  font-weight: 500;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--burnt);
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--hairline);
}
.markdown-body td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink-soft);
}
.markdown-body tr:hover td { background: rgba(232,194,74,0.05); }

.markdown-body .loading { color: var(--fg-soft); opacity: 0.4; }

/* Page header (rendered for non-hero sections) */
.page-subtitle {
  font-family: var(--f-sans);
  font-style: italic;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  color: var(--ink-soft);
  margin: 0.4rem 0 1.5rem;
  max-width: 56ch;
}
.page-embed {
  max-width: 68ch;
  margin: clamp(1.5rem, 3vw, 2.5rem) auto;
  padding: 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
}
.page-embed iframe { display: block; width: 100%; }
.page-embed .embed-note {
  margin: 0.8rem 0 0;
  color: var(--ink-soft);
  opacity: 0.7;
}

@media (max-width: 560px) {
  .markdown-body { font-size: 1rem; line-height: 1.6; }
  .markdown-body blockquote { padding: 0.9rem 1rem; }
}

/* ════════════════════════════════════════════════════════════
   STRUCTURED FRONTMATTER COMPONENTS
   Rendered by renderStructuredBlocks() in script.js when a
   markdown file's frontmatter contains `team:`, `layers:`,
   `principles:`, or `hermeneutic_loop:`.
   ════════════════════════════════════════════════════════════ */

/* ── People grid (team:) ──────────────────────────────────── */
/* Lives inside .page-structured (full main-width), so cards naturally
   land in landscape proportions on desktop (~360 × 200px). */
.people-groups {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  width: 100%;
}
.people-group-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.75rem;
  color: var(--burnt);
  font-size: 0.72rem;
}
.people-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}
.people-grid {
  --people-line: rgba(46, 58, 31, 0.28);
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--people-line);
  border-left: 1px solid var(--people-line);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  background: var(--bg-elev);
  box-shadow:
    0 1px 0 rgba(46, 58, 31, 0.04),
    0 8px 24px -16px rgba(46, 58, 31, 0.18);
}
body[data-theme="dark"] .people-grid {
  --people-line: rgba(250, 239, 208, 0.18);
  box-shadow:
    0 1px 0 rgba(250, 239, 208, 0.04),
    0 8px 24px -16px rgba(0, 0, 0, 0.4);
}
.markdown-body .people-grid { max-width: none; }
.people-grid .person {
  grid-column: span 2;
  padding: clamp(1.5rem, 2.6vw, 2.2rem);
  border-right: 1px solid var(--people-line);
  border-bottom: 1px solid var(--people-line);
  background: transparent;
  transition: background 0.3s;
  list-style: none;
  margin: 0;
}
.people-grid .person:hover { background: rgba(232,194,74,0.10); }
.people-grid .p-role {
  color: var(--burnt);
  margin-bottom: 1rem;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
}
.people-grid .p-name {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: clamp(1.4rem, 2.3vw, 1.85rem);
  line-height: 1.15;
  white-space: nowrap;
  margin-bottom: 0.45rem;
  color: var(--fg);
  font-variation-settings: "opsz" 36;
}
.people-grid .p-name-link {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.14em;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.people-grid .p-name-link:hover,
.people-grid .p-name-link:focus-visible {
  color: var(--burnt);
  text-decoration: underline;
}
.people-grid .p-dept {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.45;
  font-family: var(--f-serif);
  font-style: normal;
}

/* Let a two-card final row share the full width instead of leaving a blank cell. */
.people-grid .person:nth-last-child(2):nth-child(3n + 1),
.people-grid .person:last-child:nth-child(3n + 2) {
  grid-column: span 3;
}

/* Keep a four-person group on one balanced row on wide screens. */
@media (min-width: 821px) {
  .people-grid:has(> .person:nth-child(4):last-child) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .people-grid:has(> .person:nth-child(4):last-child) > .person {
    grid-column: auto;
  }
  body[data-lang="en"] .people-grid:has(> .person:nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Repeat the wide-screen selectors so the trailing-row spans lose here;
     media queries add no specificity, so a plain `.people-grid .person`
     would be outranked and leak `span 3` into the narrow layouts. */
  .people-grid .person,
  .people-grid .person:nth-last-child(2):nth-child(3n + 1),
  .people-grid .person:last-child:nth-child(3n + 2) { grid-column: auto; }
}
@media (max-width: 520px) {
  .people-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── Layer stack (layers:) ────────────────────────────────── */
.layer-stack {
  margin: 0;
  display: grid;
  gap: 0.9rem;
  width: 100%;
}
.markdown-body .layer-stack { max-width: none; }

.layer-card {
  position: relative;
  padding: clamp(1.4rem, 2.4vw, 2rem);
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  border-left: 5px solid;       /* coloured accent stripe per layer */
  overflow: hidden;
}
.layer-1 { border-left-color: #D9583A; }   /* warm coral */
.layer-2 { border-left-color: #4E6DD9; }   /* indigo */
.layer-3 { border-left-color: #4B9C75; }   /* forest */

.layer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
  margin-bottom: 0.7rem;
}
.layer-num {
  display: inline-block;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  color: var(--cream);
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  flex-shrink: 0;
}
.layer-1 .layer-num { background: #D9583A; }
.layer-2 .layer-num { background: #4E6DD9; }
.layer-3 .layer-num { background: #4B9C75; }
.layer-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.012em;
  color: var(--fg);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55em;
  align-items: baseline;
}
.layer-title-en {
  font-family: var(--f-sans);
  font-style: normal;
  font-weight: 400;
  font-size: 0.78em;
  color: var(--ink-soft);
}
.layer-lede {
  font-family: var(--f-serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  max-width: 60ch;
}
.layer-items {
  list-style: none;
  margin: 0;
  padding: 0.7rem 0.9rem;
  background: rgba(232,194,74,0.06);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  font-family: var(--f-sans);
  font-size: 0.9rem;
  color: var(--fg);
}
.layer-1 .layer-items { background: rgba(217,88,58,0.08); }
.layer-2 .layer-items { background: rgba(78,109,217,0.08); }
.layer-3 .layer-items { background: rgba(75,156,117,0.08); }
.layer-items li {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.layer-items li + li::before {
  content: "·";
  margin-right: 0.6rem;
  color: var(--burnt);
}
.layer-groups {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.layer-group {
  padding: 1rem;
  background: rgba(46,58,31,0.04);
  border-radius: 10px;
}
body[data-theme="dark"] .layer-group { background: rgba(250,239,208,0.05); }
.lg-head {
  font-size: 0.72rem;
  color: var(--burnt);
  margin-bottom: 0.6rem;
}
.lg-name {
  font-family: var(--f-headline);
  font-weight: 500;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
.layer-group ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--f-serif);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.layer-group li { margin: 0.2rem 0; }

@media (max-width: 720px) {
  .layer-groups { grid-template-columns: 1fr; }
}

/* ── Principles grid (principles:) ────────────────────────── */
.principles-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
}
.markdown-body .principles-grid { max-width: none; }

.principle-card {
  padding: clamp(1.25rem, 2.2vw, 1.8rem);
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  transition: border-color 0.3s, transform 0.3s;
}
.principle-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
}
.principle-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.principle-letter {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}
body[data-theme="dark"] .principle-letter {
  background: var(--cream);
  color: var(--bg-deepest);
}
.principle-card:nth-child(1) .principle-letter { background: #4E6DD9; color: #fff; }
.principle-card:nth-child(2) .principle-letter { background: #8B5DC9; color: #fff; }
.principle-card:nth-child(3) .principle-letter { background: #E8993A; color: #fff; }
.principle-card:nth-child(4) .principle-letter { background: #4B9C75; color: #fff; }

.principle-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--fg);
  line-height: 1.25;
}
.principle-body {
  font-family: var(--f-serif);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}
.principle-items {
  list-style: none;
  padding: 0;
  margin: 0;
}
.principle-items li {
  font-family: var(--f-sans);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
  padding-left: 1.1rem;
  position: relative;
  margin: 0.3rem 0;
}
.principle-items li::before {
  content: "·";
  position: absolute;
  left: 0.2rem;
  color: var(--gold);
  font-size: 1.4em;
  line-height: 1;
  top: -0.05em;
}

@media (max-width: 720px) {
  .principles-grid { grid-template-columns: 1fr; }
}

/* ── Hermeneutic loop diagram (hermeneutic_loop:) ─────────── */
.hermeneutic-loop {
  margin: 0;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  width: 100%;
  display: grid;
  gap: 1.2rem;
}
.markdown-body .hermeneutic-loop { max-width: none; }

.hermeneutic-loop .loop-researcher {
  margin: 0 auto;
  text-align: center;
  padding: 0.9rem 1.4rem;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  max-width: 24rem;
}
.hermeneutic-loop .loop-arrow {
  text-align: center;
  font-size: 1.5rem;
  color: var(--ink-soft);
  opacity: 0.5;
  font-family: var(--f-sans);
  margin: -0.4rem 0;
}
.hermeneutic-loop .loop-agents {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.8rem;
  align-items: center;
}
.hermeneutic-loop .loop-agent {
  padding: 1rem 1.2rem;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  text-align: left;
  border-top: 4px solid;
}
.hermeneutic-loop .loop-editor { border-top-color: #4E6DD9; }
.hermeneutic-loop .loop-critic { border-top-color: #8B5DC9; }
.hermeneutic-loop .loop-connector {
  text-align: center;
  font-size: 1.4rem;
  color: var(--ink-soft);
  opacity: 0.5;
}
.hermeneutic-loop .loop-experts-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}
.hermeneutic-loop .loop-experts-label {
  align-self: start;
  padding: 0.3rem 0.7rem;
  background: #4B9C75;
  color: #fff;
  border-radius: 999px;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
}
.hermeneutic-loop .loop-experts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
.hermeneutic-loop .loop-expert {
  padding: 0.8rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  border-left: 3px solid #4B9C75;
}
.hermeneutic-loop .loop-foundations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.hermeneutic-loop .loop-found {
  padding: 0.9rem 1rem;
  background: rgba(46,58,31,0.04);
  border-radius: 10px;
}
body[data-theme="dark"] .hermeneutic-loop .loop-found { background: rgba(250,239,208,0.05); }
.hermeneutic-loop .loop-found-accent {
  background: rgba(75,156,117,0.10);
  border: 1px solid rgba(75,156,117,0.25);
}
.hermeneutic-loop .lf-label {
  color: var(--burnt);
  font-size: 0.7rem;
  margin-bottom: 0.4rem;
}
.hermeneutic-loop .lf-sub {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.hermeneutic-loop .loop-cell-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 0.25rem;
}
.hermeneutic-loop .loop-cell-sub {
  font-family: var(--f-serif);
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .hermeneutic-loop .loop-agents { grid-template-columns: 1fr; }
  .hermeneutic-loop .loop-connector { transform: rotate(90deg); }
  .hermeneutic-loop .loop-experts-grid { grid-template-columns: repeat(2, 1fr); }
  .hermeneutic-loop .loop-foundations { grid-template-columns: 1fr; }
  .hermeneutic-loop .loop-experts-row { grid-template-columns: 1fr; }
}

/* ── Media figure (media:) ────────────────────────────────── */
/* Theme-aware framed figure for gifs, images and short videos.
   Lives inside .page-structured (full main width) — gets the
   centerpiece treatment, with optional kicker / title / caption. */
.media-figure {
  margin: 0;
  padding: clamp(1rem, 2vw, 1.4rem);
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  width: 100%;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(46, 58, 31, 0.04),
    0 12px 32px -20px rgba(46, 58, 31, 0.25);
}
body[data-theme="dark"] .media-figure {
  box-shadow:
    0 1px 0 rgba(250, 239, 208, 0.04),
    0 12px 32px -20px rgba(0, 0, 0, 0.6);
}
.media-figure .media-head {
  margin: 0 0 1rem;
  padding: 0 0.5rem;
}
.media-figure .media-kicker {
  color: var(--burnt);
  margin-bottom: 0.5rem;
}
.media-figure .media-title {
  font-family: var(--f-headline);
  font-weight: 600;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--fg);
}
.media-figure .media-frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #0a120a;        /* dark backdrop in case the media has transparency / black edges */
  display: flex;
  align-items: center;
  justify-content: center;
}
.media-figure .media-asset {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}
.media-figure .media-iframe {
  border: 0;
  width: 100%;
  height: auto;         /* aspect-ratio (set inline) does the sizing */
  background: transparent;
  display: block;
}
.media-figure .media-foot {
  margin: 1rem 0 0;
  padding: 0 0.5rem;
}
.media-figure .media-caption {
  font-style: normal;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  max-width: 60ch;
}
.media-figure .media-credit {
  margin-top: 0.5rem;
  color: var(--burnt);
  opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════
   WORKSHOPS
   ═══════════════════════════════════════════════════════════ */
.workshops-host {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2rem, 4vw, 3rem);
  min-width: 0;
}
.workshop-section,
.workshop-month {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.workshop-section > h2,
.workshop-month > h3 {
  margin: 0;
  color: var(--fg);
  font-family: var(--f-headline);
  line-height: 1.2;
}
.workshop-section > h2 { font-size: var(--t-h2); }
.workshop-month > h3 {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  font-size: var(--t-h3);
}
.workshop-card {
  min-width: 0;
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  box-shadow: 0 12px 30px -24px rgba(46, 58, 31, 0.42);
}
.workshop-toggle {
  appearance: none;
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(12rem, 1.5fr) minmax(9rem, 1fr) minmax(8rem, 1fr) auto auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 1.15rem 1.25rem;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.workshop-toggle::after,
.session-toggle::after {
  content: "›";
  display: inline-block;
  color: var(--burnt);
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 180ms ease;
}
.workshop-toggle[aria-expanded="true"]::after,
.session-toggle[aria-expanded="true"]::after { transform: rotate(90deg); }
.workshop-title {
  font-family: var(--f-headline);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 650;
  line-height: 1.25;
}
.workshop-subtitle {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-family: var(--f-sans);
  font-size: 0.9rem;
  font-weight: 400;
}
.workshop-date,
.workshop-venue {
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.workshop-status {
  justify-self: end;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.25;
}
.workshop-section.is-upcoming .workshop-status {
  border-color: var(--accent);
  color: var(--ink);
}
.workshop-panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  border-top: 1px solid var(--hairline);
}
.workshop-intro { margin-bottom: 1.5rem; }
.workshop-registration {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}
.workshop-registration:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.workshop-registration:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.schedule-day,
.schedule-head,
.schedule-row {
  display: grid;
  grid-template-columns: minmax(7rem, .7fr) minmax(12rem, 1.5fr) minmax(9rem, 1fr) minmax(12rem, 1.3fr);
  min-width: 0;
}
.schedule-time { grid-column: 1; }
.schedule-session { grid-column: 2; }
.schedule-speaker { grid-column: 3; }
.schedule-details { grid-column: 4; }
.schedule-day > h4,
.schedule-day > .schedule-head,
.schedule-day > .schedule-row { grid-column: 1 / -1; }
.schedule-day + .schedule-day { margin-top: 2rem; }
.schedule-day > h4 {
  margin: 0 0 0.75rem;
  font-family: var(--f-headline);
  font-size: 1.05rem;
}
.schedule-head {
  padding: 0;
  border-bottom: 1px solid var(--hairline-strong);
  color: var(--ink-soft);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.schedule-row {
  border-bottom: 1px solid var(--hairline);
  align-items: stretch;
}
.schedule-head > span,
.schedule-row > :not(.materials-panel) {
  min-width: 0;
  padding: 0.8rem;
  overflow-wrap: anywhere;
}
.schedule-row.is-non-teaching {
  background: rgba(46, 58, 31, 0.045);
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.schedule-field-label { display: none; }
.session-toggle {
  appearance: none;
  width: 100%;
  min-height: 44px;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-align: left;
}
.session-toggle:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--burnt);
  text-underline-offset: 0.2em;
}
.materials-panel {
  grid-column: 1 / -1;
  padding: 1rem clamp(0.8rem, 2vw, 1.25rem);
  background: rgba(232, 194, 74, 0.12);
  border-top: 1px solid var(--hairline);
}
.materials-panel h5 { margin: 0 0 0.6rem; }
.materials-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.25rem;
}
.materials-panel a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--burnt);
  text-underline-offset: 0.18em;
}
.materials-coming-soon { margin: 0; color: var(--ink-soft); }
.workshop-load-error {
  padding: 1rem;
  border-left: 3px solid var(--burnt);
  color: var(--ink);
}
.workshop-panel[hidden],
.materials-panel[hidden] { display: none !important; }
.workshop-toggle:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: -3px;
}
.session-toggle:focus-visible,
.materials-panel a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
body[data-theme="dark"] .workshop-card {
  box-shadow: 0 12px 30px -24px rgba(0, 0, 0, 0.75);
}
body[data-theme="dark"] .schedule-row.is-non-teaching {
  background: rgba(250, 239, 208, 0.045);
}

@media (max-width: 800px) {
  .workshops-host { gap: 2.25rem; }
  .workshop-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 1rem;
  }
  .workshop-title,
  .workshop-date,
  .workshop-venue { grid-column: 1; }
  .workshop-status {
    grid-column: 1;
    justify-self: start;
  }
  .workshop-toggle::after {
    grid-column: 2;
    grid-row: 1 / span 4;
  }
  .schedule-day { grid-template-columns: minmax(0, 1fr); }
  .schedule-head { display: none; }
  .schedule-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.45rem 0;
  }
  .schedule-row > :not(.materials-panel) { padding: 0.45rem 0.8rem; }
  .schedule-time,
  .schedule-session,
  .schedule-speaker,
  .schedule-details { grid-column: auto; }
  .schedule-field-label {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--ink-soft);
    font-family: var(--f-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .materials-panel { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .workshop-toggle::after,
  .session-toggle::after { transition: none; }
}
