/* FIZMAT FIDES — warm frontier design system. Harmond display + Inter UI. */

/* ---- Harmond display faces (self-hosted) ---- */
@font-face {
  font-family: "Harmond";
  src: url("fonts/Harmond-ExtraBoldExpanded.woff2") format("woff2");
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Harmond";
  src: url("fonts/Harmond-ExtBdItaExp.woff2") format("woff2");
  font-weight: 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Harmond Cond";
  src: url("fonts/Harmond-SemiBoldCondensed.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Harmond Cond";
  src: url("fonts/Harmond-SemBdItaCond.woff2") format("woff2");
  font-weight: 600; font-style: italic; font-display: swap;
}

:root {
  /* brand / accent */
  --primary: #fa520f;
  --primary-deep: #cc3a05;
  --on-primary: #ffffff;
  --sunshine-500: #ffb83e;
  --sunshine-700: #ffa110;
  --sunshine-800: #ff8105;
  --sunshine-900: #ff8a00;
  --yellow-saturated: #ffd900;
  /* cream / warm neutral */
  --cream: #fff8e0;
  --cream-light: #fffaeb;
  --cream-deeper: #fff0c2;
  --beige-deep: #e6d5a8;
  /* ink / text */
  --ink: #1f1f1f;
  --ink-tint: #3d3d3d;
  --slate: #4a4a4a;
  --steel: #6a6a6a;
  --stone: #8a8a8a;
  --muted: #a8a8a8;
  /* surface */
  --canvas: #ffffff;
  --surface: #fafafa;
  --surface-code: #1c1c1e;
  --on-dark: #ffffff;
  --on-dark-muted: #a8a8a8;
  --hairline: #e5e5e5;
  --hairline-soft: #ededed;
  --hairline-strong: #c7c7c7;
  /* radius */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;
  /* spacing */
  --s-xs: 8px; --s-sm: 12px; --s-md: 16px; --s-lg: 20px; --s-xl: 24px;
  --s-xxl: 32px; --s-xxxl: 40px; --s-section: 64px; --s-section-lg: 96px; --s-hero: 120px;
  /* fonts */
  --font-display: "Harmond", "Arial Narrow", Impact, sans-serif;
  --font-cond: "Harmond Cond", "Arial Narrow", Impact, sans-serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 var(--s-md); font-weight: 400; }
p { margin: 0 0 var(--s-md); }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s-xl); }
.eyebrow {
  font-family: var(--font-cond);
  font-size: 13px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--primary);
}
.display { font-family: var(--font-display); font-weight: 800; line-height: 1.0; letter-spacing: -0.01em; text-transform: uppercase; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  line-height: 1.3; border-radius: var(--r-md); padding: 11px 20px;
  border: 1px solid transparent; cursor: pointer;
  transition: background 150ms ease, transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), color 150ms ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-deep); text-decoration: none; box-shadow: 0 6px 18px rgba(250,82,15,0.28); }
