/* ============================================================
   Advocate, Shared styles
   Warm light theme, maroon accent, plain-English friendly.
   ============================================================ */

:root {
  /* Warm paper palette */
  --paper: #fbf9f5;
  --paper-2: #f5f1ea;
  --paper-3: #ece5d8;
  --ink: #1a1816;
  --ink-2: #2d2a26;
  --muted: #6b655c;
  --muted-2: #8a8379;
  --line: #e4ddd0;
  --line-2: #d3c9b6;

  /* Brand, locked deeper per request. Rule: every text surface is either
     white on oxblood OR oxblood on cream; no light-pink text anywhere. */
  --maroon:    #5c1a3c;  /* primary oxblood, used for brand + text on cream */
  --maroon-2:  #3d0f26;  /* deepest, for hover + strong emphasis */
  --maroon-3:  #6b1f44;  /* one step lighter, reserved for decorative accents */
  --maroon-tint: #f3e4ec;
  --maroon-wash: #fbf3f7;

  /* Accent */
  --amber: #c8772a;
  --amber-tint: #f7ecdb;
  --sage: #5f7a4e;
  --sage-tint: #e9efe0;

  /* Type */
  --serif: 'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --sans: 'General Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;

  /* Scale */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --container: 1200px;
  --gutter: clamp(20px, 4vw, 48px);

  --shadow-sm: 0 1px 2px rgba(26,24,22,.05), 0 0 0 1px rgba(26,24,22,.04);
  --shadow-md: 0 8px 24px -8px rgba(26,24,22,.12), 0 0 0 1px rgba(26,24,22,.05);
  --shadow-lg: 0 24px 48px -16px rgba(26,24,22,.18), 0 0 0 1px rgba(26,24,22,.05);
}

/* Dark mode, respect the user's OS preference by default.
   The [data-theme="dark"] selector is retained so a future toggle (or the
   dashboard chrome) can force dark independently of the system setting.
   The :not([data-theme="light"]) guard inside the media query lets an
   explicit [data-theme="light"] override a dark OS setting. */
[data-theme="dark"] {
  --paper: #141210;
  --paper-2: #1c1a17;
  --paper-3: #24211d;
  --ink: #fdfaf2;
  --ink-2: #eae2d1;
  --muted: #a8a092;
  --muted-2: #8a8274;
  --line: #33302a;
  --line-2: #433d34;
  --maroon-tint: rgba(160, 53, 105, 0.22);
  --maroon-wash: rgba(160, 53, 105, 0.08);
  --amber-tint: rgba(200, 119, 42, 0.18);
  --sage-tint: rgba(95, 122, 78, 0.20);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141210;
    --paper-2: #1c1a17;
    --paper-3: #24211d;
    --ink: #fdfaf2;
    --ink-2: #eae2d1;
    --muted: #a8a092;
    --muted-2: #8a8274;
    --line: #33302a;
    --line-2: #433d34;
    --maroon-tint: rgba(160, 53, 105, 0.22);
    --maroon-wash: rgba(160, 53, 105, 0.08);
    --amber-tint: rgba(200, 119, 42, 0.18);
    --sage-tint: rgba(95, 122, 78, 0.20);
  }
}

/* --- Reset-ish --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
input, textarea, select { font: inherit; color: inherit; }

/* --- Type --- */
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6.5vw, 88px); line-height: 1.02; letter-spacing: -0.02em; }
h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.5vw, 56px); line-height: 1.05; letter-spacing: -0.015em; }
h3 { font-size: clamp(20px, 2vw, 26px); line-height: 1.2; }
h4 { font-size: 16px; line-height: 1.3; }
p { margin: 0; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--maroon); font-weight: 500;
}
.eyebrow::before {
  content: ''; width: 20px; height: 1px; background: var(--maroon);
}
.eyebrow.no-rule::before { display: none; }

.serif-italic { font-family: var(--serif); font-style: italic; font-weight: 400; }

/* --- Layout --- */
.container {
  width: 100%; max-width: var(--container);
  margin: 0 auto; padding: 0 var(--gutter);
}
.section { padding: clamp(64px, 9vw, 128px) 0; }
.section-sm { padding: clamp(40px, 6vw, 80px) 0; }
.divider { height: 1px; background: var(--line); margin: 0; border: 0; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; font-weight: 500; font-size: 15px;
  border: 1px solid transparent; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  white-space: nowrap;
}
.btn-primary {
  /* Rule locked: maroon background always pairs with white text. Using
     fixed #fff (not var(--paper)) so the text stays bright in OS dark
     mode too, where --paper flips to near-black and would otherwise
     render dark-on-maroon. */
  background: var(--maroon); color: #fff;
  box-shadow: 0 6px 18px -6px rgba(92,26,60,.5);
}
.btn-primary:hover { background: var(--maroon-2); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(92,26,60,.55); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--line-2);
}
.btn-ghost:hover { background: var(--paper-2); border-color: var(--ink); }
.btn-link {
  color: var(--maroon); padding: 6px 0; border-radius: 0;
}
.btn-link:hover { color: var(--maroon-2); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* --- Chips / Tags --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.chip.maroon { background: var(--maroon-tint); border-color: transparent; color: var(--maroon); }
.chip.sage { background: var(--sage-tint); border-color: transparent; color: var(--sage); }
.chip.amber { background: var(--amber-tint); border-color: transparent; color: var(--amber); }
/* Enterprise plan chip: solid dark/inverted to distinguish from the
   maroon Pro chip at a glance. Dark = premium tier. */
.chip.enterprise { background: var(--ink); border-color: transparent; color: var(--paper); font-weight: 600; }
.chip .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* --- Card --- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
}
.card.soft { background: var(--paper-2); border-color: transparent; }
.card.lift { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }

