/* ============================================================
   CAST Agent — castagent.strategictuning.com
   Brand tokens sourced from strategictuning.com
   ============================================================ */

:root {
  /* Strategic Tuning brand palette (HSL, matching parent site) */
  --midnight: 211 100% 12%;
  --gold: 39 41% 50%;
  --gold-bright: 39 55% 62%;
  --cream: 42 31% 94%;
  --cream-bg: 42 31% 96%;
  --charcoal: 0 0% 20%;
  --teal: 179 40% 40%;
  --risk: 0 72% 60%;

  --font-display: 'Cinzel', serif;
  --font-body: 'Montserrat', -apple-system, sans-serif;

  --text-base: clamp(1rem, 0.94rem + 0.3vw, 1.125rem);
  --text-hero: clamp(2.2rem, 1.2rem + 4.2vw, 4.25rem);
  --text-h2: clamp(1.7rem, 1.2rem + 2vw, 2.75rem);
  --space-section: clamp(4.5rem, 3rem + 6vw, 9rem);
  --content-width: 1160px;

  --duration-fast: 150ms;
  --duration-normal: 400ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: hsl(var(--midnight));
  background: hsl(var(--cream-bg));
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Type ---------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; }

h1 { font-size: var(--text-hero); letter-spacing: 0.01em; }
h2 { font-size: var(--text-h2); }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: hsl(var(--gold-bright));
  margin-bottom: 1.1rem;
}
.eyebrow-dark { color: hsl(var(--gold)); }

.gold-em { color: hsl(var(--gold-bright)); font-style: normal; }

.section-head {
  max-width: 760px;
  margin: 0 auto 3.5rem;
  text-align: center;
  padding: 0 1.5rem;
}
.section-sub { margin-top: 1rem; opacity: 0.82; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  padding: 0.95rem 1.9rem;
  border-radius: 4px;
  text-decoration: none;
  transition: transform var(--duration-fast) ease,
              box-shadow var(--duration-fast) ease,
              background-color var(--duration-fast) ease,
              color var(--duration-fast) ease;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 3px solid hsl(var(--gold)); outline-offset: 3px; }

.btn-gold {
  background: hsl(var(--gold));
  color: hsl(var(--midnight));
}
.btn-gold:hover {
  background: hsl(var(--gold-bright));
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -8px hsl(var(--gold) / 0.55);
}

.btn-ghost {
  color: hsl(var(--cream));
  border: 1px solid hsl(var(--cream) / 0.35);
}
.btn-ghost:hover {
  border-color: hsl(var(--gold-bright));
  color: hsl(var(--gold-bright));
  transform: translateY(-2px);
}

.btn-outline {
  color: hsl(var(--midnight));
  border: 1.5px solid hsl(var(--midnight) / 0.3);
}
.btn-outline:hover {
  border-color: hsl(var(--gold));
  background: hsl(var(--gold) / 0.08);
  transform: translateY(-2px);
}

/* ---------- Nav ---------- */

.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: hsl(var(--midnight) / 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--cream) / 0.08);
  transition: background-color var(--duration-normal) ease;
}

.nav-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem 1.5rem;
}

.nav-brand { text-decoration: none; display: flex; flex-direction: column; line-height: 1.1; }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: hsl(var(--cream));
  letter-spacing: 0.04em;
}
.brand-mark em { color: hsl(var(--gold-bright)); font-style: normal; }
.brand-by {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: hsl(var(--cream) / 0.55);
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin-left: auto;
}
.nav-links a {
  color: hsl(var(--cream) / 0.8);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color var(--duration-fast) ease;
}
.nav-links a:hover { color: hsl(var(--gold-bright)); }

.btn-nav { padding: 0.6rem 1.2rem; font-size: 0.82rem; white-space: nowrap; }
.btn-nav .label-short { display: none; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
}

