/* ==========================================================================
   Cldesignz — Christopher Laguitan Portfolio
   Design tokens: warm-gold + cool-teal duality (Pollen / AI signal system)
   ========================================================================== */

:root{
  /* ---- LIGHT (default) ---- */
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-2: #FDFDFB;
  --ink: #14161C;
  --ink-soft: #53565F;
  --ink-faint: #8A8D93;
  --line: #E8E9E4;
  --line-strong: #D5D6D0;
  --accent-gold: #7C4DFF;
  --accent-gold-soft: #9B77FF;
  --accent-teal: #FF3D71;
  --accent-teal-soft: #FF6B93;
  --shadow: 0 1px 2px rgba(20,22,28,0.04), 0 12px 32px -16px rgba(20,22,28,0.10);
  --grain-opacity: 0.035;

  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  color-scheme: light;
}

html.dark{
  --bg: #0B0C0F;
  --surface: #15171C;
  --surface-2: #1B1D23;
  --ink: #F1F2EF;
  --ink-soft: #ABAEB6;
  --ink-faint: #6F727B;
  --line: #262830;
  --line-strong: #34363E;
  --accent-gold: #A78BFA;
  --accent-gold-soft: #C4B0FF;
  --accent-teal: #FF6B93;
  --accent-teal-soft: #FF93B0;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 20px 48px -20px rgba(0,0,0,0.6);
  --grain-opacity: 0.05;
  color-scheme: dark;
}

*{ box-sizing: border-box; }

html{
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease, color 0.5s ease;
  overflow-x: hidden;
}

/* filter flash-guard during theme transition */
body.theme-transitioning{
  transition: background-color 0.6s ease, color 0.6s ease, filter 0.6s ease;
}

a{ color: inherit; text-decoration: none; }
h1,h2,h3{ font-family: var(--font-display); margin: 0; }
p{ margin: 0; }
button{ font-family: inherit; background: none; border: none; cursor: pointer; color: inherit; }

::selection{ background: var(--accent-gold-soft); color: #14161C; }

:focus-visible{
  outline: 2px solid var(--accent-teal);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------------- Grain overlay ---------------- */
.grain{
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- Cursor charm ---------------- */
.cursor-dot{
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-gold);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%,-50%);
  mix-blend-mode: difference;
  transition: opacity 0.3s ease;
}
@media (hover: none){ .cursor-dot{ display: none; } }

/* ================= NAV ================= */
.nav{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 56px);
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.5s ease;
}
.nav.is-scrolled{ border-bottom-color: var(--line); }

.nav__mark{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav__logo{ width: 32px; height: 32px; flex-shrink: 0; overflow: visible; }
.nav__logo-ring-a, .nav__logo-ring-b{
  fill: none;
  stroke-width: 2.2;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), stroke 0.3s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.nav__logo-ring-a{ stroke: var(--accent-gold); mix-blend-mode: multiply; }
html.dark .nav__logo-ring-a{ mix-blend-mode: screen; }
.nav__logo-ring-b{ stroke: var(--accent-teal); mix-blend-mode: multiply; }
html.dark .nav__logo-ring-b{ mix-blend-mode: screen; }
.nav__logo-dot{ fill: var(--ink); }
.nav__mark:hover .nav__logo-ring-a{ transform: translateX(-2px); }
.nav__mark:hover .nav__logo-ring-b{ transform: translateX(2px); }
.nav__mark-text{ display: flex; align-items: baseline; gap: 1px; }
.nav__mark-cl{ color: var(--ink); text-transform: lowercase; }
.nav__mark-domain{ color: var(--ink-faint); font-weight: 500; }

.nav__links{
  display: flex;
  gap: clamp(18px, 3vw, 36px);
}
.nav__links a{
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}
.nav__links a:hover{ color: var(--ink); }
.nav__num{
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-teal);
}

.nav__burger{ display: none; flex-direction: column; gap: 5px; width: 22px; }
.nav__burger span{ height: 2px; width: 100%; background: var(--ink); border-radius: 2px; }

/* ---------------- Theme toggle ---------------- */
.theme-toggle{ display: flex; align-items: center; }
.theme-toggle__track{
  width: 52px; height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  padding: 3px;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}
