/* Pivrelo v1. Tokens from business/brand-guide.md. Plan in DESIGN.md. */

:root {
  --paper: #FFFFFF;
  --ink: #0A1433;
  --cobalt: #1D4ED8;
  --cobalt-hover: #1E40AF;
  --coral: #FF6B5A;
  --mist: #E8EEFF;
  --surface: #F6F7FB;
  --border: #DCE1EE;
  --slate: #4A5372;
  --night: #070D22;
  --night-surface: #0F1830;
  --night-border: #1E2A4A;
  --night-text: #F2F5FF;
  --night-slate: #A3AECF;
  --link: var(--cobalt);
  --ring: var(--cobalt);

  --font: "Geist", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --wrap: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --space: clamp(4.5rem, 10vw, 8.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #070D22;
    --ink: #F2F5FF;
    --mist: #0F1830;
    --surface: #0F1830;
    --border: #1E2A4A;
    --slate: #A3AECF;
    --link: #6B8CFF;
    --night: #0F1830;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; text-wrap: balance; }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); letter-spacing: -0.03em; }
h3 { font-size: 1.25rem; letter-spacing: -0.015em; }
p { text-wrap: pretty; }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--paper); padding: .5rem 1rem; border-radius: 8px; }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 3px; border-radius: 6px; }

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 1.0625rem/1 var(--font);
  text-decoration: none;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  transition: background-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn-sm { padding: .7rem 1.1rem; font-size: .975rem; border-radius: 8px; }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-hover); }
.btn-light { background: #fff; color: var(--cobalt); }
.btn-light:hover { background: #E8EEFF; }
.link { color: var(--link); font-weight: 500; text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1.5px; }
.link:hover { text-decoration-thickness: 2.5px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.header-row { display: flex; align-items: center; gap: 2rem; height: 72px; }
.brand img { height: 30px; width: auto; }
.nav { display: flex; gap: 1.75rem; margin-left: auto; font-size: .975rem; font-weight: 500; }
.nav a { text-decoration: none; color: var(--slate); }
.nav a:hover { color: var(--ink); }

/* Hero */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 6rem) 0 clamp(4rem, 9vw, 7.5rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 3rem; align-items: center; }
.hero-copy { position: relative; z-index: 2; }
.hero h1 {
  font-size: clamp(3.25rem, 7.6vw, 6.5rem);
  line-height: .98;
  letter-spacing: -0.045em;
  max-width: 12ch;
  text-wrap: wrap;
}
.nowrap { white-space: nowrap; }
.lede { margin-top: 1.75rem; font-size: clamp(1.125rem, 1.6vw, 1.3rem); color: var(--slate); max-width: 34ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; margin-top: 2.25rem; }
.fine { margin-top: 1rem; font-size: .925rem; color: var(--slate); }

.hero-art { position: relative; min-height: 520px; display: flex; align-items: center; }
.ring {
  position: absolute;
  width: 640px; height: 640px;
  right: -240px; top: 50%;
  transform: translateY(-50%);
  color: var(--ring);
}
.pivot {
  position: absolute; right: calc(-240px + 320px - 36px); top: calc(50% - 36px);
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--coral);
}

/* Relay panel: the one memorable element */
.relay {
  position: relative; z-index: 1;
  width: min(100%, 400px);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.1rem;
}
.relay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .95rem; font-weight: 600; padding: 0 .25rem .9rem; border-bottom: 1px solid var(--border); }
.relay-count { display: inline-flex; align-items: center; gap: .45rem; font-weight: 500; color: var(--slate); font-size: .875rem; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); flex: none; }
.relay-list li {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: .8rem;
  padding: .8rem .25rem;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}
.relay-list li:last-child { border-bottom: 0; }
.mark {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--coral); background: var(--coral);
}
.relay-list time { font-family: var(--mono); font-size: .825rem; color: var(--slate); }
.relay-foot { margin-top: .4rem; padding: .7rem .25rem 0; border-top: 1px solid var(--border); font-size: .925rem; color: var(--slate); }