.btn-dark { background: var(--ink); color: var(--on-dark); }
.btn-dark:hover { background: #000; text-decoration: none; box-shadow: 0 6px 18px rgba(31,31,31,0.22); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--hairline-strong); }
.btn-secondary:hover { background: var(--surface); text-decoration: none; }
.btn-cream { background: var(--cream); color: var(--ink); border-color: var(--beige-deep); }
.btn-cream:hover { box-shadow: 0 6px 18px rgba(230,213,168,0.4); text-decoration: none; }

/* ---- badges ---- */
.badge {
  display: inline-block; font-size: 13px; font-weight: 600;
  border-radius: var(--r-full); padding: 4px 12px;
}
.badge-orange { background: var(--primary); color: var(--on-primary); }
.badge-cream { background: var(--cream-deeper); color: var(--ink); }

/* ---- top nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.72); backdrop-filter: blur(12px) saturate(1.3);
  border-bottom: 1px solid transparent;
  transition: background 300ms var(--ease-out), border-color 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
}
.nav.scrolled {
  background: rgba(255,255,255,0.9);
  border-bottom-color: var(--hairline-soft);
  box-shadow: 0 1px 20px rgba(31,31,31,0.05);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand img { width: 30px; height: 30px; }
.brand span { font-family: var(--font-cond); font-weight: 600; font-size: 20px; text-transform: uppercase; letter-spacing: 0.5px; }
.nav-links { display: flex; align-items: center; gap: var(--s-xl); }
.nav-links a { color: var(--slate); font-size: 14px; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-cta { display: flex; gap: var(--s-sm); align-items: center; }
.nav-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

/* ---- hero ---- */
.hero { position: relative; overflow: hidden; padding: var(--s-hero) 0 var(--s-section-lg); }
.hero-shader {
  position: absolute; inset: -10%; z-index: 0;
  /* CSS fallback gradient; shader canvas layers on top when available */
  background:
    radial-gradient(120% 120% at 80% 10%, #ffd900 0%, #ff8105 35%, #fa520f 65%, #cc3a05 100%);
  background-size: 160% 160%;
  animation: heroDrift 24s var(--ease-out) infinite alternate;
}
.hero-shader canvas { width: 100% !important; height: 100% !important; display: block; }
@keyframes heroDrift {
  0%   { background-position: 80% 10%; }
  100% { background-position: 50% 40%; }
}
/* fine grain over the gradient for a frontier, printed feel */
.hero-grain {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}
.hero-veil {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(255,248,224,0) 55%, rgba(255,248,224,0.9) 100%);
}
.hero-inner { position: relative; z-index: 2; }
.hero h1 {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(44px, 8.5vw, 92px); line-height: 0.95; letter-spacing: -0.015em;
  color: var(--ink); max-width: 15ch;
}
.hero .vote {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(30px, 5vw, 52px); letter-spacing: -0.01em; line-height: 1;
  color: var(--primary-deep); margin: var(--s-md) 0 var(--s-xl);
}
.hero p.sub { font-size: 18px; color: var(--ink-tint); max-width: 50ch; }
.hero-cta { display: flex; gap: var(--s-sm); flex-wrap: wrap; margin-top: var(--s-xl); }

/* ---- generic section ---- */
.section { padding: var(--s-section-lg) 0; }
.section.cream { background: var(--cream-light); }
.section h2 {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(32px, 4.5vw, 52px); letter-spacing: -0.01em; line-height: 1.0;
}
.section .lead { font-size: 18px; color: var(--slate); max-width: 56ch; }

/* ---- cards grid ---- */
.grid { display: grid; gap: var(--s-xl); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--canvas); border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg); padding: var(--s-xxl);
  transition: transform 300ms var(--ease-out), box-shadow 300ms var(--ease-out), border-color 300ms var(--ease-out);
}
.card.lift:hover { transform: translateY(-4px); border-color: var(--hairline); box-shadow: 0 14px 40px rgba(31,31,31,0.08); }
.card h3 { font-family: var(--font-cond); font-size: 25px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.01em; }
.card-h { font-family: var(--font-cond); font-size: 20px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: var(--s-md); }
.card p { color: var(--slate); margin: 0; }
.card .ic { font-size: 24px; margin-bottom: var(--s-md); }

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--s-xl); }
.stat .n { font-family: var(--font-display); font-weight: 800; font-size: clamp(42px, 5vw, 60px); letter-spacing: -0.01em; color: var(--ink); line-height: 1.0; font-variant-numeric: tabular-nums; }
.stat .l { font-family: var(--font-cond); text-transform: uppercase; letter-spacing: 1px; color: var(--steel); font-size: 13px; }

