/* =============================================================================
   Adunai · Protocol Home · styles layered over home-light.css
   Hero network canvas, layer stack, primitives, marquee, governance, stats.
   ============================================================================= */

/* ---- spring motion utility (framer-motion feel) ----
   Hidden states are gated behind html.motion-ok (set by JS once rendering
   is confirmed live) so content is never invisible if JS/rendering stalls. */
html.motion-ok [data-anim] {
  opacity: 0;
  transform: translateY(28px) scale(0.985);
  transition:
    opacity 800ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 900ms cubic-bezier(0.22, 1.28, 0.36, 1);
  will-change: opacity, transform;
}
html.motion-ok [data-anim].in-view { opacity: 1; transform: translateY(0) scale(1); }
html.motion-ok [data-anim="left"]  { transform: translateX(-32px); }
html.motion-ok [data-anim="right"] { transform: translateX(32px); }
html.motion-ok [data-anim="left"].in-view, html.motion-ok [data-anim="right"].in-view { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
  html.motion-ok [data-anim] { opacity: 1; transform: none; transition: none; }
}

[data-tilt] { transition: transform 500ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 300ms ease; transform-style: preserve-3d; }

/* =============================================================================
   HERO · protocol network
   ============================================================================= */
.hero-p {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(110% 80% at 85% 0%, var(--gold-tint) 0%, transparent 50%),
    radial-gradient(80% 90% at 5% 95%, var(--teal-tint) 0%, transparent 55%),
    var(--cream);
  border-bottom: 1px solid var(--border-soft);
}
.hero-p-canvas {
  position: absolute; inset: 0; z-index: 0;
  mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.35) 30%, rgba(0,0,0,0.9) 68%, black 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.35) 30%, rgba(0,0,0,0.9) 68%, black 100%);
}
.hero-p-canvas canvas { display: block; }
.hero-p-inner {
  position: relative; z-index: 1;
  padding: clamp(72px, 9vw, 130px) 0 clamp(64px, 8vw, 110px);
  max-width: 880px;
}
.hero-p h1 {
  font-family: var(--font-display);
  font-weight: 250;
  font-size: clamp(40px, 5.6vw, 76px);
  letter-spacing: -0.038em;
  line-height: 1.0;
  color: var(--ink);
  text-wrap: balance;
  margin-bottom: 26px;
}
.hero-p h1 em { font-style: normal; font-weight: 650; color: var(--gold-600); }
.hero-p h1 .teal { font-style: normal; font-weight: 650; color: var(--teal-500); }

/* word-by-word settle · only when rendering is confirmed live */
html.motion-ok .hero-p h1 .w {
  display: inline-block;
  opacity: 0; transform: translateY(26px) rotate(0.8deg);
  animation: word-in 900ms cubic-bezier(0.22, 1.24, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 70ms + 120ms);
}
.hero-p h1 .w { display: inline-block; }
@keyframes word-in { to { opacity: 1; transform: translateY(0) rotate(0); } }
@media (prefers-reduced-motion: reduce) { html.motion-ok .hero-p h1 .w { opacity: 1; transform: none; animation: none; } }

/* =============================================================================
   PROTOCOL FACTS · honest stats band
   ============================================================================= */
.facts { background: var(--white); border-bottom: 1px solid var(--border-soft); }
.facts-inner { display: grid; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .facts-inner { grid-template-columns: repeat(2, 1fr); } }
.fact { padding: clamp(28px, 3vw, 44px) clamp(20px, 2.5vw, 40px); border-left: 1px solid var(--border-soft); }
.fact:first-child { border-left: none; }
@media (max-width: 760px) { .fact:nth-child(2n+1) { border-left: none; } .fact:nth-child(-n+2){ border-bottom:1px solid var(--border-soft);} }
.fact .fv {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(34px, 3.6vw, 52px); letter-spacing: -0.03em; line-height: 1;
  color: var(--ink);
}
.fact .fv b { color: var(--gold-600); font-weight: 300; }
.fact .fk { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 12px; }
.fact .fd { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* =============================================================================
   LAYER STACK · interactive protocol diagram
   ============================================================================= */
.stack-wrap {
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(28px, 4vw, 64px); align-items: stretch;
}
@media (max-width: 940px) { .stack-wrap { grid-template-columns: 1fr; } }

.stack { display: grid; gap: 12px; align-content: center; }
.stack-layer {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-soft);
  background: var(--white);
  padding: 22px 26px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px;
  cursor: pointer;
  transition: transform 500ms cubic-bezier(0.22, 1.2, 0.36, 1), border-color 250ms ease, box-shadow 350ms ease, background 250ms ease;
}
.stack-layer:hover { transform: translateX(4px); }
.stack-layer.active {
  border-color: var(--gold-500);
  box-shadow: 0 24px 50px -34px rgba(10,59,54,0.45);
  transform: translateX(8px) scale(1.01);
}
.stack-layer .sl-num { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--faint); }
.stack-layer.active .sl-num { color: var(--gold-600); }
.stack-layer .sl-name { font-family: var(--font-display); font-weight: 650; font-size: clamp(17px, 1.8vw, 21px); letter-spacing: -0.015em; color: var(--ink); }
.stack-layer .sl-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stack-layer .sl-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 300px; }
.stack-layer .chip {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
@media (max-width: 640px) { .stack-layer .sl-chips { display: none; } }
.stack-layer[data-layer="apps"]     { background: var(--white); }
.stack-layer[data-layer="protocol"] { background: linear-gradient(120deg, var(--gold-50), var(--white) 70%); }
.stack-layer[data-layer="base"]     { background: linear-gradient(120deg, var(--teal-tint), var(--white) 70%); }

.stack-flow {
  display: flex; align-items: center; gap: 10px; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint);
  padding: 2px 0;
}
.stack-flow::before, .stack-flow::after { content: ''; flex: 0 0 40px; height: 1px; background: var(--border); }

