/* ==========================================================================
   CampaignOS landing page — styles.css
   Plain CSS with custom properties. Mobile-first.
   Breakpoints: 480px, 768px, 1024px (spec section 5).
   The header and hero rules are also inlined in index.html as critical CSS;
   this file loads after it, so edits made here always win.
   ========================================================================== */

/* ---------- 1. Tokens (spec section 4) ---------- */
:root {
  --ink: #000000;          /* Body text, dark sections */
  --paper: #FFFFFF;        /* Page background */
  --maroon: #87033C;       /* Taken from the logo file. Buttons, links, accents only */
  --maroon-dark: #770335;  /* Logo maroon, 12% darker. Button hover/active */
  --grey-900: #1A1A1A;     /* Dark section backgrounds */
  --grey-600: #5E5E5E;     /* Secondary text */
  --grey-200: #E6E6E6;     /* Borders, rules */
  --grey-50: #F6F6F6;      /* Tinted section backgrounds */
  --error: #B3261E;        /* Form errors only (6.5:1 on white) */

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* 8px spacing scale */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 40px; --s6: 48px; --s8: 64px; --s12: 96px;

  --gutter: 20px;
  --section: 64px;
  --radius: 8px;
  --header-h: 64px;
}
@media (min-width: 768px)  { :root { --gutter: 40px; } }
@media (min-width: 1024px) { :root { --section: 96px; } }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 768px) { body { font-size: 18px; } }

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 18px; font-weight: 600; }
@media (min-width: 768px)  { h1 { font-size: 44px; } h2 { font-size: 30px; } h3 { font-size: 20px; } }
@media (min-width: 1024px) { h1 { font-size: 56px; } h2 { font-size: 36px; } h3 { font-size: 22px; } }

p { margin: 0; max-width: 68ch; }
.small { font-size: 14px; }

a { color: var(--maroon); text-underline-offset: 3px; }
a:hover { color: var(--maroon-dark); }

/* Visible focus everywhere: 2px maroon, 2px offset (spec 16) */
:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; }
/* On dark backgrounds a white halo keeps the maroon ring visible */
.on-dark :focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; box-shadow: 0 0 0 2px var(--paper); }

/* Anchor targets clear the sticky header */
[id] { scroll-margin-top: calc(var(--header-h) + var(--s2)); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--s2); top: -100px; z-index: 100;
  background: var(--ink); color: var(--paper); padding: var(--s1) var(--s2); border-radius: var(--radius);
}
.skip-link:focus { top: var(--s1); color: var(--paper); }

/* ---------- 3. Layout ---------- */
.container {
  width: 100%;
  max-width: calc(1120px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section); }