/* ---- chat widget ---- */
.chat {
  background: var(--canvas); border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg); box-shadow: rgba(0,0,0,0.04) 0 4px 12px;
  overflow: hidden; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-sm) var(--s-md); border-bottom: 1px solid var(--hairline-soft);
  background: var(--cream-light);
}
.chat-head .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.chat-head select {
  font-family: var(--font-mono); font-size: 12px; color: var(--slate);
  border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 4px 8px; background: #fff;
}
.chat-log { padding: var(--s-lg); min-height: 280px; max-height: 440px; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s-md); }
.msg { display: flex; gap: 10px; }
.msg .av { flex: 0 0 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.msg.user .av { background: var(--ink); color: #fff; }
.msg.bot .av { background: var(--primary); color: #fff; }
.msg .body { background: var(--surface); border: 1px solid var(--hairline-soft); border-radius: var(--r-md); padding: 10px 14px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; max-width: 92%; }
.msg.user .body { background: var(--cream); border-color: var(--beige-deep); }
.msg .body code { font-family: var(--font-mono); font-size: 13px; background: #efefef; padding: 1px 5px; border-radius: 4px; }
.chat-form { display: flex; gap: var(--s-sm); padding: var(--s-md); border-top: 1px solid var(--hairline-soft); }
.chat-form input {
  flex: 1; height: 44px; border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md); padding: 0 14px; font-family: var(--font-ui); font-size: 15px;
}
.chat-form input:focus { outline: none; border: 2px solid var(--primary); }
.chat-hint { text-align: center; font-size: 12px; color: var(--stone); margin-top: var(--s-sm); }

/* ---- code block ---- */
.code {
  background: var(--surface-code); color: var(--on-dark); border-radius: var(--r-md);
  overflow: hidden; margin: 0 0 var(--s-md);
}
.code-head { font-size: 12px; color: var(--on-dark-muted); padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; justify-content: space-between; }
.code pre { margin: 0; padding: var(--s-md); overflow-x: auto; }
.code code { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55; color: #e8e8e8; }
.copy-btn { background: none; border: 0; color: var(--on-dark-muted); cursor: pointer; font-size: 12px; }
.copy-btn:hover { color: #fff; }

/* ---- api tables ---- */
.table-wrap { overflow-x: auto; margin-bottom: var(--s-md); }
.api-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.api-table th {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 12px; font-weight: 600; color: var(--steel);
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hairline-strong);
}
.api-table td { padding: 10px 12px; border-bottom: 1px solid var(--hairline-soft); vertical-align: top; }
.api-table tbody tr { transition: background 160ms var(--ease-out); }
.api-table tbody tr:hover { background: var(--cream-light); }
.api-table .mono { font-family: var(--font-mono); }
.api-table .desc { color: var(--slate); }

/* ---- tabs ---- */
.tabs { display: flex; gap: var(--s-md); border-bottom: 1px solid var(--hairline); margin-bottom: var(--s-lg); }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 4px; font-size: 14px; font-weight: 500; color: var(--steel); cursor: pointer; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- faq ---- */
.faq-item { border-bottom: 1px solid var(--hairline); padding: var(--s-lg) 0; }
.faq-item summary {
  font-family: var(--font-cond); text-transform: uppercase; letter-spacing: 0.01em;
  font-weight: 600; font-size: 21px; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-md);
  transition: color 180ms var(--ease-out);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 24px; color: var(--primary); transition: transform 240ms var(--ease-spring); line-height: 1; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item summary:hover { color: var(--primary); }
.faq-item[open] summary { color: var(--primary); }
.faq-item p { margin: var(--s-sm) 0 0; color: var(--slate); animation: faqReveal 360ms var(--ease-out); }
@keyframes faqReveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- final CTA band ---- */
.cta-final {
  position: relative; overflow: hidden; padding: var(--s-section-lg) 0;
  background: var(--ink); color: #fff;
}
.cta-glow {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%);
  width: 820px; height: 820px; max-width: 120vw; pointer-events: none;
  background: radial-gradient(circle, rgba(250,82,15,0.42) 0%, rgba(255,138,0,0.14) 38%, rgba(31,31,31,0) 68%);
  animation: ctaPulse 7s var(--ease-out) infinite alternate;
}
@keyframes ctaPulse { from { opacity: 0.7; transform: translate(-50%,-50%) scale(0.96); } to { opacity: 1; transform: translate(-50%,-50%) scale(1.06); } }
.cta-final .container { position: relative; z-index: 1; }
.cta-head {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(36px, 6vw, 68px); line-height: 0.95; letter-spacing: -0.015em;
  color: #fff; margin-bottom: var(--s-md);
}
.cta-sub { font-size: 18px; color: var(--on-dark-muted); margin: 0 auto var(--s-xl); }
.cta-vote {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(30px, 5vw, 56px); letter-spacing: -0.01em; line-height: 1;
  color: var(--sunshine-500);
}

/* ---- sunset stripe (brand signature) ---- */
.sunset-stripe {
  height: 14px; width: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--sunshine-700) 30%, var(--sunshine-500) 55%, var(--yellow-saturated) 80%, var(--cream) 100%);
}

/* ---- footer ---- */
.footer { background: var(--cream); padding: var(--s-section) 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-xl); }
.footer h4 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--steel); margin: 0 0 var(--s-md); }
.footer a { display: block; color: var(--ink); font-size: 14px; padding: 4px 0; }
.footer a:hover { color: var(--primary); }
.footer .fine { margin-top: var(--s-xl); color: var(--steel); font-size: 13px; }

