/* ============================================================
   Sapiency — The Practice
   Brand tokens per visual-system.md; motion pushed for showcase.
   ============================================================ */

:root {
  /* core */
  --purple-900: #2E1A34;
  --purple-800: #472850;
  --purple-700: #5E3568;
  --purple: #7A4686;
  --purple-300: #B08CB8;
  --purple-200: #D3BFD8;
  --purple-100: #EFE7F1;
  --gold-800: #86642F;
  --gold-700: #A87E3F;
  --gold: #C69A58;
  --gold-300: #DDC194;
  --gold-200: #ECD9BC;
  --indigo: #3D417B;
  --slateblue: #31445E;
  --teal: #478D9A;
  --plum: #593640;
  --mauve: #9A6B7E;
  --mauve-light: #C9A9B5;
  --ink: #201826;
  --slate: #5B5560;
  --line: #E7E2EA;
  --wash: #F3EFF5;
  --surface: #FAF9FB;
  --white: #FFFFFF;

  --font-display: "Ubuntu", "Segoe UI", system-ui, sans-serif;
  --font-body: "Mulish", "Nunito Sans", system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(32, 24, 38, .06);
  --shadow-md: 0 8px 24px rgba(32, 24, 38, .08);

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --container: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--purple-200); color: var(--purple-900); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 800; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.015em; }
h2 { font-size: clamp(28px, 4vw, 40px); color: var(--purple-900); max-width: 20ch; }
h3 { font-size: clamp(20px, 2.4vw, 24px); color: var(--purple-800); }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--purple); font-weight: 700; }

p { margin: 0 0 1em; max-width: 68ch; }

a { color: var(--purple); text-decoration: none; }

img { max-width: 100%; display: block; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--gold-800);
  margin-bottom: 20px;
}

/* ---------- progress rail ---------- */
.progress-rail {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: transparent; z-index: 120;
}
.progress-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 18px 0;
  transition: padding .35s var(--ease-out), background .35s, box-shadow .35s;
}
.nav.scrolled {
  padding: 10px 0;
  background: rgba(250, 249, 251, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--line);
}
.nav-inner {
  max-width: var(--container); margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { height: 30px; width: auto; }
.nav-links { display: flex; align-items: center; gap: 32px; }
.nav-links a {
  font-size: 14px; font-weight: 600; color: var(--ink);
  position: relative;
}
.nav-links a:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 1.5px; background: var(--gold);
  transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform .3s var(--ease-out);
}
.nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); transform-origin: 0 50%; }
.nav-cta {
  padding: 9px 18px; border: 1.5px solid var(--purple);
  border-radius: 8px; color: var(--purple) !important;
  transition: background .25s, color .25s;
}
.nav-cta:hover { background: var(--purple); color: var(--white) !important; }
.nav-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 14px 28px;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  border-radius: 8px; cursor: pointer;
  transition: transform .25s var(--ease-out), box-shadow .25s, background .25s, color .25s;
}
.btn-primary { background: var(--purple); color: var(--white); }
.btn-primary:hover { background: var(--purple-700); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { color: var(--purple); border: 1.5px solid var(--purple-200); }
.btn-ghost:hover { border-color: var(--purple); transform: translateY(-2px); }
.btn-gold { background: var(--gold); color: var(--purple-900); }
.btn-gold:hover { background: var(--gold-300); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(198,154,88,.3); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  overflow: hidden;
}
.hero-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.hero-wash {
  position: absolute; z-index: 0;
  right: -10%; top: -20%;
  width: 70%; height: 120%;
  background: radial-gradient(ellipse at 60% 40%, var(--purple-100) 0%, rgba(239,231,241,0) 62%);
  pointer-events: none;
}
.hero-grid { position: relative; z-index: 2; width: 100%; }
.hero-copy { max-width: 640px; padding: 108px 0 60px; }

.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 4.7vw, 57px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--purple-900);
  margin: 0 0 28px;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line span {
  display: block;
  transform: translateY(110%);
  animation: riseIn 1s var(--ease-out) forwards;
}
.hero-title .line:nth-child(1) span { animation-delay: .1s; }
.hero-title .line:nth-child(2) span { animation-delay: .22s; }
.hero-title .line:nth-child(3) span { animation-delay: .34s; }
.hero-title .line:nth-child(4) span { animation-delay: .46s; }

@keyframes riseIn { to { transform: translateY(0); } }

.gold-em {
  font-style: normal;
  color: var(--purple);
  position: relative;
  white-space: nowrap;
}
.gold-em::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 100%; height: 3px; background: var(--gold);
  border-radius: 2px;
  transform: scaleX(0); transform-origin: 0 50%;
  animation: ruleIn .7s var(--ease-out) 1.15s forwards;
}
@keyframes ruleIn { to { transform: scaleX(1); } }