@media (max-width: 560px) {
  .btn-nav .label-full { display: none; }
  .btn-nav .label-short { display: inline; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  background:
    radial-gradient(ellipse 90% 60% at 70% 10%, hsl(211 80% 20%) 0%, transparent 55%),
    hsl(var(--midnight));
  color: hsl(var(--cream));
  padding: calc(var(--space-section) + 4.5rem) 1.5rem var(--space-section);
  overflow: hidden;
}

.hero-grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(hsl(var(--cream) / 0.035) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--cream) / 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, black 30%, transparent 75%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.hero-sub {
  max-width: 680px;
  margin: 1.75rem auto 0;
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  color: hsl(var(--cream) / 0.85);
}
.hero-sub strong { color: hsl(var(--gold-bright)); font-weight: 600; }

.hero-ctas {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}

.hero-trust {
  margin-top: 2.25rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: hsl(var(--cream) / 0.5);
}

/* Consequence-map figure */

.hero-map {
  position: relative;
  max-width: 820px;
  margin: 4rem auto 0;
}

.map-edges path {
  stroke: hsl(var(--cream) / 0.25);
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
  animation: draw-edge 1.6s var(--ease-out-expo) forwards;
}
.map-edges path:nth-child(2) { animation-delay: 0.15s; }
.map-edges path:nth-child(3) { animation-delay: 0.3s; }
.map-edges path:nth-child(4) { animation-delay: 0.6s; }
.map-edges path:nth-child(5) { animation-delay: 0.7s; }
.map-edges path:nth-child(6) { animation-delay: 0.8s; }
.map-edges path:nth-child(7) { animation-delay: 0.9s; }
.map-edges path:nth-child(8) { animation-delay: 1s; }
.map-edges path.edge-risk { stroke: hsl(var(--risk) / 0.8); animation-delay: 1.5s; }

@keyframes draw-edge { to { stroke-dashoffset: 0; } }

.map-nodes circle { fill: hsl(var(--cream) / 0.55); }
.map-nodes .node-root { fill: hsl(var(--gold)); }
.map-nodes .node-risk { fill: hsl(var(--risk)); }

.map-labels text {
  font-family: var(--font-body);
  font-size: 13px;
  fill: hsl(var(--cream) / 0.6);
  text-anchor: middle;
}
.map-labels .label-risk { fill: hsl(0 72% 72%); }

.map-caption {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.88rem;
  color: hsl(var(--cream) / 0.55);
  font-style: italic;
}

/* ---------- Stakes ---------- */

.stakes {
  background: hsl(var(--cream));
  padding: var(--space-section) 1.5rem;
  border-bottom: 1px solid hsl(var(--midnight) / 0.08);
}

.stakes-inner { max-width: 820px; margin: 0 auto; text-align: center; }

.stat-figure {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 2rem + 5.5vw, 6rem);
  line-height: 1;
  color: hsl(var(--midnight));
}
.stat-plus { color: hsl(var(--gold)); }

.stat-caption {
  margin-top: 0.9rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.stakes-copy {
  max-width: 640px;
  margin: 2.25rem auto 0;
  display: grid;
  gap: 1.1rem;
  color: hsl(var(--midnight) / 0.85);
}

/* ---------- Framework ---------- */

.framework {
  padding: var(--space-section) 1.5rem;
  background: hsl(var(--cream-bg));
}

.cast-grid {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
@media (max-width: 1000px) { .cast-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cast-grid { grid-template-columns: 1fr; } }

.cast-card {
  position: relative;
  background: hsl(40 33% 99%);
  border: 1px solid hsl(42 15% 84%);
  border-top: 3px solid hsl(var(--gold));
  padding: 2.25rem 1.75rem 2rem;
  overflow: hidden;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.cast-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px -18px hsl(var(--midnight) / 0.3);
}

.cast-letter {
  position: absolute;
  top: -1.4rem;
  right: 0.4rem;
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 700;
  color: hsl(var(--gold) / 0.12);
  line-height: 1;
  pointer-events: none;
}

.cast-card h3 { font-size: 1.35rem; margin-bottom: 0.75rem; }
.cast-card p { font-size: 0.94rem; color: hsl(var(--midnight) / 0.8); }

/* ---------- How it works ---------- */

.how {
  background: hsl(var(--midnight));
  color: hsl(var(--cream));
  padding: var(--space-section) 1.5rem;
}

.how-steps {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  list-style: none;
  counter-reset: step;
}
@media (max-width: 860px) { .how-steps { grid-template-columns: 1fr; max-width: 560px; } }

.step-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--gold-bright));
  letter-spacing: 0.25em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid hsl(var(--cream) / 0.15);
}

.how-step h3 { font-size: 1.3rem; margin-bottom: 0.7rem; color: hsl(var(--cream)); }
.how-step p { font-size: 0.95rem; color: hsl(var(--cream) / 0.75); }

/* ---------- Who ---------- */

.who { padding: var(--space-section) 1.5rem; background: hsl(var(--cream)); }

.who-grid {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
@media (max-width: 860px) { .who-grid { grid-template-columns: 1fr; } }

.who-card {
  background: hsl(40 33% 99%);
  border: 1px solid hsl(42 15% 84%);
  border-left: 3px solid hsl(var(--teal));
  padding: 2rem 2rem 1.9rem;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.who-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px -16px hsl(var(--midnight) / 0.28);
}

.who-role {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--teal));
  margin-bottom: 0.9rem;
}
.who-card h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.45;
  margin-bottom: 0.7rem;
}
.who-card > p:last-child { font-size: 0.92rem; color: hsl(var(--midnight) / 0.75); }

/* ---------- Compare ---------- */

.compare { padding: var(--space-section) 1.5rem; background: hsl(var(--midnight)); color: hsl(var(--cream)); }