.theme-toggle__thumb{
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent-gold);
  display: flex; align-items: center; justify-content: center;
  color: var(--surface);
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.65,0,0.35,1), background-color 0.4s ease;
}
html.dark .theme-toggle__thumb{
  transform: translateX(24px);
  background: var(--accent-teal-soft);
}
.theme-toggle__thumb svg{ width: 13px; height: 13px; }
.icon-moon{ display: none; }
html.dark .icon-sun{ display: none; }
html.dark .icon-moon{ display: block; }

/* ================= HERO ================= */
.hero-wrap{
  position: relative;
  overflow: hidden;
}
.hero{
  position: relative;
  z-index: 1;
  min-height: clamp(460px, 82vh, 820px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 140px clamp(20px, 6vw, 64px) 60px;
  max-width: 1180px;
  margin: 0 auto;
}
.hero__orbs{ position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.hero__orb{
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}
.hero__orb--a{
  width: 640px; height: 640px;
  top: -220px; right: -160px;
  background: radial-gradient(circle, var(--accent-gold) 0%, transparent 70%);
  animation: orb-drift-a 22s ease-in-out infinite;
}
.hero__orb--b{
  width: 600px; height: 600px;
  bottom: -260px; left: -180px;
  background: radial-gradient(circle, var(--accent-teal) 0%, transparent 70%);
  animation: orb-drift-b 26s ease-in-out infinite;
}
@keyframes orb-drift-a{
  0%, 100%{ transform: translate(0, 0) scale(1); }
  50%{ transform: translate(-60px, 40px) scale(1.1); }
}
@keyframes orb-drift-b{
  0%, 100%{ transform: translate(0, 0) scale(1); }
  50%{ transform: translate(50px, -40px) scale(1.08); }
}

.hero__eyebrow{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}
.hero__eyebrow .dot{
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-teal) 18%, transparent);
}