.hero-sub { font-size: 17px; color: var(--slate); max-width: 56ch; margin-bottom: 36px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

.hero-scroll {
  position: absolute; z-index: 2;
  left: clamp(20px, 4vw, 48px); bottom: 36px;
  display: flex; align-items: center; gap: 12px;
}
.hero-scroll-line { width: 48px; height: 1.5px; background: var(--gold); display: block; transform-origin: 0 50%; animation: scrollPulse 2.4s var(--ease-out) infinite; }
@keyframes scrollPulse { 0% { transform: scaleX(.3); opacity:.4 } 50% { transform: scaleX(1); opacity:1 } 100% { transform: scaleX(.3); opacity:.4 } }
.hero-scroll-label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--slate); }

/* ---------- reveal system ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .1s; }
.reveal.d2 { transition-delay: .2s; }
.reveal.d3 { transition-delay: .3s; }
.reveal.d4 { transition-delay: .4s; }

/* ---------- thesis ---------- */
.thesis {
  padding: clamp(100px, 14vw, 180px) 0;
  background: var(--white);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.thesis-quote { margin: 0; max-width: 900px; }
.thesis-quote p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.45;
  color: var(--slate);
  max-width: 34em;
}
.thesis-quote .word { opacity: .16; transition: opacity .5s ease; }
.thesis-quote .word.lit { opacity: 1; }
.thesis-key { color: var(--purple-900) !important; font-weight: 500; }
.thesis-mark {
  background: linear-gradient(transparent 62%, var(--gold-200) 62%);
  color: var(--purple-900);
}

/* ---------- problems ---------- */
.problems { padding: clamp(90px, 12vw, 160px) 0; }
.problems-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 1.6fr; gap: clamp(40px, 6vw, 96px); }
.problems-head { position: sticky; top: 120px; align-self: start; }
.problems-list { list-style: none; margin: 0; padding: 0; }
.problem {
  display: flex; gap: 24px; align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: clamp(18px, 2.2vw, 23px);
  font-weight: 500;
  color: var(--purple-900);
  line-height: 1.35;
}
.problem:first-child { border-top: 1px solid var(--line); }
.problem-n {
  font-family: var(--font-body); font-size: 13px; font-weight: 800;
  color: var(--gold-700); letter-spacing: .05em; flex: 0 0 auto;
}
.problems-diagnosis { margin-top: 48px; padding-left: 24px; position: relative; }
.diag-rule { position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--gold); }
.problems-diagnosis p { color: var(--slate); font-size: 17px; }
.diag-sig { font-size: 14px; color: var(--purple); font-weight: 600; }

/* grid collapse */
@media (max-width: 900px) {
  .problems-grid { grid-template-columns: 1fr; }
  .problems-head { position: static; }
}

/* ---------- capabilities ---------- */
.capabilities {
  padding: clamp(90px, 12vw, 160px) 0;
  background: linear-gradient(180deg, var(--wash) 0%, var(--surface) 100%);
  border-top: 1px solid var(--line);
}
.cap-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 24px; margin-top: 56px;
}
.cap-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .35s;
}
.cap-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--gold));
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .45s var(--ease-out);
}
.cap-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--purple-200); }
.cap-card:hover::before { transform: scaleX(1); }
.cap-n {
  font-size: 13px; font-weight: 800; color: var(--gold-700);
  letter-spacing: .08em; display: block; margin-bottom: 18px;
}
.cap-card h3 { margin-bottom: 12px; }
.cap-card > p { color: var(--slate); font-size: 15.5px; }
.cap-proof {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px dashed var(--line);
}
.cap-proof p { font-size: 14px; color: var(--purple-800); margin: 10px 0 0; }

.proof-tag {
  display: inline-block; font-size: 10.5px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--teal); border: 1px solid currentColor;
  padding: 3px 8px; border-radius: 4px;
}
.proof-est { color: var(--mauve); }
.proof-qual { color: var(--indigo); }

@media (max-width: 900px) { .cap-grid { grid-template-columns: 1fr; } }

/* ---------- work ---------- */
.work { padding: clamp(90px, 12vw, 160px) 0; }
.work-intro { font-size: clamp(17px, 2vw, 19px); color: var(--slate); max-width: 62ch; }