/* detail panel */
.stack-details {
  position: relative;
  background: var(--white); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: clamp(26px, 3vw, 40px);
  box-shadow: 0 30px 60px -46px rgba(10,59,54,0.45);
  min-height: 380px;
}
.stack-detail { display: none; animation: detail-in 480ms cubic-bezier(0.22, 1.15, 0.36, 1); }
.stack-detail.active { display: block; }
@keyframes detail-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.stack-detail .sd-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold-600); }
.stack-detail h3 { font-family: var(--font-display); font-weight: 650; font-size: 24px; letter-spacing: -0.02em; color: var(--ink); margin: 12px 0 12px; }
.stack-detail p { font-size: 15px; color: var(--text); line-height: 1.65; }
.sd-list { margin-top: 20px; display: grid; gap: 1px; background: var(--border-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; }
.sd-row { background: var(--paper); padding: 13px 16px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sd-row .sr-name { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink); }
.sd-row .sr-desc { font-size: 12px; color: var(--muted); text-align: right; }
.sd-row .live {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--teal-400); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; flex-shrink: 0;
}
.sd-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); transition: color 200ms ease; }
.sd-link:hover { color: var(--gold-600); }

/* =============================================================================
   ECOSYSTEM MARQUEE
   ============================================================================= */
.marquee-band { border-block: 1px solid var(--border-soft); background: var(--white); overflow: hidden; padding: 22px 0; }
.marquee { display: flex; gap: 0; width: max-content; animation: marquee-x 36s linear infinite; }
.marquee-band:hover .marquee { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .marquee { animation: none; } }
@keyframes marquee-x { to { transform: translateX(-50%); } }
.mq-item {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 0 34px;
  font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--muted); white-space: nowrap;
}
.mq-item .mark { width: 12px; height: 14px; opacity: 0.8; }
.mq-item b { color: var(--ink); font-weight: 600; }

/* =============================================================================
   GOVERNANCE
   ============================================================================= */
.gov { background: var(--cream); }
.gov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .gov-grid { grid-template-columns: 1fr; } }
.gov-card {
  background: var(--white); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: clamp(26px, 3vw, 38px); display: grid; gap: 14px; align-content: start;
}
.gov-card .gc-num { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--gold-600); }
.gov-card h3 { font-family: var(--font-display); font-weight: 650; font-size: 20px; letter-spacing: -0.015em; color: var(--ink); }
.gov-card p { font-size: 14.5px; color: var(--text); line-height: 1.62; }
.gov-card .lnk { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); display: inline-flex; gap: 7px; margin-top: 2px; transition: color 200ms ease; }
.gov-card .lnk:hover { color: var(--gold-600); }

/* honesty note */
.phase-note {
  margin-top: clamp(32px, 4vw, 48px);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  display: flex; gap: 14px; align-items: flex-start;
  font-size: 13.5px; color: var(--muted); line-height: 1.6; max-width: 760px;
}
.phase-note .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-500); flex-shrink: 0; margin-top: 6px; }
.phase-note b { color: var(--ink); font-weight: 600; }

/* decorative parallax orbs */
.orb { position: absolute; border-radius: 50%; pointer-events: none; filter: blur(60px); opacity: 0.5; z-index: 0; }
.orb-gold { background: var(--gold-tint); }
.orb-teal { background: var(--teal-tint); }

/* ---- frozen-context fallbacks (print, capture, background iframes) ----
   Entrance animations whose from-state is hidden must resolve to visible
   when the CSS animation timeline is not running. */
html:not(.motion-ok) .screen-pane { animation: none; }
html:not(.motion-ok) .granted-check circle,
html:not(.motion-ok) .granted-check path { stroke-dashoffset: 0; animation: none; }
@media print {
  .screen-pane { animation: none; }
  .granted-check circle, .granted-check path { stroke-dashoffset: 0; animation: none; }
}