.hero__headline{
  font-size: clamp(40px, 7.4vw, 96px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 36px;
}
.hero__headline .line{ display: block; overflow: hidden; }
.hero__headline .line--accent{ color: var(--accent-gold); }

.hero__sub{
  max-width: 620px;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 44px;
}

.hero__cta{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.25s cubic-bezier(0.65,0,0.35,1), background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn--primary{
  background: var(--ink);
  color: var(--bg);
}
html.dark .btn--primary{ background: var(--accent-gold-soft); color: #14161C; }
.btn--primary:hover{ transform: translateY(-2px); box-shadow: var(--shadow); }
.btn--primary svg{ transition: transform 0.25s ease; }
.btn--primary:hover svg{ transform: translateX(3px); }

.btn--ghost{
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 6px 0;
}
.btn--ghost:hover{ color: var(--ink); border-color: var(--ink); }

/* ================= TICKER ================= */
.ticker{
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  padding: 14px 0;
  transition: background-color 0.5s ease, border-color 0.5s ease;
}
.ticker__track{
  display: flex;
  gap: 48px;
  width: max-content;
  animation: ticker-scroll 32s linear infinite;
}
.ticker__item{
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.ticker__item b{ color: var(--accent-teal); font-weight: 600; }

@keyframes ticker-scroll{
  from{ transform: translateX(0); }
  to{ transform: translateX(-50%); }
}

/* ================= SECTION SHELL ================= */
.section{
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px clamp(20px, 6vw, 64px) 0;
}
.section__head{ margin-bottom: 56px; max-width: 720px; }
.section__eyebrow{
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-teal);
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.section__title{
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.section__note{
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 15px;
}

/* ================= BENTO ================= */
.bento{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(180px, auto);
  gap: 16px;
}
.bento__card{
  grid-column: span 2;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.3s cubic-bezier(0.65,0,0.35,1), border-color 0.3s ease, background-color 0.5s ease, box-shadow 0.3s ease;
}
.bento__card:hover{
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.bento__card--lg{ grid-column: span 2; grid-row: span 2; }
.bento__card--wide{ grid-column: span 2; }

.bento__glyph{ width: 40px; height: 40px; color: var(--accent-gold); }
.bento__card:nth-child(3) .bento__glyph{ color: var(--accent-teal); }
.bento__card h3{ font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.bento__card p{ color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }

/* ================= MANIFEST / CASE STUDIES ================= */
.manifest{
  border-top: 1px solid var(--line-strong);
}
.manifest__row{
  position: relative;
  border-bottom: 1px solid var(--line-strong);
  overflow: hidden;
  transition: background-color 0.4s ease;
}
.manifest__row::before{
  content: attr(data-num);
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(90px, 12vw, 160px);
  line-height: 1;
  color: var(--accent-gold);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.manifest__row:nth-child(2)::before{ color: var(--accent-teal); }
.manifest__row:hover::before,
.manifest__row[data-open]::before{
  opacity: 0.06;
  transform: translateY(-50%) translateX(-10px);
}
.manifest__row:hover{ background: color-mix(in srgb, var(--accent-gold) 3%, transparent); }
.manifest__row:nth-child(2):hover{ background: color-mix(in srgb, var(--accent-teal) 3%, transparent); }
.manifest__summary{
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  grid-template-columns: 90px 1fr auto 20px;
  align-items: center;
  gap: 24px;
  padding: 30px 4px;
  text-align: left;
}
.manifest__id{
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-gold);
}
.manifest__title{
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--font-display);
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.manifest__title em{
  font-style: normal;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13.5px;
  color: var(--ink-faint);
}
.manifest__tags{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.manifest__tags span{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 5px 11px;
}
.manifest__chev{
  color: var(--ink-faint);
  transition: transform 0.3s ease;
}
.manifest__row[data-open] .manifest__chev{ transform: rotate(180deg); }

.manifest__detail{
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.65,0,0.35,1);
}
.manifest__row[data-open] .manifest__detail{ grid-template-rows: 1fr; }
.manifest__detail > *{ overflow: hidden; }

.manifest__split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 0 4px 32px;
}
.manifest__label{
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent-teal);
  margin-bottom: 10px;
}
.manifest__col p{ color: var(--ink-soft); font-size: 15px; line-height: 1.6; }

.manifest__viz{ padding: 0 4px 40px; }
.manifest__viz svg{ display: block; height: auto; max-height: 200px; }

.manifest__viz{ padding: 0 4px 40px; }
.manifest__viz svg{ display: block; height: auto; max-height: 200px; overflow: visible; }

.viz-panel{ fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.viz-label{ font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-faint); letter-spacing: 0.03em; }
.viz-line{ fill: none; stroke-width: 2.5; stroke-linecap: round; }
.viz-area{ opacity: 0; }
.viz-dot{ fill: var(--accent-gold); }
.viz-dot-ring{ fill: none; stroke: var(--accent-gold); stroke-width: 1.4; opacity: 0; }
.viz-bar{ opacity: 0.92; }
.viz-track{ fill: var(--surface); stroke: var(--line-strong); stroke-width: 1; }
.viz-fill{ opacity: 0.95; }
.viz-fill-dot{ fill: var(--surface); stroke: var(--accent-gold); stroke-width: 2; opacity: 0; }
.viz-core{ fill: var(--surface); stroke: var(--accent-gold); stroke-width: 1.8; }
.viz-core-glow{ opacity: 0; }
.viz-core-label{ font-family: var(--font-mono); font-size: 10px; fill: var(--ink); font-weight: 600; }
.viz-agent{ fill: var(--surface); stroke: var(--accent-teal); stroke-width: 1.6; }
.viz-agent-glow{ opacity: 0; }
.viz-agent-label{ font-family: var(--font-mono); font-size: 9px; fill: var(--ink-soft); }
.viz-link{ fill: none; stroke: var(--line-strong); stroke-width: 1.4; }
.viz-token-gem{ opacity: 0; stroke: var(--surface); stroke-width: 1.5; }
.viz-flow-dot{ fill: var(--accent-gold); opacity: 0; filter: drop-shadow(0 0 2px var(--accent-gold)); }
.viz-system rect.viz-panel{ fill: var(--surface); }

/* ---- Animated, illustrative diagrams: replay each time a case study opens ---- */
.manifest__row[data-open] .viz-line{
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: viz-draw 1.1s cubic-bezier(0.16,1,0.3,1) forwards;
}
.manifest__row[data-open] .viz-area{
  animation: viz-fade-in 0.8s ease-out 0.9s forwards;
}
.manifest__row[data-open] .viz-dot{
  animation: viz-pop 0.4s ease-out 1s backwards, viz-dot-pulse 1.6s ease-in-out 1.4s infinite;
}
.manifest__row[data-open] .viz-dot-ring{
  animation: viz-ripple 1.8s ease-out 1.1s infinite;
}
.manifest__row[data-open] .viz-bar{
  transform-box: fill-box;
  transform-origin: bottom;
  animation: viz-grow-y 0.6s cubic-bezier(0.34,1.56,0.64,1) backwards;
  animation-delay: calc(var(--i, 0) * 0.09s);
}
.manifest__row[data-open] .viz-fill{
  transform-box: fill-box;
  transform-origin: left;
  animation: viz-grow-x 0.7s cubic-bezier(0.34,1.56,0.64,1) backwards;
  animation-delay: calc(var(--i, 0) * 0.12s + 0.1s);
}
.manifest__row[data-open] .viz-fill-dot{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.3s ease-out both;
  animation-delay: calc(var(--i, 0) * 0.12s + 0.75s);
}
.manifest__row[data-open] .viz-link{
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: viz-draw 0.8s ease-out both;
  animation-delay: calc(var(--i, 0) * 0.1s);
}
.manifest__row[data-open] .viz-flow-dot{
  animation: viz-flow-in 0.3s ease-out 1.2s forwards;
}
.manifest__row[data-open] .viz-agent{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.45s cubic-bezier(0.34,1.56,0.64,1) backwards, viz-float 3.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.15s), calc(var(--i, 0) * 0.35s + 0.6s);
}
.manifest__row[data-open] .viz-agent-glow{
  animation: viz-fade-in 0.6s ease-out both;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.1s);
}
.manifest__row[data-open] .viz-core{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) backwards, viz-breathe 2.6s ease-in-out 0.5s infinite;
}
.manifest__row[data-open] .viz-core-glow{
  animation: viz-fade-in 0.8s ease-out 0.2s forwards, viz-breathe 2.6s ease-in-out 0.5s infinite;
}
.manifest__row[data-open] .viz-token-gem{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) both, viz-breathe 2.6s ease-in-out 0.5s infinite;
}
.manifest__row[data-open] .viz-system .viz-panel{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-rise 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.5s);
}

