/* ============================================================
   PMM Tools — extensions.css
   Additive styles for new sections (Process/Why, Stakeholders/Who,
   Ten Years/Origin) and small in-place updates (® mark, pillar
   asides, eyebrow capitalization).

   This file loads AFTER main.css. It does not override the
   existing palette, type system, or section-wrap rules — it
   only introduces new component classes and a few targeted
   refinements. Tokens fallback gracefully if names differ.
   ============================================================ */

/* ----- Shared token fallbacks (only used if main.css doesn't define) ----- */
:root {
  --pmm-cream:    var(--cream-100, #f5efe1);
  --pmm-cream-2:  var(--cream-200, #ebe2cd);
  --pmm-paper:    var(--paper, #faf6ec);
  --pmm-burgundy: var(--burgundy-700, #6b1f2a);
  --pmm-burgundy-deep: var(--burgundy-900, #4a1620);
  --pmm-gold:     var(--gold-500, #b8893a);
  --pmm-gold-light: var(--gold-300, #d4a648);
  --pmm-ink:      var(--ink-900, #1a1612);
  --pmm-ink-500:  var(--ink-500, #6b6258);
  --pmm-ink-300:  var(--ink-300, #a39c8e);
  --pmm-rule:     var(--rule, rgba(26, 22, 18, 0.14));
}

/* ============================================================
   Registered trademark glyph — restrained editorial treatment
   ============================================================ */
.reg-mark {
  font-size: 0.42em;
  vertical-align: super;
  line-height: 1;
  margin-left: 0.08em;
  color: var(--pmm-gold);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  font-family: 'DM Mono', 'Barlow Condensed', sans-serif;
}

/* ============================================================
   Eyebrow text — ensure question-mode labels render properly
   The existing .section-eyebrow likely already does uppercase
   tracking; if not, this guarantees it.
   ============================================================ */
.section-eyebrow {
  text-transform: uppercase;
}

/* ============================================================
   Method pillars — italic aside under each pillar body
   ============================================================ */
.pillar-aside {
  margin-top: 1.1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--pmm-gold);
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--pmm-ink-500);
}
.pillar-aside em {
  font-style: italic;
  color: var(--pmm-ink);
  font-weight: 400;
}

/* ============================================================
   PROCESS (WHY) — "The model is the project."
   ============================================================ */
.process-why {
  background:
    linear-gradient(180deg,
      rgba(245, 239, 225, 0.0) 0%,
      rgba(235, 226, 205, 0.55) 35%,
      rgba(235, 226, 205, 0.55) 65%,
      rgba(245, 239, 225, 0.0) 100%);
  padding: 7rem 0 8rem;
  position: relative;
}

/* Decorative numbered tag before heading is left to existing main.css.
   We add an editorial top hairline. */
.process-why::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 1px;
  background: var(--pmm-gold);
  opacity: 0.5;
}

.why-prose {
  max-width: 640px;
  margin: 2.5rem auto 4.5rem;
  padding: 0 1rem;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--pmm-ink);
}
.why-prose p {
  margin: 0 0 1.4em;
}
.why-prose .why-thesis {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--pmm-rule);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  line-height: 1.4;
  text-align: center;
  font-weight: 400;
  letter-spacing: -0.01em;
}
.why-prose .why-thesis em {
  font-style: italic;
  color: var(--pmm-burgundy);
}

.why-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--pmm-rule);
  border: 1px solid var(--pmm-rule);
  margin-top: 2rem;
}
.why-card {
  background: var(--pmm-paper);
  padding: 2.25rem 2rem 2rem;
  position: relative;
  transition: background 0.25s ease, transform 0.25s ease;
}
.why-card:hover {
  background: var(--pmm-cream);
}
.why-card .why-num {
  font-family: 'DM Mono', 'Barlow Condensed', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--pmm-gold);
  margin-bottom: 0.9rem;
}
.why-card h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.005em;
  font-weight: 500;
  margin: 0 0 0.7rem;
  color: var(--pmm-ink);
}
.why-card p {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--pmm-ink-500);
  margin: 0;
}
.why-card::after {
  content: "";
  position: absolute;
  left: 2rem;
  bottom: 1.25rem;
  width: 24px;
  height: 1px;
  background: var(--pmm-gold);
  opacity: 0;
  transition: opacity 0.25s ease, width 0.25s ease;
}
.why-card:hover::after {
  opacity: 0.8;
  width: 40px;
}

@media (max-width: 720px) {
  .process-why { padding: 5rem 0 5.5rem; }
  .why-cards { grid-template-columns: 1fr; }
  .why-prose .why-thesis { font-size: 1.35rem; }
}

