/* ============================================================
   Vivatus Longevity — marketing site
   Palette + type documented in DESIGN.md (contrast-verified).
   ============================================================ */

:root {
  --pine: #16324F;
  --pine-deep: #0E2238;
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --ink: #2B3D4E;
  --muted: #51626F;
  --soft: #C7D4E0;
  --coral: #C24A30;
  --coral-hover: #B0402A;
  --coral-lt: #F08D72;
  --coral-text: #B8452C;
  --line: #DFD9CE;
  --line-dark: rgba(255, 255, 255, .16);

  --serif: "STIX Two Text", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --fs-h1: clamp(2.5rem, 5vw + 1rem, 4.35rem);
  --fs-h2: clamp(1.85rem, 2.6vw + .9rem, 2.8rem);
  --fs-h3: clamp(1.3rem, .9vw + 1.05rem, 1.6rem);

  --container: 72rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --section: clamp(4.5rem, 9vw, 7.5rem);
  --radius: 10px;

  --ease-out: cubic-bezier(.25, 1, .5, 1);

  /* z-scale */
  --z-nav: 50;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
img { display: block; max-width: 100%; height: auto; }
input, button { font: inherit; }

body {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--pine);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); font-weight: 500; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
p { text-wrap: pretty; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--pine); color: #fff;
  padding: .55em 1em; border-radius: 0 0 8px 8px;
  z-index: 100; transition: top .18s var(--ease-out);
}
.skip-link:focus { top: 0; }