@keyframes viz-draw{ to{ stroke-dashoffset: 0; } }
@keyframes viz-fade-in{ to{ opacity: 1; } }
@keyframes viz-flow-in{ to{ opacity: 0.9; } }
@keyframes viz-pop{ from{ transform: scale(0); opacity: 0; } to{ transform: scale(1); opacity: 1; } }
@keyframes viz-grow-y{ from{ transform: scaleY(0); } to{ transform: scaleY(1); } }
@keyframes viz-grow-x{ from{ transform: scaleX(0); } to{ transform: scaleX(1); } }
@keyframes viz-rise{ from{ transform: translateY(10px) scale(0.9); opacity: 0; } to{ transform: translateY(0) scale(1); opacity: 1; } }
@keyframes viz-float{ 0%, 100%{ transform: translateY(0); } 50%{ transform: translateY(-4px); } }
@keyframes viz-breathe{ 0%, 100%{ transform: scale(1); } 50%{ transform: scale(1.05); } }
@keyframes viz-dot-pulse{
  0%, 100%{ r: 3.5; opacity: 1; }
  50%{ r: 5; opacity: 0.65; }
}
@keyframes viz-ripple{
  0%{ r: 3.5; stroke-opacity: 0.6; opacity: 1; }
  100%{ r: 16; stroke-opacity: 0; opacity: 0; }
}

@media (prefers-reduced-motion: reduce){
  .viz-flow-dot{ display: none; }
}