/* ---- utility ---- */
.kv { font-family: var(--font-mono); font-size: 14px; margin-top: 8px; color: var(--ink); word-break: break-all; }
.api-h3 {
  font-family: var(--font-cond); font-weight: 600; text-transform: uppercase; letter-spacing: 0.01em;
  font-size: 28px; margin: var(--s-section) 0 var(--s-md);
}
.center { text-align: center; }
.mt-xl { margin-top: var(--s-xl); }
.mt-xxl { margin-top: var(--s-xxl); }
.mb-xl { margin-bottom: var(--s-xl); }
.narrow { max-width: 720px; margin-left: auto; margin-right: auto; }

/* ---- responsive ---- */
@media (max-width: 1023px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 56px; }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav.open .nav-links { display: flex; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: #fff; padding: var(--s-md) var(--s-xl); border-bottom: 1px solid var(--hairline-soft); gap: var(--s-md); }
  .grid-3, .grid-2, .stats { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: var(--s-section) 0; }
  .hero h1 { font-size: 40px; letter-spacing: -1px; }
  .hero .vote { font-size: 30px; }
  .section h2 { font-size: 34px; }
  .container { padding: 0 var(--s-md); }
}

/* ---- chat markdown ---- */
.msg.bot .body { white-space: normal; }
.msg .body > :first-child { margin-top: 0; }
.msg .body > :last-child { margin-bottom: 0; }
.msg .body p { margin: 0 0 var(--s-sm); }
.msg .body h3, .msg .body h4, .msg .body h5, .msg .body h6 { margin: var(--s-md) 0 var(--s-xs); font-weight: 600; line-height: 1.3; }
.msg .body h3 { font-size: 18px; } .msg .body h4 { font-size: 16px; } .msg .body h5, .msg .body h6 { font-size: 15px; }
.msg .body ul, .msg .body ol { margin: 0 0 var(--s-sm); padding-left: 22px; }
.msg .body li { margin: 2px 0; }
.msg .body blockquote { margin: 0 0 var(--s-sm); padding: 4px 12px; border-left: 3px solid var(--primary); color: var(--slate); background: var(--cream-light); border-radius: 0 6px 6px 0; }
.msg .body hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--s-md) 0; }
.msg .body a { color: var(--primary); }
.md-table { width: 100%; border-collapse: collapse; margin: 0 0 var(--s-sm); font-size: 14px; display: block; overflow-x: auto; }
.md-table th, .md-table td { border: 1px solid var(--hairline); padding: 6px 10px; text-align: left; }
.md-table th { background: var(--cream-light); font-weight: 600; }
.md-table tr:nth-child(even) td { background: var(--surface); }
.md-code { background: var(--surface-code); border-radius: var(--r-md); overflow: hidden; margin: 0 0 var(--s-sm); }
.md-code-h { font-family: var(--font-mono); font-size: 11px; color: var(--on-dark-muted); padding: 5px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.md-code pre { margin: 0; padding: 12px; overflow-x: auto; }
.md-code code { font-family: var(--font-mono); font-size: 13px; color: #e8e8e8; background: none; padding: 0; }

/* ---- promo strip ---- */
.promo {
  display: block; background: var(--ink); color: #fff; text-align: center;
  font-size: 14px; font-weight: 500; padding: 10px 12px; letter-spacing: 0.01em;
  text-decoration: none; transition: background 200ms var(--ease-out);
}
.promo:hover { background: #000; text-decoration: none; }
.promo strong { color: var(--sunshine-500); }

/* ---- logo lockup ---- */

/* ---- motion: scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); will-change: opacity, transform; }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 80ms; }
.reveal.d2 { transition-delay: 160ms; }
.reveal.d3 { transition-delay: 240ms; }

/* ---- motion: hero entrance ---- */
.hero-inner > * { opacity: 0; animation: heroRise 900ms var(--ease-out) forwards; }
.hero-inner > *:nth-child(1) { animation-delay: 120ms; }
.hero-inner > *:nth-child(2) { animation-delay: 220ms; }
.hero-inner > *:nth-child(3) { animation-delay: 320ms; }
.hero-inner > *:nth-child(4) { animation-delay: 420ms; }
.hero-inner > *:nth-child(5) { animation-delay: 520ms; }
@keyframes heroRise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: translateY(0); } }

/* ---- motion: underline links in nav ---- */
.nav-links a { position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 100%;
  background: var(--primary); transform: scaleX(0); transform-origin: left;
  transition: transform 260ms var(--ease-out);
}
.nav-links a:hover::after { transform: scaleX(1); }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-inner > * { opacity: 1; animation: none; }
  .hero-shader { animation: none; }
}