a { color: var(--coral-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--coral-lt); outline-offset: 2px; border-radius: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .62em 1.25em;
  transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out),
              color .2s var(--ease-out), transform .2s var(--ease-out);
  cursor: pointer;
}
.btn-lg { padding: .8em 1.6em; font-size: 1rem; }
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { background: var(--coral-hover); transform: translateY(-1px); }
.btn-ghost { border-color: rgba(255, 255, 255, .4); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .65); }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: var(--pine);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.head-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 4.25rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .7rem;
  color: #fff; text-decoration: none;
}
.brand-mark { flex: none; }
.brand-name { font-weight: 600; letter-spacing: .01em; white-space: nowrap; }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.2vw, 1.9rem); }
.site-nav > a {
  color: var(--soft); text-decoration: none; font-size: .95rem; font-weight: 500;
  transition: color .2s var(--ease-out);
}
.site-nav > a:hover { color: #fff; }
.nav-signin { position: relative; }
.site-nav .nav-cta { color: #fff; }

.nav-toggle {
  display: none;
  background: none; border: 0; padding: .6rem; cursor: pointer;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block; content: ""; width: 22px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: transform .25s var(--ease-out), opacity .2s var(--ease-out);
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before { position: absolute; top: -7px; }
.nav-toggle-bars::after { position: absolute; top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: rotate(-90deg) translateX(-7px); top: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { opacity: 0; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start;
    gap: 0;
    background: var(--pine-deep);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    padding: .5rem var(--gutter) 1.25rem;
    display: none;
  }
  .site-nav.open { display: flex; }
  .site-nav > a { padding: .7rem 0; font-size: 1.05rem; width: 100%; }
  .site-nav .nav-cta { margin-top: .75rem; width: auto; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--pine) 0%, var(--pine-deep) 100%);
  padding-top: clamp(4rem, 9vw, 7rem);
  padding-bottom: 0;
  --overlap: clamp(3rem, 8vw, 5.5rem);
}
.hero-bg {
  position: absolute; inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-dial {
  position: absolute;
  top: -12rem; right: -14rem;
  width: clamp(30rem, 55vw, 56rem); height: auto;
}
.hero-copy { position: relative; max-width: 54rem; }
.hero h1 { color: #fff; max-width: 21ch; }
.hero-sub {
  color: var(--soft);
  font-size: clamp(1.1rem, 1vw + .95rem, 1.3rem);
  line-height: 1.7;
  max-width: 46rem;
  margin-top: 1.4rem;
}
.cta-row { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.2rem; }
.hero-note {
  margin-top: 1.5rem;
  font-size: .85rem;
  color: #8FA5B8;
}
.hero-shot {
  position: relative;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  transform: translateY(var(--overlap, 5rem));
}

/* entrance (CSS-only; ends visible, safe without JS) */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > *, .hero-shot { animation: rise .9s var(--ease-out) both; }
  .hero-sub { animation-delay: .08s; }
  .cta-row { animation-delay: .16s; }
  .hero-note { animation-delay: .22s; }
  .hero-shot { animation-delay: .28s; animation-duration: 1.1s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .hero-shot { animation-name: rise-shot; }
  @keyframes rise-shot {
    from { opacity: 0; transform: translateY(calc(var(--overlap, 5rem) + 24px)); }
    to { opacity: 1; transform: translateY(var(--overlap, 5rem)); }
  }
}

/* ---------- framed screenshots ---------- */
.frame {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 70px -28px rgba(14, 34, 56, .5);
}
.frame img { width: 100%; }
.frame-bar {
  display: flex; gap: 6px; align-items: center;
  padding: 10px 14px;
}
.frame-bar i { width: 9px; height: 9px; border-radius: 50%; }
.frame-dark { background: #101D2C; border: 1px solid rgba(255, 255, 255, .12); }
.frame-dark .frame-bar i { background: rgba(255, 255, 255, .22); }
.frame-light { background: var(--surface); border: 1px solid var(--line); }
.frame-light .frame-bar { border-bottom: 1px solid #EFEBE2; }
.frame-light .frame-bar i { background: #D8D2C6; }
.frame-inset { box-shadow: 0 18px 44px -22px rgba(14, 34, 56, .35); }

/* ---------- section furniture ---------- */
.tickrule {
  position: relative;
  height: 1px; background: var(--line);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.tickrule::before {
  content: ""; position: absolute; left: 0; top: -1px;
  width: 36px; height: 3px; background: var(--coral);
}
.tickrule-dark { background: var(--line-dark); }
.tickrule-dark::before { background: var(--coral-lt); }

.section-lead {
  color: var(--muted);
  max-width: 44rem;
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* ---------- program ---------- */
.program { padding-top: calc(var(--section) + clamp(3rem, 8vw, 5.5rem)); padding-bottom: var(--section); }

.program-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.program-item-wide { grid-row: span 2; }
.program-item h3 { margin-bottom: .6rem; }
.program-item p { color: var(--ink); max-width: 34rem; }
.program-item { padding-top: 1.4rem; border-top: 1px solid var(--line); }
.program-item-wide .frame { margin-top: 1.75rem; }

@media (max-width: 780px) {
  .program-grid { grid-template-columns: 1fr; }
  .program-item-wide { grid-row: auto; }
}

/* ---------- tour ---------- */
.tour { padding-block: var(--section); background: var(--surface); border-block: 1px solid var(--line); }
.tour-list { display: grid; gap: clamp(4rem, 8vw, 6.5rem); margin-top: clamp(3rem, 6vw, 4.5rem); }

.tour-block {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.tour-flip .tour-media { order: 2; }
.tour-flip .tour-copy { order: 1; }
.tour-copy h3 { margin-bottom: .8rem; }
.tour-copy p + p { margin-top: .8rem; }
.fine { color: var(--muted); font-size: .93rem; }

.readout { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.readout > div {
  display: flex; justify-content: space-between; gap: 1.5rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
.readout dt {
  color: var(--muted);
  font-weight: 600; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .07em;
  padding-top: .2em;
  flex: none;
}
.readout dd { color: var(--ink); text-align: right; }

@media (max-width: 860px) {
  .tour-block { grid-template-columns: 1fr; gap: 1.75rem; }
  .tour-flip .tour-media { order: 0; }
  .tour-flip .tour-copy { order: 0; }
  .readout dd { text-align: left; }
  .readout > div { flex-direction: column; gap: .1rem; }
}

/* mock cards (program builder, portal) */
.mock {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  max-width: 30rem;
  box-shadow: 0 22px 50px -26px rgba(14, 34, 56, .3);
}
.mock-head {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--pine);
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding-bottom: .9rem; border-bottom: 1px solid var(--line);
}
.mock-head span { font-family: var(--sans); font-size: .8rem; font-weight: 500; color: var(--muted); }
.mock-rows { list-style: none; padding: 0; }
.mock-rows li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
  font-size: .95rem;
}
.mock-rows b { font-weight: 600; color: var(--pine); white-space: nowrap; }
.mock-rows b.ok { color: #1F6B3A; }
.mock-rows b.no { color: var(--coral-text); }
.mock-total {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-top: .9rem; font-weight: 600; color: var(--pine);
}
.mock-total b { font-family: var(--serif); font-size: 1.35rem; }
.mock-note { margin-top: .8rem; font-size: .8rem; color: var(--muted); }

/* ---------- security ---------- */
.security {
  background: linear-gradient(180deg, var(--pine) 0%, var(--pine-deep) 100%);
  padding-block: var(--section);
}
.security h2 { color: #fff; }
.security .section-lead { color: var(--soft); line-height: 1.72; }

.sec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  column-gap: clamp(2rem, 5vw, 4rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.sec-item { padding: 1.4rem 0 1.5rem; border-top: 1px solid var(--line-dark); }
.sec-item dt {
  font-family: var(--serif); font-weight: 600; font-size: 1.18rem;
  color: #fff; margin-bottom: .45rem;
}
.sec-item dd { color: var(--soft); font-size: .97rem; line-height: 1.7; }

.sec-gate {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  color: #fff;
  font-size: 1.05rem;
  max-width: 56rem;
  display: flex; gap: 1rem; align-items: baseline;
}
.gate-tick { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--coral-lt); transform: translateY(1px); }

/* ---------- onboarding ---------- */
.onboarding { padding-block: var(--section); }
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.steps li { counter-increment: step; padding-top: 1.3rem; border-top: 1px solid var(--line); position: relative; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--serif);
  font-size: 2.2rem;
  color: var(--coral-text);
  display: block;
  line-height: 1;
  margin-bottom: .7rem;
}
.steps h3 { font-size: 1.25rem; margin-bottom: .45rem; }
.steps p { font-size: .96rem; color: var(--muted); }

/* ---------- contact ---------- */
.contact { padding-block: var(--section); background: var(--surface); border-top: 1px solid var(--line); }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
.contact-copy p { margin-top: 1rem; max-width: 34rem; }
.contact-copy h2 { margin-bottom: .25rem; }
.contact-direct { color: var(--muted); }

.demo-form {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
}
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: var(--pine); }
.field input {
  width: 100%;
  border: 1px solid #CBC4B6;
  border-radius: 7px;
  background: var(--surface);
  padding: .65em .85em;
  color: var(--ink);
  transition: border-color .2s var(--ease-out);
}
.field input:focus { border-color: var(--pine); outline: 2px solid transparent; }
.field input:focus-visible { outline: 2px solid var(--coral-lt); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.demo-form .btn { width: 100%; margin-top: .4rem; }
.form-note { margin-top: .85rem; font-size: .84rem; color: var(--muted); text-align: center; }

@media (max-width: 780px) {
  .contact-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- footer ---------- */
.site-foot {
  background: var(--pine-deep);
  color: var(--soft);
  padding-block: 2.75rem 2.25rem;
}
.foot-row {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  align-items: center; justify-content: space-between;
}
.foot-brand { display: flex; align-items: center; gap: .8rem; }
.foot-brand p { font-size: .92rem; }
.foot-nav { display: flex; gap: 1.75rem; }
.foot-nav a { color: var(--soft); text-decoration: none; font-size: .92rem; }
.foot-nav a:hover { color: #fff; text-decoration: underline; }
.foot-note {
  margin-top: 1.75rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line-dark);
  font-size: .84rem; color: #8FA5B8;
}

/* ---------- scroll reveals (enhance-only; .js gate set inline in <head>) ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s var(--ease-out), transform .8s var(--ease-out);
}
html.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .site-nav > a { transition: none; }
}

/* ---------- privacy page ---------- */
.prose { padding-block: var(--section); max-width: 46rem; }
.prose h1 { font-size: var(--fs-h2); margin-bottom: 1.5rem; }
.prose h2 { font-size: 1.35rem; margin: 2.2rem 0 .6rem; }
.prose p { margin-bottom: 1rem; }
.prose .fine { margin-top: 2.5rem; }