.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 24px; margin: 64px 0;
}
.stat { border-top: 2px solid var(--purple-200); padding-top: 20px; }
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 700; color: var(--purple);
  display: block; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 13.5px; color: var(--slate); display: block; margin-top: 10px; line-height: 1.45; }
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.work-detail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin: 56px 0; }
.work-col p { font-size: 15px; color: var(--slate); }
.work-col.judgment {
  background: var(--purple-100);
  border-radius: 16px; padding: 28px;
}
.work-col.judgment p { color: var(--purple-800); }
@media (max-width: 900px) { .work-detail { grid-template-columns: 1fr; } }

.testimonial {
  margin: 72px auto; max-width: 780px;
  text-align: center; position: relative;
  padding: 48px 24px 0;
}
.testimonial-burst { width: 76px; height: 76px; margin: 0 auto 28px; display: block; }
.testimonial blockquote {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(19px, 2.4vw, 25px); font-weight: 400;
  line-height: 1.5; color: var(--purple-900);
}
.testimonial figcaption { margin-top: 20px; font-size: 14px; font-weight: 700; color: var(--gold-700); letter-spacing: .04em; }

.more-work { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 72px; }
.mini-case {
  border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 32px; background: var(--white);
  transition: transform .35s var(--ease-out), box-shadow .35s;
}
.mini-case:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mini-kicker { font-size: 13px; font-weight: 700; color: var(--gold-700); text-transform: uppercase; letter-spacing: .08em; margin: -6px 0 14px; }
.mini-case p { font-size: 15px; color: var(--slate); }
.mini-proof { font-size: 14px !important; color: var(--purple-800) !important; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
@media (max-width: 800px) { .more-work { grid-template-columns: 1fr; } }

.pedigree {
  margin-top: 64px; padding: 32px 36px;
  background: var(--wash); border-radius: 16px;
  border: 1px solid var(--line);
}
.pedigree p { font-size: 15px; color: var(--slate); margin: 0; max-width: 90ch; }
.pedigree strong { color: var(--purple-900); }

/* ---------- about ---------- */
.about {
  padding: clamp(90px, 12vw, 160px) 0;
  background: var(--purple-900);
  color: var(--purple-100);
}
.about-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 1.7fr; gap: clamp(40px, 6vw, 96px); }
.about .eyebrow { color: var(--gold); }
.about h2 { color: var(--white); }
.about-body p { color: var(--purple-200); font-size: 16.5px; max-width: 58ch; }
.about-body em { color: var(--gold-300); font-style: italic; }
.about-creds {
  list-style: none; margin: 40px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.about-creds li {
  font-size: 13px; font-weight: 600;
  color: var(--gold-200);
  border: 1px solid rgba(198, 154, 88, .35);
  padding: 8px 14px; border-radius: 100px;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact {
  padding: clamp(110px, 15vw, 200px) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.contact-inner { position: relative; z-index: 1; }
.contact-burst {
  width: clamp(80px, 10vw, 120px); height: auto;
  margin: 0 auto 32px; display: block;
}
.contact h2 { margin: 0 auto 20px; max-width: 22ch; }
.contact p { margin-left: auto; margin-right: auto; color: var(--slate); max-width: 54ch; }
.contact .btn { margin-top: 16px; }
.contact-quiet { font-size: 14px !important; margin-top: 40px !important; color: var(--slate); opacity: .85; }

/* ---------- footer ---------- */
.footer {
  background: var(--ink);
  padding: 64px 0;
  color: var(--purple-200);
}
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-logo { height: 28px; width: auto; margin-bottom: 18px; }
.footer-line { font-size: 14px; max-width: 44ch; color: var(--purple-300); }
.footer-meta { font-size: 13.5px; text-align: right; }
.footer-meta p { margin: 0 0 8px; max-width: none; }
.footer-meta a { color: var(--gold-300); }
.footer-meta a:hover { color: var(--gold); }
.footer-credit { color: var(--purple-300); opacity: .8; }
@media (max-width: 700px) { .footer-meta { text-align: left; } }

/* ---------- mobile nav ---------- */
@media (max-width: 800px) {
  .nav-links {
    position: fixed; inset: 0; z-index: -1;
    background: var(--surface);
    flex-direction: column; justify-content: center;
    gap: 28px; font-size: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity .3s;
  }
  .nav.open .nav-links { opacity: 1; pointer-events: auto; z-index: 99; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 5px;
    background: none; border: none; padding: 8px; cursor: pointer;
    z-index: 101;
  }
  .nav-toggle span { width: 22px; height: 2px; background: var(--purple-900); transition: transform .3s, opacity .3s; }
  .nav.open .nav-toggle span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .nav.open .nav-toggle span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-title .line span { transform: none; animation: none; }
  .gold-em::after { transform: scaleX(1); animation: none; }
  .thesis-quote .word { opacity: 1; }
}