/* ============================================================
   STAKEHOLDERS (WHO) — Orbital diagram + role detail panel
   ============================================================ */
.stakeholders {
  padding: 7rem 0 8rem;
  position: relative;
}

.stake-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 4rem;
  align-items: center;
  margin-top: 4rem;
}

/* Orbital diagram */
.orbit {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.orbit-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.orbit-ring {
  fill: none;
  stroke: var(--pmm-gold);
  stroke-width: 0.5;
  stroke-dasharray: 2 4;
  opacity: 0.35;
}
.orbit-ring-outer { opacity: 0.18; }

/* Center node */
.orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%,
      rgba(212, 166, 72, 0.95) 0%,
      rgba(184, 137, 58, 0.85) 60%,
      rgba(126, 90, 38, 0.92) 100%);
  border: 1px solid var(--pmm-gold);
  box-shadow:
    0 0 0 6px rgba(212, 166, 72, 0.10),
    0 0 0 14px rgba(212, 166, 72, 0.05),
    0 8px 24px rgba(74, 22, 32, 0.20);
  color: var(--pmm-paper);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  z-index: 3;
  transition: transform 0.4s cubic-bezier(0.2, 0.6, 0.2, 1), box-shadow 0.4s;
  animation: corePulse 3.4s ease-in-out infinite;
}
.orbit-core:hover, .orbit-core:focus-visible {
  transform: translate(-50%, -50%) scale(1.05);
  outline: none;
}
.orbit-core-mark {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1;
}
.orbit-core-sub {
  font-family: 'DM Mono', 'Barlow Condensed', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  opacity: 0.85;
}
@keyframes corePulse {
  0%, 100% {
    box-shadow:
      0 0 0 6px rgba(212, 166, 72, 0.10),
      0 0 0 14px rgba(212, 166, 72, 0.05),
      0 8px 24px rgba(74, 22, 32, 0.20);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(212, 166, 72, 0.14),
      0 0 0 22px rgba(212, 166, 72, 0.06),
      0 8px 28px rgba(74, 22, 32, 0.22);
  }
}

/* Role nodes — positioned via --angle + --orbit-radius */
.orbit-node {
  --orbit-radius: 41%;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: var(--pmm-paper);
  border: 1px solid var(--pmm-rule);
  color: var(--pmm-ink);
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transform:
    translate(
      calc(cos(var(--angle)) * var(--orbit-radius) * 5.6),
      calc(sin(var(--angle)) * var(--orbit-radius) * 5.6)
    );
  transition: transform 0.4s cubic-bezier(0.2, 0.6, 0.2, 1),
              background 0.25s ease,
              border-color 0.25s ease,
              box-shadow 0.25s ease,
              opacity 0.25s ease;
  z-index: 2;
}
.orbit-node span {
  display: block;
  line-height: 1.05;
}
.orbit-node:hover,
.orbit-node:focus-visible,
.orbit-node.is-active {
  background: var(--pmm-burgundy);
  color: var(--pmm-paper);
  border-color: var(--pmm-burgundy);
  outline: none;
  box-shadow:
    0 0 0 4px rgba(107, 31, 42, 0.12),
    0 6px 18px rgba(74, 22, 32, 0.22);
  transform:
    translate(
      calc(cos(var(--angle)) * var(--orbit-radius) * 5.6),
      calc(sin(var(--angle)) * var(--orbit-radius) * 5.6)
    )
    scale(1.08);
}
.orbit.has-active .orbit-node:not(.is-active) {
  opacity: 0.4;
}

/* Detail panel */
.stake-detail {
  position: relative;
  min-height: 320px;
  padding: 2.5rem 2.25rem 2.25rem;
  background: var(--pmm-paper);
  border: 1px solid var(--pmm-rule);
  border-left: 3px solid var(--pmm-gold);
  box-shadow: 0 14px 32px -18px rgba(74, 22, 32, 0.18);
}
.stake-detail-default {
  font-family: 'Libre Baskerville', Georgia, serif;
  color: var(--pmm-ink-500);
  font-size: 1rem;
  line-height: 1.7;
  font-style: italic;
}
.stake-meta {
  font-family: 'DM Mono', 'Barlow Condensed', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pmm-gold);
  margin-bottom: 1.1rem;
}

.stake-panel { display: none; }
.stake-panel.is-active { display: block; animation: stakeFade 0.4s ease both; }
.stake-detail.has-active .stake-detail-default { display: none; }

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