.section--tint { background: var(--grey-50); }
.section--dark { background: var(--grey-900); color: var(--paper); }
.section-head { display: grid; gap: var(--s2); margin-bottom: var(--s5); max-width: 68ch; }
.section-head p { color: var(--grey-600); }
.section--dark .section-head p { color: #C9C9C9; }

/* ---------- 4. Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 48px; padding: 12px 24px;
  font: 600 17px/1.2 var(--font);
  border-radius: var(--radius); border: 2px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s ease;
}
.btn-primary { background: var(--maroon); color: var(--paper); }
.btn-primary:hover, .btn-primary:active { background: var(--maroon-dark); color: var(--paper); }
.btn-primary[disabled] { cursor: progress; background: var(--maroon-dark); }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn-outline { background: var(--paper); color: var(--ink); border-color: var(--grey-200); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }

.text-link {
  display: inline-flex; align-items: center; gap: var(--s1);
  min-height: 44px; padding: 0;
  background: none; border: 0; cursor: pointer;
  font: 600 17px/1.2 var(--font); color: var(--maroon);
  text-decoration: underline; text-underline-offset: 4px;
}
.text-link:hover { color: var(--maroon-dark); }

/* Launch mode switch (spec 19): body.mode-live flips these */
.only-live { display: none !important; }
body.mode-live .only-live { display: revert !important; }
body.mode-live .only-waitlist { display: none !important; }
body.mode-live .btn.only-live { display: inline-flex !important; }

/* ---------- 5. Header (spec 6.1) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--grey-200);
}
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: 164px; height: 28px; }
.site-header .btn { white-space: nowrap; }
@media (max-width: 374px) {
  .site-header .container { gap: var(--s1); }
  .brand img { width: 128px; height: 22px; }
  .site-header .btn-small { padding: 8px 12px; font-size: 14px; }
}
@media (min-width: 480px) { .brand img { width: 187px; height: 32px; } }

/* ---------- 6. Hero (spec 6.2) ---------- */
.hero { padding-block: var(--s6) var(--section); }
.hero .container { display: grid; gap: var(--s5); align-items: center; }
.hero-copy { display: grid; gap: var(--s3); min-width: 0; }
.hero-sub { font-size: 18px; color: var(--grey-600); max-width: 38ch; }
@media (min-width: 768px) { .hero-sub { font-size: 20px; } }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.hero-note { font-size: 14px; color: var(--grey-600); }
.hero-media { min-width: 0; margin: 0; }
.play-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hero-media img { width: 100%; border-radius: 12px; border: 1px solid var(--grey-200); }
.hero-media figcaption { margin-top: var(--s1); font-size: 14px; color: var(--grey-600); }
@media (min-width: 1024px) {
  .hero { padding-top: var(--s8); }
  .hero .container { grid-template-columns: 1fr 1.05fr; gap: var(--s8); }
}

/* ---------- 7. Problem cards (spec 6.3) ---------- */
.cards { display: grid; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .cards { grid-template-columns: repeat(3, 1fr); gap: var(--s3); } }
.card {
  display: grid; gap: var(--s1); align-content: start;
  padding: var(--s3); background: var(--paper);
  border: 1px solid var(--grey-200); border-radius: var(--radius);
}
.card p { color: var(--grey-600); }

/* ---------- 8. Features (spec 6.4) ---------- */
/* Shared icon tile for feature and view cards */
.card-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; }
.card-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.features { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.feature {
  display: flex; gap: var(--s2); align-items: flex-start;
  padding: 20px; background: var(--paper);
  border: 1px solid var(--grey-200); border-radius: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.feature:hover { border-color: #CFCFCF; box-shadow: 0 6px 20px -12px rgba(0, 0, 0, .25); }
.feature .card-icon { background: var(--maroon); color: var(--paper); }
.feature-body { display: grid; gap: 4px; min-width: 0; }
.feature-body h3 { font-size: 18px; }
.feature-body p { color: var(--grey-600); font-size: 16px; }
@media (min-width: 768px) {
  .features { grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
  .feature { grid-column: span 3; padding: var(--s3); }
  .feature:last-child { grid-column: 2 / span 4; }
}
@media (min-width: 1024px) {
  .feature { grid-column: span 2; flex-direction: column; gap: var(--s2); }
  .feature:nth-child(4) { grid-column: 2 / span 2; }
  .feature:last-child { grid-column: 4 / span 2; }
}

/* ---------- 9. Numbers you can trust (spec 6.5) ---------- */
.truth { display: grid; gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.truth li {
  display: grid; gap: var(--s2); align-content: start;
  padding: var(--s3); border: 1px solid #333333; border-radius: var(--radius);
}
/* Desktop: the title, "most dashboards" and "CampaignOS" rows line up across all three cards */
@media (min-width: 768px) {
  .truth { grid-template-columns: repeat(3, 1fr); grid-template-rows: auto auto auto; column-gap: var(--s3); row-gap: var(--s2); }
  .truth li { grid-row: span 3; grid-template-rows: subgrid; }
}
.truth h3 { color: var(--paper); }
.truth-row { display: grid; gap: 4px; align-content: start; padding: var(--s2); border-radius: var(--radius); }
.truth-row--was { background: #232323; }
.truth-row--now { background: var(--ink); border: 1px solid #4A4A4A; }
.truth-label { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #A3A3A3; }
.truth-row--now .truth-label { color: #E0648F; } /* maroon tint readable on black (brand rule) */
.truth-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.truth-row--was .truth-value { color: #BDBDBD; }
.truth-row--now .truth-value { color: var(--paper); }
.truth-note { font-size: 15px; color: #C9C9C9; }

/* ---------- 10. Views (spec 6.6) ---------- */
.views { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 560px)  { .views { grid-template-columns: repeat(2, 1fr); gap: var(--s2); } }
@media (min-width: 1024px) { .views { grid-template-columns: repeat(4, 1fr); } }
.view {
  display: flex; gap: var(--s2); align-items: center;
  padding: 20px; background: var(--paper);
  border: 1px solid var(--grey-200); border-radius: 12px;
}
.view .card-icon { background: #FBF3F6; color: var(--maroon); border: 1px solid #F1DCE5; }
.view-body { display: grid; gap: 2px; min-width: 0; }
.view-body h3 { font-size: 18px; }
.view-body p { color: var(--grey-600); font-size: 16px; line-height: 1.45; }
@media (min-width: 560px) {
  .view { flex-direction: column; align-items: flex-start; padding: var(--s3); }
  .view-body { gap: 6px; }
}

/* ---------- 11. Waitlist form (spec 7) ---------- */
.join-grid { display: grid; gap: var(--s5); }
@media (min-width: 1024px) { .join-grid { grid-template-columns: 1fr 1.4fr; gap: var(--s8); align-items: start; } }
.join-intro { display: grid; gap: var(--s2); }
.join-intro p { color: var(--grey-600); }

.panel {
  background: var(--paper); border: 1px solid var(--grey-200); border-radius: 12px;
  padding: var(--s3);
}
@media (min-width: 768px) { .panel { padding: var(--s5); } }

.form { display: grid; gap: var(--s3); }
.form-row { display: grid; gap: var(--s3); }
@media (min-width: 768px) { .form-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label, .field legend { font-weight: 600; font-size: 16px; }
.field .optional { font-weight: 400; color: var(--grey-600); }

/* Form fields never go below 16px (iOS zoom rule) */
.input, .select {
  width: 100%; min-height: 48px;
  font: 400 16px/1.4 var(--font); color: var(--ink);
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid #8A8A8A; border-radius: var(--radius);
}
.select { padding-right: 12px; }
.input::placeholder { color: #767676; }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; border-color: var(--ink); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--error); }

.hint { font-size: 14px; color: var(--grey-600); }
.error { font-size: 14px; color: var(--error); font-weight: 500; }

fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.checks { display: flex; flex-wrap: wrap; gap: var(--s1); }
.check {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 14px;
  border: 1px solid #8A8A8A; border-radius: var(--radius);
  font-size: 16px; font-weight: 400; cursor: pointer;
}
.check input, .consent input { width: 20px; height: 20px; margin: 0; font-size: 16px; accent-color: var(--maroon); flex: none; }
.check:has(input:checked) { border-color: var(--maroon); background: #FBF3F6; }
fieldset[aria-invalid="true"] .check { border-color: var(--error); }

.consent { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding-block: 10px; font-size: 16px; font-weight: 400; cursor: pointer; }
.consent input { margin-top: 2px; }
.field .check { font-weight: 400; }
.consent-row { display: grid; gap: 0; }
.consent-row .consent-links { font-size: 14px; padding-left: 32px; }
.consent-links a { display: inline-flex; align-items: center; min-height: 44px; }

.form-actions { display: grid; gap: var(--s2); justify-items: start; }
/* Fixed width so the label change does not move anything (spec 7.4) */
.btn-submit { width: 220px; }
@media (max-width: 479px) { .btn-submit { width: 100%; } }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: var(--paper);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-message {
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--grey-200); background: var(--grey-50);
  font-size: 16px;
}
.form-message.is-error { border-color: var(--error); background: #FCEEEE; }
.form-message a { color: var(--ink); }

/* ---------- 12. Referral band (spec 10.2) ---------- */
.band { display: grid; gap: var(--s3); }
.band h2:focus { outline: none; }
.band .lead { color: var(--grey-600); }
.copy-row { display: flex; flex-wrap: wrap; gap: var(--s1); }
.copy-row .input { flex: 1 1 240px; min-width: 0; background: var(--grey-50); }
.copy-row .btn { flex: none; width: 140px; }
.share { display: flex; flex-wrap: wrap; gap: var(--s1); }
.share .btn { flex: 1 1 auto; }
.progress-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.progress { height: 10px; border-radius: 99px; background: var(--grey-200); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--maroon); border-radius: 99px; transition: width .4s ease; }
.band-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---------- 13. FAQ (spec 6.9) ---------- */
.faq { display: grid; gap: var(--s1); max-width: 820px; }
.faq details { border: 1px solid var(--grey-200); border-radius: var(--radius); background: var(--paper); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s2);
  min-height: 56px; padding: 12px var(--s3);
  font-weight: 600; cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 10px; height: 10px;
  border-right: 2px solid var(--maroon); border-bottom: 2px solid var(--maroon);
  transform: rotate(45deg) translateY(-3px); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq details p { padding: 0 var(--s3) var(--s3); color: var(--grey-600); }

/* ---------- 14. Footer (spec 6.10) ---------- */
.site-footer { background: var(--ink); color: var(--paper); padding-block: var(--s6); }
.site-footer .container { display: grid; gap: var(--s3); }
.footer-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; }
.footer-brand img { width: 40px; height: 40px; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); list-style: none; margin: 0; padding: 0; }
.footer-links a { color: var(--paper); display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a:hover { color: #D9D9D9; }
.site-footer .small { color: #BDBDBD; }

/* Parent company name: set apart in a smaller serif (system fonts, no download) */
.org-mark { font-family: Georgia, "Times New Roman", Times, serif; font-size: 0.85em; font-weight: 400; letter-spacing: 0.06em; }
/* Footer links are flex boxes, which drop the space before the styled name; restore it */
.footer-links a .org-mark { margin-left: 0.3em; }

/* ---------- 15. Demo dialog (spec 12) ---------- */
.demo-dialog {
  width: min(960px, calc(100vw - 2 * var(--gutter)));
  max-width: none; padding: 0; border: 0; border-radius: 12px;
  background: var(--ink); color: var(--paper);
}
.demo-dialog::backdrop { background: rgba(0, 0, 0, .8); }
.demo-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); padding: var(--s1) var(--s1) var(--s1) var(--s2); }
.demo-bar h2 { font-size: 16px; font-weight: 600; }
.demo-close {
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; color: var(--paper); border: 0; border-radius: var(--radius); cursor: pointer;
}
.demo-close svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.5; fill: none; }
.demo-frame { aspect-ratio: 16 / 9; max-width: 100%; background: var(--grey-900); display: grid; place-items: center; }
.demo-frame iframe, .demo-frame video { width: 100%; height: 100%; border: 0; display: block; }
.demo-frame p { padding: var(--s3); text-align: center; color: #D9D9D9; }

/* ---------- 16. Simple pages (status, privacy, 404) ---------- */
.page { padding-block: var(--s6) var(--section); }
.page .container { max-width: calc(820px + 2 * var(--gutter)); display: grid; gap: var(--s3); }
.prose { display: grid; gap: var(--s2); }
.prose h2 { font-size: 22px; margin-top: var(--s2); }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; max-width: 68ch; }
.prose .meta { color: var(--grey-600); font-size: 14px; }
/* Inline links: padding enlarges the tap area to 44px without changing the line spacing */
.prose p a { padding-block: 12px; }

/* ---------- 17. Live mode: the form becomes secondary (spec 19) ---------- */
body.mode-live #join { background: var(--paper); }

/* ---------- 18. 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; }
}