/* --- Global nav ---
   Rule locked by the user: where the background is paper (cream), text is
   oxblood/maroon; where the background is maroon, text is paper. The nav bar
   stays cream in both light and OS-dark modes (it reads like a letterhead),
   so everything inside it is explicitly maroon, overriding whatever the
   page-level --ink tokens happen to be. */
.nav {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(160%) blur(14px);
  background: rgba(251, 249, 245, 0.82);
  border-bottom: 1px solid #e4ddd0;
  color: var(--maroon);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 22px; letter-spacing: -0.01em;
  color: var(--maroon);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  /* Real star wordmark lives at /icon-192.png, solid maroon fill is a
     render fallback for the split-second before the image decodes and for
     environments that block the PNG. The "A" text inside is hidden
     visually but kept in the DOM as an accessible label. */
  background: var(--maroon) url('/icon-192.png') center / cover no-repeat;
  display: grid; place-items: center; color: transparent;
  font-size: 0; letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(26,24,22,.12), 0 0 0 1px rgba(92,26,60,.25);
}
.nav-links {
  display: flex; align-items: center; gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  padding: 8px 14px; border-radius: 8px; font-size: 14.5px;
  color: var(--maroon);
  transition: background .15s ease, color .15s ease;
}
.nav-links a:hover { background: var(--maroon-tint); color: var(--maroon-2); }
.nav-links a.active { color: var(--maroon-2); background: var(--maroon-tint); }
.nav-cta { display: flex; align-items: center; gap: 10px; }
/* Force ghost-buttons inside the nav to oxblood on cream, regardless of the
   page's current --ink (which follows system color-scheme). */
.nav-cta .btn-ghost {
  color: var(--maroon);
  border-color: rgba(92, 26, 60, .35);
  background: transparent;
}
.nav-cta .btn-ghost:hover {
  background: var(--maroon-tint);
  border-color: var(--maroon);
  color: var(--maroon-2);
}
/* The primary CTA in the nav (maroon bg) keeps white text, already true
   via the global .btn-primary rule, but we override any inherited colors
   explicitly so the dark-mode --ink doesn't leak in. */
.nav-cta .btn-primary { color: #fff; }
.nav-cta .btn-primary:hover { color: #fff; }
@media (max-width: 820px) {
  .nav-links { display: none; }
}

/* --- Footer --- */
.footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
.footer-inner {
  display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 48px;
  padding: 64px 0 32px;
}
.footer h4 { font-size: 13px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 500; margin-bottom: 16px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer ul a { color: var(--ink-2); font-size: 14.5px; }
.footer ul a:hover { color: var(--maroon); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
@media (max-width: 820px) { .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; } }

/* --- Tweaks panel (Advocate-styled) --- */
.tweaks-panel {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow-lg);
  width: 280px; display: none;
  font-size: 13px;
}
.tweaks-panel.open { display: block; }
.tweaks-panel h4 { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.tweaks-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; gap: 12px; border-top: 1px solid var(--line); }
.tweaks-row:first-of-type { border-top: 0; }
.tweaks-row label { color: var(--ink-2); }
.tweaks-seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.tweaks-seg button { padding: 5px 10px; border-radius: 999px; font-size: 12px; color: var(--muted); }
.tweaks-seg button.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }

/* --- Utility --- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13.5px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 22px; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Subtle grain (warm, low opacity) --- */
.grain::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0 0.1  0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: .035; mix-blend-mode: multiply;
}

/* --- SVG placeholder (striped) --- */
.ph-img {
  background:
    repeating-linear-gradient(45deg, var(--paper-2) 0 8px, var(--paper-3) 8px 16px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--muted); font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.04em;
}

/* --- Reveal on scroll --- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* --- Marquee / logo strip --- */
.logo-strip {
  display: flex; gap: 56px; align-items: center; justify-content: center; flex-wrap: wrap;
  opacity: .7;
}
.logo-strip > * { color: var(--muted); font-family: var(--serif); font-size: 22px; }

/* --- Focus --- */
:focus-visible { outline: 2px solid var(--maroon); outline-offset: 2px; border-radius: 4px; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