.compare-table {
  max-width: 920px;
  margin: 0 auto;
  border: 1px solid hsl(var(--cream) / 0.15);
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  border-bottom: 1px solid hsl(var(--cream) / 0.12);
  transition: background-color var(--duration-fast) ease;
}
.compare-row:last-child { border-bottom: none; }
.compare-row:hover { background: hsl(var(--cream) / 0.04); }

.compare-alt {
  padding: 1.4rem 1.6rem;
  font-size: 0.9rem;
  color: hsl(var(--cream) / 0.55);
  border-right: 1px solid hsl(var(--cream) / 0.12);
}
.compare-cast { padding: 1.4rem 1.6rem; font-size: 0.95rem; font-weight: 500; }

@media (max-width: 640px) {
  .compare-row { grid-template-columns: 1fr; }
  .compare-alt { border-right: none; padding-bottom: 0.4rem; }
  .compare-cast { padding-top: 0.2rem; }
}

/* ---------- Pricing ---------- */

.pricing { padding: var(--space-section) 1.5rem; background: hsl(var(--cream-bg)); }

.pricing-grid {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: stretch;
}
@media (max-width: 1080px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .pricing-grid { grid-template-columns: 1fr; } }

.price-card {
  display: flex;
  flex-direction: column;
  background: hsl(40 33% 99%);
  border: 1px solid hsl(42 15% 84%);
  padding: 2.1rem 1.7rem;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.price-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px -18px hsl(var(--midnight) / 0.3);
}

.price-featured {
  background: hsl(var(--midnight));
  color: hsl(var(--cream));
  border-color: hsl(var(--gold));
}
.price-featured h3 { color: hsl(var(--cream)); }
.price-card.price-featured li { color: hsl(var(--cream) / 0.8); }

.price-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--gold-bright));
  margin-bottom: 0.9rem;
}

.price-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }

.price { font-size: 0.9rem; margin-bottom: 1.4rem; opacity: 0.85; }
.price-num {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  opacity: 1;
}
.price-featured .price-num { color: hsl(var(--gold-bright)); }

.price-card ul { list-style: none; display: grid; gap: 0.55rem; margin-bottom: 1.8rem; flex: 1; }
.price-card li {
  font-size: 0.88rem;
  padding-left: 1.2rem;
  position: relative;
  color: hsl(var(--midnight) / 0.8);
}
.price-card li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: hsl(var(--gold));
}

.price-card .btn { text-align: center; }

/* ---------- Security ---------- */

.security { padding: var(--space-section) 1.5rem; background: hsl(var(--midnight)); color: hsl(var(--cream)); }

.security-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 3.5rem;
  align-items: center;
}
@media (max-width: 860px) { .security-inner { grid-template-columns: 1fr; } }

.section-head-left h2 { margin-bottom: 1rem; }
.section-head-left p:last-child { color: hsl(var(--cream) / 0.75); }

.security-list { list-style: none; display: grid; gap: 1rem; }
.security-list li {
  padding: 1.1rem 1.4rem;
  border: 1px solid hsl(var(--cream) / 0.15);
  border-left: 3px solid hsl(var(--gold));
  font-size: 0.94rem;
  color: hsl(var(--cream) / 0.85);
  background: hsl(var(--cream) / 0.03);
}
.security-list strong { color: hsl(var(--cream)); }

/* ---------- Final CTA ---------- */

.final-cta {
  background:
    radial-gradient(ellipse 70% 90% at 50% 110%, hsl(39 41% 30% / 0.5) 0%, transparent 60%),
    hsl(var(--midnight));
  color: hsl(var(--cream));
  padding: var(--space-section) 1.5rem;
  text-align: center;
  border-top: 1px solid hsl(var(--gold) / 0.35);
}

.final-cta-inner { max-width: 720px; margin: 0 auto; }
.final-cta p { margin: 1.4rem auto 0; max-width: 560px; color: hsl(var(--cream) / 0.8); }

/* ---------- Footer ---------- */

.site-footer {
  background: hsl(211 100% 8%);
  color: hsl(var(--cream) / 0.65);
  padding: 3.5rem 1.5rem 2.5rem;
}

.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.footer-brand p { font-size: 0.88rem; max-width: 420px; margin-top: 0.6rem; }

.footer-links { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.footer-links a {
  color: hsl(var(--cream) / 0.7);
  text-decoration: none;
  font-size: 0.86rem;
  transition: color var(--duration-fast) ease;
}
.footer-links a:hover { color: hsl(var(--gold-bright)); }

.footer-legal { font-size: 0.78rem; color: hsl(var(--cream) / 0.4); }

/* ---------- Scroll reveal ---------- */

/* Hidden state only applies once JS confirms it's running (html.js),
   so content is never lost if scripts fail to load. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-normal) var(--ease-out-expo),
              transform var(--duration-normal) var(--ease-out-expo);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .map-edges path { animation: none; stroke-dashoffset: 0; }
  .btn, .cast-card, .who-card, .price-card { transition: none; }
}