/* The orchestrated moment: each task hands off in turn on load */
@media (prefers-reduced-motion: no-preference) {
  .relay-list li .mark { animation: handoff .35s ease-out both; animation-delay: calc(.7s + var(--i) * .55s); }
  .relay-list li .task { animation: settle .35s ease-out both; animation-delay: calc(.7s + var(--i) * .55s); }
  .relay-list li time { animation: appear .3s ease-out both; animation-delay: calc(.8s + var(--i) * .55s); }
  .relay-count { animation: appear .4s ease-out both; animation-delay: 3.6s; }
  .pivot { animation: pivot .9s cubic-bezier(.2,.8,.2,1) both; animation-delay: .2s; }
}
@keyframes handoff {
  from { background: transparent; border-color: var(--border); transform: scale(.8); }
  60% { transform: scale(1.25); }
  to { background: var(--coral); border-color: var(--coral); transform: scale(1); }
}
@keyframes settle { from { color: var(--slate); } to { color: var(--ink); } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes pivot { from { transform: scale(0); } to { transform: scale(1); } }

/* Sections */
.section { padding: var(--space) 0; }
.section-tint { background: var(--surface); }
.section-head { max-width: 40rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head p { margin-top: 1rem; color: var(--slate); font-size: 1.2rem; }

/* What we build: scope rows */
.scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 6vw, 5rem); }
.scope li {
  display: grid; grid-template-columns: 64px 1fr; column-gap: 1.25rem; row-gap: .4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.scope .glyph { grid-row: span 2; width: 56px; height: 56px; color: var(--cobalt); }
.scope .glyph .dot { fill: var(--coral); }
.scope p { color: var(--slate); max-width: 38ch; }

/* Examples: ledger */
.ledger { border-top: 1px solid var(--border); }
.ledger-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 2rem; padding: 1.15rem 0; border-bottom: 1px solid var(--border); }
.ledger-labels { font-size: .95rem; font-weight: 600; color: var(--slate); padding: .9rem 0; }
.ledger .before { color: var(--slate); }
.ledger .after { position: relative; padding-left: 1.4rem; font-weight: 500; }
.ledger .after::before { content: ""; position: absolute; left: 0; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }

.sub-head { margin: clamp(4rem, 8vw, 6rem) 0 1.5rem; font-size: 1.5rem; }
.samples { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1rem; }
.sample {
  display: flex; flex-direction: column; gap: .6rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
}
.sample h4 { font-size: 1.3rem; }
.sample > p:not(.tag) { color: var(--slate); font-size: 1rem; }
.tag {
  align-self: flex-start;
  font-size: .8rem; font-weight: 500;
  color: var(--cobalt);
  background: var(--mist);
  padding: .2rem .6rem; border-radius: 999px;
}
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 0; margin-top: auto; padding-top: 1.25rem; }
.flow li {
  position: relative;
  font-size: .85rem; font-weight: 500;
  padding: .4rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.flow li + li { margin-left: 1.6rem; }
.flow li + li::before {
  content: ""; position: absolute; right: 100%; top: 50%;
  width: 1.6rem; height: 2px; background: var(--cobalt);
}
.flow li.hand { border-color: var(--cobalt); background: var(--mist); color: var(--cobalt); }
.flow li.hand::after {
  content: ""; position: absolute; left: -1.05rem; top: 50%;
  width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--coral);
}
.note { margin-top: 1.25rem; font-size: .925rem; color: var(--slate); }

/* How it works: the track */
.track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; position: relative; }
.track::before {
  content: ""; position: absolute; left: 22px; right: 12%; top: 22px;
  height: 2px; background: var(--border);
}
.track li { position: relative; }
.stop {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--cobalt); color: var(--cobalt);
  font-weight: 600; font-size: 1rem;
  margin-bottom: 1.5rem;
}
.track .last .stop { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.track h3 { margin-bottom: .5rem; }
.track p { color: var(--slate); font-size: 1.025rem; max-width: 28ch; }

/* Pricing: the one dark band */
.section-night { background: var(--night); color: var(--night-text); }
.section-night .section-head p, .section-night .option p { color: var(--night-slate); }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 6vw, 5rem); }
.option { border-top: 3px solid var(--cobalt); padding-top: 1.5rem; }
.option:last-child { border-top-color: #6B8CFF; }
.option h3 { font-size: 1.5rem; margin-bottom: .75rem; }
.option p { max-width: 40ch; }
.founding {
  display: flex; gap: 1rem; align-items: baseline;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--night-border);
  border-radius: 12px;
  max-width: 48rem;
}
.founding .live { transform: translateY(-1px); }
.founding p { color: var(--night-slate); }
.founding strong { color: var(--night-text); font-weight: 600; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 3rem; }
.about-body { display: grid; gap: 1.25rem; }
.about-body p { color: var(--slate); max-width: 52ch; }
.about-body .big { color: var(--ink); font-size: clamp(1.4rem, 2.4vw, 1.85rem); line-height: 1.35; letter-spacing: -0.015em; font-weight: 500; }
.place { font-size: 1rem; }