/* ================= TIMELINE ================= */
.timeline{ border-top: 1px solid var(--line); }
.timeline__row{
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  padding: 32px 4px;
  border-bottom: 1px solid var(--line);
}
.timeline__date{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-gold);
  padding-top: 4px;
}
.timeline__body h3{ font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.timeline__org{
  display: block;
  font-size: 13px;
  color: var(--accent-teal);
  font-weight: 500;
  margin-bottom: 10px;
}
.timeline__body p{ color: var(--ink-soft); font-size: 14.5px; max-width: 560px; line-height: 1.55; }
.timeline__extra{ font-style: normal; }

/* ================= CONTACT ================= */
.contact{
  margin-top: 140px;
  padding: 100px clamp(20px, 6vw, 64px) 90px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  transition: background-color 0.5s ease, border-color 0.5s ease;
}
.contact__inner{ max-width: 720px; margin: 0 auto; text-align: center; }
.contact__headline{
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 18px 0 20px;
}
.contact__sub{ color: var(--ink-soft); font-size: 16px; max-width: 520px; margin: 0 auto 40px; }
.contact__actions{ display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; }

/* ================= FOOTER ================= */
.footer{
  display: flex;
  justify-content: space-between;
  padding: 28px clamp(20px, 6vw, 64px);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ================= REVEAL ANIM HOOK ================= */
[data-reveal]{ opacity: 0; transform: translateY(28px); }
[data-reveal].is-visible{
  animation: reveal-up 0.7s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes reveal-up{
  to{ opacity: 1; transform: translateY(0); }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 860px){
  .nav__links{ display: none; }
  .nav__burger{ display: flex; }
  .hero{ min-height: auto; padding-top: 120px; }
  .bento{ grid-template-columns: repeat(2, 1fr); }
  .bento__card--lg{ grid-row: span 1; }
  .manifest__summary{ grid-template-columns: 60px 1fr 20px; }
  .manifest__tags{ display: none !important; }
  .manifest__split{ grid-template-columns: 1fr; }
  .timeline__row{ grid-template-columns: 1fr; gap: 8px; }
  .contact{ margin-top: 90px; }
}

@media (max-width: 540px){
  .hero{ padding-top: 120px; min-height: auto; }
  .section{ padding-top: 88px; }
  .bento{ grid-template-columns: 1fr; }
  .bento__card--lg, .bento__card--wide{ grid-column: span 1; }
}

/* ================= AI CHAT WIDGET ================= */
/* Hidden for now — no Anthropic billing set up yet. Delete this rule (and only
   this rule) to bring the chat bubble back once credits are added. */
.ai-chat{ display: none !important; }

.ai-chat{
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 700;
  font-family: var(--font-body);
}

.ai-chat__fab{
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-teal));
  color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.ai-chat__fab:hover{ transform: scale(1.06); }
.ai-chat__fab-icon{
  width: 26px; height: 26px;
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.ai-chat__fab-icon--close{ opacity: 0; transform: rotate(-90deg) scale(0.6); }
.ai-chat[data-open] .ai-chat__fab-icon--open{ opacity: 0; transform: rotate(90deg) scale(0.6); }
.ai-chat[data-open] .ai-chat__fab-icon--close{ opacity: 1; transform: rotate(0) scale(1); }
.ai-chat__fab-pulse{
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  opacity: 0.5;
  pointer-events: none;
  animation: chat-pulse 2.4s ease-out infinite;
}
.ai-chat[data-open] .ai-chat__fab-pulse{ display: none; }
@keyframes chat-pulse{
  0%{ transform: scale(0.9); opacity: 0.5; }
  100%{ transform: scale(1.4); opacity: 0; }
}

.ai-chat__panel{
  position: absolute;
  bottom: 76px;
  right: 0;
  width: min(380px, calc(100vw - 48px));
  height: min(560px, calc(100vh - 140px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease, visibility 0.25s;
}
.ai-chat[data-open] .ai-chat__panel{
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ai-chat__header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.ai-chat__header-info{ display: flex; align-items: center; gap: 10px; }
.ai-chat__avatar{ width: 30px; height: 30px; flex-shrink: 0; }
.ai-chat__avatar svg{ width: 100%; height: 100%; }
.ai-chat__header-text{ display: flex; flex-direction: column; gap: 2px; }
.ai-chat__header-text strong{ font-size: 13.5px; font-weight: 600; color: var(--ink); }
.ai-chat__status{ display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-faint); font-family: var(--font-mono); }
.ai-chat__status-dot{ width: 6px; height: 6px; border-radius: 50%; background: var(--accent-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-teal) 20%, transparent); }
.ai-chat__close{ color: var(--ink-faint); padding: 6px; border-radius: 8px; transition: color 0.2s ease, background-color 0.2s ease; }
.ai-chat__close:hover{ color: var(--ink); background: var(--surface-2); }
.ai-chat__close svg{ width: 14px; height: 14px; }

.ai-chat__messages{
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-chat__msg{
  max-width: 84%;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 10px 13px;
  border-radius: 14px;
  animation: chat-msg-in 0.3s cubic-bezier(0.16,1,0.3,1) backwards;
}
@keyframes chat-msg-in{ from{ opacity: 0; transform: translateY(6px); } to{ opacity: 1; transform: translateY(0); } }
.ai-chat__msg--bot{
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.ai-chat__msg--user{
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.ai-chat__msg--error{
  align-self: flex-start;
  background: color-mix(in srgb, var(--accent-teal) 10%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent-teal) 30%, var(--line));
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.ai-chat__typing{
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ai-chat__typing span{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: chat-typing 1.2s ease-in-out infinite;
}
.ai-chat__typing span:nth-child(2){ animation-delay: 0.15s; }
.ai-chat__typing span:nth-child(3){ animation-delay: 0.3s; }
@keyframes chat-typing{
  0%, 60%, 100%{ transform: translateY(0); opacity: 0.5; }
  30%{ transform: translateY(-4px); opacity: 1; }
}

.ai-chat__suggestions{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 12px;
  flex-shrink: 0;
}
.ai-chat__chip{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 12px;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.ai-chat__chip:hover{ border-color: var(--accent-gold); color: var(--ink); transform: translateY(-1px); }

.ai-chat__input-row{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.ai-chat__input-row input{
  flex: 1;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 15px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s ease;
}
.ai-chat__input-row input:focus{ border-color: var(--accent-gold); }
.ai-chat__send{
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
html.dark .ai-chat__send{ background: var(--accent-gold-soft); color: #14161C; }
.ai-chat__send:hover{ transform: scale(1.08); }
.ai-chat__send:disabled{ opacity: 0.5; transform: none; cursor: default; }
.ai-chat__send svg{ width: 14px; height: 14px; }

@media (max-width: 480px){
  .ai-chat{ bottom: 16px; right: 16px; }
  .ai-chat__panel{ width: calc(100vw - 32px); height: calc(100vh - 120px); bottom: 72px; }
}

/* ---- Case 4 (Dollars.com) extra diagram elements ---- */
.viz-peg-line{ stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.7; }
.viz-chain-block{ fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.manifest__row[data-open] .viz-chain-block{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: calc(var(--i, 0) * 0.15s + 0.3s);
}

/* ---- Case 1 (Pollen LMS): demand gauge, price comparison, channel legend ---- */
.viz-chip{ fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; opacity: 0; }
.viz-chip-text{ font-family: var(--font-mono); font-size: 9px; fill: var(--ink-soft); }
.viz-gauge-track{ fill: none; stroke: var(--line-strong); stroke-width: 8; opacity: 0.5; }
.viz-gauge-progress{ fill: none; stroke-width: 8; stroke-linecap: round; stroke-dashoffset: 100; }
.manifest__row[data-open] .viz-gauge-progress{
  animation: viz-draw 1.2s cubic-bezier(0.16,1,0.3,1) 0.25s forwards;
}
.viz-gauge-num{ font-family: var(--font-display); font-size: 22px; font-weight: 700; fill: var(--ink); opacity: 0; }
.viz-gauge-sub{ font-family: var(--font-mono); font-size: 7px; fill: var(--ink-faint); letter-spacing: 0.04em; }
.viz-price-old{ font-family: var(--font-mono); font-size: 15px; fill: var(--ink-faint); opacity: 0; }
.viz-price-strike{ stroke: var(--ink-faint); stroke-width: 1.4; opacity: 0; }
.viz-price-arrow{ fill: none; stroke: var(--accent-teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.viz-price-new{ font-family: var(--font-display); font-size: 26px; font-weight: 700; fill: var(--accent-gold); opacity: 0; }
.viz-legend-text{ font-family: var(--font-mono); font-size: 8.5px; fill: var(--ink-soft); opacity: 0; }

/* generic reveal-in-place used by chips, badges, prices, legend items */
.viz-reveal{ opacity: 0; }
.manifest__row[data-open] .viz-reveal{
  transform-box: fill-box;
  transform-origin: center;
  animation: viz-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.15s);
}
/* text/line elements shouldn't pop-scale (looks odd on glyphs) — fade instead */
text.viz-reveal, line.viz-reveal, path.viz-reveal{
  animation-name: viz-fade-in-op;
}
@keyframes viz-fade-in-op{ to{ opacity: 1; } }

/* ---- Case 4 (Dollars.com): coin, cashback card, ledger chain ---- */
.viz-coin{ opacity: 0; }
.viz-coin-rim{ fill: none; stroke: var(--surface); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: 0; }
.viz-coin-symbol{ font-family: var(--font-display); font-size: 30px; font-weight: 700; fill: var(--surface); }
.viz-coin-ring{ fill: none; stroke: var(--accent-gold); stroke-width: 1.4; opacity: 0; }
.manifest__row[data-open] .viz-coin-ring{
  animation: viz-ripple 2s ease-out 0.4s infinite;
}
.viz-card-chip{ fill: color-mix(in srgb, var(--surface) 60%, transparent); }
.viz-card-badge{ fill: var(--surface); }
.viz-card-badge-text{ font-family: var(--font-mono); font-size: 8px; font-weight: 700; fill: var(--accent-gold); }
.viz-card-dot{ fill: color-mix(in srgb, var(--surface) 70%, transparent); }
.viz-check{ fill: none; stroke: var(--accent-teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }

/* ================= SCROLL PROGRESS (header-to-footer thread) ================= */
.scroll-progress{
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-teal), var(--accent-gold));
  transform-origin: left;
  transform: scaleX(0);
  z-index: 900;
  pointer-events: none;
}

/* ================= SECTION BACKGROUND ORBS (systems) ================= */
.systems-wrap{ position: relative; overflow: hidden; }
.section--manifest{ position: relative; }
.section__orbs{ position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.section__orb{ position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.4; }
.section__orb--a{
  width: 480px; height: 480px;
  top: 10%; left: -180px;
  background: radial-gradient(circle, var(--accent-teal) 0%, transparent 70%);
}
.section__orb--b{
  width: 420px; height: 420px;
  bottom: -120px; right: -160px;
  background: radial-gradient(circle, var(--accent-gold) 0%, transparent 70%);
}

/* ---- Scroll-scrubbed reveal for manifest rows (System section) ---- */
.manifest__row{ will-change: opacity, transform; }

/* ---- Continuous idle motion so diagrams don't go static after first reveal ---- */
.manifest__row[data-open] .viz-gauge-progress{
  animation: viz-draw 1.2s cubic-bezier(0.16,1,0.3,1) 0.25s forwards, viz-glow-pulse 2.4s ease-in-out 1.6s infinite;
}
.manifest__row[data-open] path.viz-price-arrow{
  animation: viz-fade-in-op 0.4s ease-out 0.45s both, viz-bounce-y 1.6s ease-in-out 1.1s infinite;
}
.manifest__row[data-open] .viz-bar{
  animation: viz-grow-y 0.6s cubic-bezier(0.34,1.56,0.64,1) both, viz-shimmer 2.8s ease-in-out 1s infinite;
  animation-delay: calc(var(--i, 0) * 0.09s), calc(var(--i, 0) * 0.2s + 1s);
}
.manifest__row[data-open] .viz-fill{
  animation: viz-grow-x 0.7s cubic-bezier(0.34,1.56,0.64,1) both, viz-shimmer 2.8s ease-in-out 1.2s infinite;
  animation-delay: calc(var(--i, 0) * 0.12s + 0.1s), calc(var(--i, 0) * 0.2s + 1.2s);
}

@keyframes viz-glow-pulse{ 0%, 100%{ opacity: 1; } 50%{ opacity: 0.6; } }
@keyframes viz-bounce-y{ 0%, 100%{ transform: translateY(0); } 50%{ transform: translateY(4px); } }
@keyframes viz-shimmer{ 0%, 100%{ opacity: 1; } 50%{ opacity: 0.75; } }

/* ================= OTHER PROJECTS TOGGLE ================= */
.other-projects{ margin-top: 56px; }
.other-projects__toggle{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 12px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.other-projects__toggle:hover{ border-color: var(--accent-gold); color: var(--ink); }
.other-projects__chev{ width: 13px; height: 13px; transition: transform 0.3s ease; }
.other-projects[data-open] .other-projects__chev{ transform: rotate(180deg); }
.other-projects__panel{
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.5s cubic-bezier(0.65,0,0.35,1);
}
.other-projects[data-open] .other-projects__panel{ grid-template-rows: 1fr; margin-top: 24px; }
.other-projects__panel > *{ overflow: hidden; }
.other-projects__panel .manifest{ border-top: none; }