.stake-panel h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 500;
  margin: 0 0 1rem;
  color: var(--pmm-burgundy);
  letter-spacing: -0.01em;
}
.stake-panel p {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--pmm-ink);
  margin: 0 0 1.5rem;
}
.stake-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--pmm-rule);
}
.stake-tools-label {
  display: block;
  flex: 0 0 100%;
  font-family: 'DM Mono', 'Barlow Condensed', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pmm-ink-500);
  margin: 0 0 0.6rem;
}
/* .tool-pill is defined in main.css; we only add focus-visible if missing */
.stake-tools .tool-pill {
  display: inline-block;
}

/* Mobile fallback — accordion */
@media (max-width: 880px) {
  .stake-stage {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .orbit { display: none; }
  .stake-detail {
    min-height: 0;
    padding: 0;
    border: none;
    border-left: none;
    box-shadow: none;
    background: transparent;
  }
  .stake-detail-default { display: none; }
  .stake-panel {
    display: block;
    background: var(--pmm-paper);
    border: 1px solid var(--pmm-rule);
    border-left: 3px solid var(--pmm-gold);
    padding: 1.75rem 1.5rem;
    margin-bottom: 1rem;
    animation: none;
  }
  .stake-panel h3 { font-size: 1.55rem; margin-bottom: 0.7rem; }
}

/* ============================================================
   TEN YEARS (ORIGIN)
   ============================================================ */
.ten-years {
  padding: 7rem 0 8rem;
  background:
    linear-gradient(180deg,
      var(--pmm-paper) 0%,
      var(--pmm-cream) 100%);
  position: relative;
}

.origin-prose {
  max-width: 660px;
  margin: 2.5rem auto 4rem;
  padding: 0 1rem;
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--pmm-ink);
}
.origin-prose p {
  margin: 0 0 1.4em;
}
.origin-prose p:first-child::first-letter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 4.2rem;
  font-weight: 500;
  float: left;
  line-height: 0.9;
  margin: 0.05em 0.18em 0 -0.05em;
  color: var(--pmm-burgundy);
}

/* Lawrence Kim pull-quote */
.origin-quote {
  max-width: 720px;
  margin: 3rem auto 4rem;
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  position: relative;
  border-top: 1px solid var(--pmm-gold);
}
.origin-quote::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 80px;
  height: 1px;
  background: var(--pmm-gold);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(184, 137, 58, 0.4);
}
.origin-quote blockquote {
  margin: 0 0 1.25rem;
  padding: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.4;
  font-weight: 400;
  color: var(--pmm-ink);
  letter-spacing: -0.005em;
}
.origin-quote blockquote em {
  font-style: italic;
}
.origin-quote figcaption {
  font-family: 'DM Mono', 'Barlow Condensed', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--pmm-burgundy);
}

/* Schmeiser video block */
.origin-video {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
}
.origin-video-frame {
  position: relative;
  background: var(--pmm-burgundy-deep);
  padding: 14px;
  border: 1px solid rgba(184, 137, 58, 0.35);
  box-shadow:
    0 24px 48px -24px rgba(74, 22, 32, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}
.origin-video-frame::before {
  content: "";
  position: absolute;
  top: 6px; right: 6px; bottom: 6px; left: 6px;
  border: 1px solid rgba(212, 166, 72, 0.35);
  pointer-events: none;
}
.origin-video-frame video {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}

.origin-video-caption {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--pmm-gold);
  text-align: center;
  position: relative;
}
.origin-video-caption::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--pmm-burgundy);
  border-radius: 50%;
  transform: translateX(-50%);
}
.caption-line-1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pmm-burgundy);
  margin-bottom: 0.65rem;
}
.caption-line-2 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--pmm-ink-500);
}
.caption-line-2 em {
  font-style: italic;
  color: var(--pmm-ink);
}

@media (max-width: 720px) {
  .ten-years { padding: 5rem 0 5.5rem; }
  .origin-prose p:first-child::first-letter {
    font-size: 3.2rem;
  }
  .origin-video-frame { padding: 8px; }
  .origin-video-frame::before { top: 3px; right: 3px; bottom: 3px; left: 3px; }
}

/* ============================================================
   Reveal-on-scroll for new sections (matches existing convention)
   The existing main.js likely already wires .reveal — we just
   make sure the resting/active states exist for our new markup.
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Honor reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .orbit-core { animation: none; }
  .reveal, .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .stake-panel.is-active { animation: none; }
  .orbit-node, .orbit-core, .why-card { transition: none; }
}

/* ============================================================
   Anchor-scroll offset — keep sticky nav from covering headings
   when the user clicks a nav link. Applies to every anchored
   section on the page.
   ============================================================ */
#top, #method, #process, #stakeholders,
#tools-flow, #tools, #guides, #origin {
  scroll-margin-top: 80px;
}