/* Final CTA */
.cta { background: var(--cobalt); color: #fff; padding: clamp(4.5rem, 9vw, 7rem) 0; position: relative; overflow: hidden; }
.cta::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -150px; bottom: -220px;
  border: 64px solid rgba(255,255,255,.12); border-radius: 50%;
}
.cta-inner { position: relative; z-index: 1; }
.cta h2 { max-width: 18ch; font-size: clamp(2.25rem, 5vw, 4rem); }
.cta p { margin: 1.25rem 0 2.25rem; font-size: 1.2rem; color: #DCE6FF; max-width: 40ch; }

/* Footer */
.site-footer { padding: 2.5rem 0 3rem; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.footer-row img { height: 26px; width: auto; }
.tagline { color: var(--slate); font-size: .95rem; }
.meta { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-size: .925rem; color: var(--slate); }
.meta a { color: var(--link); text-decoration: none; }
.meta a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 960px) {
  .nav { display: none; }
  .header-row .btn { margin-left: auto; }
  .hero-grid { grid-template-columns: 1fr; gap: 3.5rem; }
  .hero-art { min-height: 0; padding: 2rem 0; }
  .ring { width: 520px; height: 520px; right: -260px; }
  .pivot { right: 10px; top: auto; bottom: -10px; width: 52px; height: 52px; }
  .samples { grid-template-columns: 1fr 1fr; }
  .sample-wide { grid-column: 1 / -1; }
  .track { grid-template-columns: 1fr 1fr; row-gap: 3rem; }
  .track::before { display: none; }
  .about { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .brand img { height: 26px; }
  .btn-sm { padding: .6rem .9rem; font-size: .925rem; }
  .scope, .options, .samples { grid-template-columns: 1fr; }
  .ledger-row { grid-template-columns: 1fr; gap: .35rem; }
  .ledger-labels { display: none; }
  .ledger .before::before { content: "Before: "; font-weight: 600; }
  .track { grid-template-columns: 1fr; row-gap: 2.25rem; }
  .track li { display: grid; grid-template-columns: 46px 1fr; column-gap: 1.25rem; }
  .track .stop { grid-row: span 2; margin-bottom: 0; }
  .relay-list li { font-size: .95rem; }
  .meta { margin-left: 0; }
}

/* Pass 2 fixes (screenshot critique) */
.scope li { align-items: start; }
.scope .glyph { width: 44px; height: 44px; align-self: start; grid-row: 1 / span 2; }
.samples { grid-template-columns: 1fr 1fr; }
.sample-wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 3rem; align-items: center; }
.sample-wide .tag, .sample-wide h4, .sample-wide > p:not(.tag) { grid-column: 1; }
.sample-wide .flow { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; padding-top: 0; flex-wrap: nowrap; }
@media (max-width: 960px) {
  .sample-wide { display: flex; }
  .sample-wide .flow { flex-wrap: wrap; margin-top: auto; padding-top: 1.25rem; }
}
.scope li { align-content: start; }
.sample-wide .tag { justify-self: start; }

/* Pass 3: tablet + phone (after the pass 2 rules so these win) */
@media (max-width: 960px) {
  .hero-art { padding: 0 0 110px; }
  .ring { width: 360px; height: 360px; right: -120px; top: auto; bottom: -120px; transform: none; }
  .pivot { width: 48px; height: 48px; right: 36px; bottom: 36px; top: auto; }
  .sample-wide { display: flex; flex-direction: column; }
  .flow { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; }
  .sample-wide .flow { flex-wrap: nowrap; }
  .flow li + li { margin-left: 0; margin-top: 1rem; }
  .flow li + li::before { right: auto; top: auto; left: 1rem; bottom: 100%; width: 2px; height: 1rem; }
  .flow li.hand::after { left: calc(1rem - 3px); top: -.55rem; margin-top: -4px; }
}
@media (max-width: 640px) {
  .samples { grid-template-columns: 1fr; }
}
@media (max-width: 960px) { .sample-wide { align-items: stretch; } .sample-wide .tag { align-self: flex-start; } }
@media (min-width: 641px) and (max-width: 960px) {
  .sample-wide .flow { flex-direction: row; align-items: center; }
  .sample-wide .flow li + li { margin-top: 0; margin-left: 1.6rem; }
  .sample-wide .flow li + li::before { left: auto; bottom: auto; right: 100%; top: 50%; width: 1.6rem; height: 2px; }
  .sample-wide .flow li.hand::after { left: -1.05rem; top: 50%; }
}
