/* ==========================================================================
   Dispatch — Design System
   A product of Civil Digital. Follows the Civil Digital site conventions:
   token-driven, system font stack (no external fonts), accessible, fast.
   Brand: navy (--navy) + teal accent (--teal), on light mist neutrals.
   Tokens match the Dispatch app itself (see docs/adr/0002-design-tokens.md
   in the app repo), which carried BoatLog's brand across on purpose.
   ========================================================================== */

/* ---- Design tokens ------------------------------------------------------ */
:root {
  /* Brand */
  --navy:          #0B1F3A;   /* primary brand / ink */
  --navy-600:      #14304f;   /* gradient / hover */
  --teal:          #2EC4B6;   /* the single strong accent */
  --teal-dark:     #1fa99c;   /* hover / active / AA on white for text */
  --mist:          #E6EEF2;   /* light section wash */

  /* Ink & neutrals */
  --ink:           #0B1F3A;   /* headings / primary text */
  --body:          #33465a;   /* body text (AA on white) */
  --muted:         #5b6b7d;   /* secondary text */
  --line:          #dbe4ec;   /* borders / dividers */
  --surface:       #ffffff;
  --surface-alt:   #f5f8fb;   /* alternating section bg */
  --surface-deep:  #0B1F3A;   /* dark footer / hero */

  /* Feedback */
  --focus:         #1fa99c;
  --success:       #1fa99c;
  --error:         #b91c1c;

  /* Typography — system stack for performance */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
               Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --fs-300: 0.875rem;
  --fs-400: 1rem;
  --fs-500: 1.125rem;
  --fs-600: 1.375rem;
  --fs-700: clamp(1.5rem, 3.5vw, 2rem);
  --fs-800: clamp(2rem, 5vw, 3rem);
  --fs-900: clamp(2.4rem, 6vw, 3.6rem);

  /* Spacing scale */
  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;   --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;

  /* Other */
  --radius:    16px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow:    0 1px 2px rgba(11,31,58,.06), 0 10px 30px rgba(11,31,58,.10);
  --shadow-lg: 0 24px 60px rgba(11,31,58,.16);
  --maxw:      1120px;
  --maxw-prose: 70ch;
}

/* ---- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html, body { max-width: 100%; overflow-x: hidden; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: 1.65;
  color: var(--body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
table, pre, iframe { max-width: 100%; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-900); }
h2 { font-size: var(--fs-800); }
h3 { font-size: var(--fs-600); }
h4 { font-size: var(--fs-500); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- Accessibility helpers --------------------------------------------- */
.skip-link {
  position: absolute; left: var(--sp-2); top: -3rem;
  background: var(--teal); color: var(--navy); padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm); z-index: 200; transition: top .15s ease; font-weight: 600;
}
.skip-link:focus { top: var(--sp-2); text-decoration: none; }

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

/* ---- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-5); }
.section { padding: var(--sp-9) 0; }
.section--tint { background: var(--mist); }
.text-center { text-align: center; }

.eyebrow {
  text-transform: uppercase; letter-spacing: .16em;
  font-size: var(--fs-300); font-weight: 700; color: var(--teal-dark);
}

.section-head { max-width: 640px; margin: 0 auto var(--sp-8); text-align: center; }
.section-head h2 { margin-top: var(--sp-3); }
.section-head p { color: var(--muted); font-size: var(--fs-500); margin: var(--sp-3) auto 0; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-block; border-radius: var(--radius-pill);
  padding: var(--sp-3) var(--sp-5); font-weight: 600; font-size: var(--fs-400);
  cursor: pointer; border: 2px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary   { background: var(--teal); color: var(--navy); }
.btn--primary:hover { background: var(--teal-dark); color: #fff; }
.btn--secondary { background: transparent; color: var(--navy); border-color: var(--line); }
.btn--secondary:hover { border-color: var(--teal); color: var(--teal-dark); }
.btn--ghost { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.btn--ghost:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn--lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-500); }

/* ---- Coming-soon / status banner ----------------------------------------- */
.banner {
  background: var(--teal); color: var(--navy);
  text-align: center; font-weight: 600; font-size: var(--fs-300);
  padding: var(--sp-3) var(--sp-4); letter-spacing: .02em;
}
.banner strong { text-transform: uppercase; letter-spacing: .08em; }

/* ---- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .nav {
  display: flex; align-items: center; justify-content: space-between; height: 72px;
}
.brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 700; font-size: var(--fs-600); color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 10px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px var(--line);
}
.brand__mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.brand__text .log { color: var(--teal); }

.nav__toggle {
  display: none; background: none; border: 0; color: var(--navy);
  padding: var(--sp-2); cursor: pointer; border-radius: var(--radius-sm);
}
.nav__links { display: flex; align-items: center; gap: var(--sp-6); list-style: none; padding: 0; }
.nav__links a { color: var(--navy); font-weight: 500; }
.nav__links a:hover { color: var(--teal-dark); text-decoration: none; }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative; color: #fff; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(46,196,182,.18), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-600) 100%);
}
.hero .container {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--sp-8);
  align-items: center; padding-top: var(--sp-9); padding-bottom: var(--sp-9);
}
.hero h1 { color: #fff; }
.hero h1 .accent { color: var(--teal); }
.hero .eyebrow { display: inline-block; margin-bottom: var(--sp-5); color: var(--teal); }
.hero__lead { font-size: var(--fs-500); color: #c7d3e0; max-width: 36ch; margin: var(--sp-5) 0 var(--sp-6); }
.hero__actions { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.hero__tagline {
  margin-top: var(--sp-6); text-transform: uppercase; letter-spacing: .12em;
  font-size: var(--fs-300); color: #8fa3b8; font-weight: 600;
}
.hero__art { display: flex; justify-content: center; }
.hero-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  border-radius: 24px; padding: var(--sp-7); width: 100%; max-width: 380px;
  text-align: center; box-shadow: var(--shadow-lg);
}
.hero-card__mark {
  background: #fff; border-radius: 24px; width: 180px; height: 180px;
  margin: 0 auto var(--sp-5); display: flex; align-items: center; justify-content: center;
}
.hero-card__mark img { width: 150px; height: 150px; object-fit: contain; }
.hero-card h3 { color: #fff; margin-bottom: var(--sp-1); }
.hero-card p { color: #a9b8c9; font-size: var(--fs-300); margin: 0; }

/* ---- Feature cards ------------------------------------------------------ */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-7) var(--sp-6); box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card__icon {
  width: 56px; height: 56px; border-radius: 14px; background: var(--mist);
  display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-5);
}
.card__icon svg { width: 30px; height: 30px; }
.card h3 { font-size: var(--fs-600); color: var(--navy); margin-bottom: var(--sp-3); }
.card p { color: var(--muted); margin: 0; }

/* ---- Steps -------------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.step { text-align: center; }
.step__num {
  width: 52px; height: 52px; margin: 0 auto var(--sp-5); border-radius: 50%;
  background: var(--navy); color: #fff; font-weight: 700; font-size: var(--fs-600);
  display: flex; align-items: center; justify-content: center;
}
.step h3 { color: var(--navy); font-size: var(--fs-500); margin-bottom: var(--sp-2); }
.step p { color: var(--muted); margin: 0 auto; }

/* ---- Pricing -------------------------------------------------------------- */
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); align-items: stretch; }
.price-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-6) var(--sp-5); box-shadow: var(--shadow); display: flex; flex-direction: column;
  position: relative;
}
.price-card--featured { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal), var(--shadow-lg); }
.price-card__badge {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--teal); color: var(--navy); font-size: var(--fs-300); font-weight: 700;
  padding: 2px var(--sp-3); border-radius: var(--radius-pill); white-space: nowrap;
}
.price-card h3 { font-size: var(--fs-500); color: var(--navy); margin-bottom: var(--sp-2); }
.price-card__amount { font-size: var(--fs-800); color: var(--ink); font-weight: 800; line-height: 1; margin-bottom: var(--sp-1); }
.price-card__amount small { font-size: var(--fs-300); color: var(--muted); font-weight: 500; }
.price-card__note { color: var(--muted); font-size: var(--fs-300); margin-bottom: var(--sp-5); }
.price-card__features { list-style: none; padding: 0; margin: 0 0 var(--sp-6); flex-grow: 1; }
.price-card__features li {
  padding: var(--sp-2) 0; color: var(--body); font-size: var(--fs-300);
  border-top: 1px solid var(--line); display: flex; gap: var(--sp-2);
}
.price-card__features li:first-child { border-top: 0; }
.price-card__features li::before { content: "✓"; color: var(--teal-dark); font-weight: 700; flex-shrink: 0; }
.pricing-note { text-align: center; color: var(--muted); font-size: var(--fs-300); margin-top: var(--sp-6); }

/* ---- CTA / start trial ---------------------------------------------------- */
.cta {
  background: linear-gradient(120deg, var(--navy), var(--navy-600)); color: #fff;
  border-radius: 24px; padding: var(--sp-8) var(--sp-7); text-align: center; box-shadow: var(--shadow-lg);
}
.cta h2 { color: #fff; }
.cta p { color: #c7d3e0; max-width: 48ch; margin: var(--sp-4) auto var(--sp-6); }
.cta__actions { display: flex; gap: var(--sp-4); flex-wrap: wrap; justify-content: center; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { background: var(--navy); color: #b6c4d4; padding: var(--sp-8) 0 var(--sp-6); }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-8); flex-wrap: wrap; }
.footer-brand { max-width: 320px; }
.footer-brand .brand { color: #fff; margin-bottom: var(--sp-3); }
.footer-brand .brand .log { color: var(--teal); }
.footer-brand p { color: #8fa3b8; font-size: var(--fs-300); }
.site-footer nav h2, .site-footer div h2 { color: #fff; font-size: var(--fs-300); text-transform: uppercase; letter-spacing: .1em; margin-bottom: var(--sp-4); }
.footer-links { list-style: none; padding: 0; }
.footer-links li { margin-bottom: var(--sp-2); }
.footer-links a { color: #b6c4d4; }
.footer-links a:hover { color: var(--teal); text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1); margin-top: var(--sp-7); padding-top: var(--sp-5);
  display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
  font-size: var(--fs-300); color: #8fa3b8;
}

/* ---- Legal / prose page ------------------------------------------------- */
.page-head { background: linear-gradient(180deg, var(--navy), var(--navy-600)); color: #fff; padding: var(--sp-8) 0; }
.page-head h1 { color: #fff; }
.page-head p { color: #c7d3e0; margin: var(--sp-3) 0 0; }
.page-head .breadcrumb { color: #8fa3b8; font-size: var(--fs-300); margin-bottom: var(--sp-4); }
.page-head .breadcrumb a { color: #c7d3e0; }
.prose { max-width: var(--maxw-prose); margin: 0 auto; }
.prose h2 { color: var(--navy); font-size: var(--fs-600); margin-top: var(--sp-7); }
.prose h2:first-of-type { margin-top: 0; }
.prose p, .prose li { color: var(--body); }
.prose ul { padding-left: var(--sp-5); margin-top: var(--sp-3); }
.prose li { margin-bottom: var(--sp-2); }
.prose .updated { color: var(--muted); font-style: italic; margin-bottom: var(--sp-6); }
.callout {
  background: var(--mist); border-left: 4px solid var(--teal); border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5); color: var(--body); margin: var(--sp-6) 0;
}

/* ---- Roles & permissions table -------------------------------------------- */
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); margin-bottom: var(--sp-9); }
.perm-group + .perm-group { margin-top: var(--sp-8); }
.perm-group h2 { margin-bottom: var(--sp-4); }
.table-wrap { overflow-x: auto; margin: 0 0 var(--sp-5); -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; min-width: 40rem; border-collapse: collapse; text-align: left; }
.data-table thead th {
  border-bottom: 1px solid var(--line); padding: var(--sp-3) var(--sp-3) var(--sp-2);
  font-size: var(--fs-300); font-weight: 700; color: var(--navy);
}
.data-table th[scope="row"] {
  border-bottom: 1px solid var(--line); padding: var(--sp-4) var(--sp-3) var(--sp-4) 0;
  font-weight: 400; text-align: left; vertical-align: top; min-width: 14rem;
}
.data-table tbody tr:last-child th[scope="row"],
.data-table tbody tr:last-child td { border-bottom: 0; }
.perm-label { display: block; font-size: var(--fs-400); font-weight: 600; color: var(--navy); }
.perm-desc { display: block; margin-top: 2px; font-size: var(--fs-300); color: var(--muted); }
.data-table td.role-col, .data-table th.role-col {
  width: 8.5rem; text-align: center; vertical-align: top;
  border-bottom: 1px solid var(--line); padding: var(--sp-4) var(--sp-2);
}
.tick-yes { font-size: 1.2em; font-weight: 700; color: var(--teal-dark); }
.tick-no { font-size: 1.2em; color: var(--muted); }
.own-only { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--muted); }

/* ---- FAQ (native details/summary, no JS needed) -------------------------- */
.faq { max-width: var(--maxw-prose); margin: 0 auto; display: grid; gap: var(--sp-3); }
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
}
.faq summary {
  cursor: pointer; font-weight: 600; color: var(--navy); list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; font-size: 1.3em; line-height: 1; color: var(--teal-dark); flex-shrink: 0;
  transition: transform .15s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: var(--sp-3); color: var(--body); }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .hero .container { grid-template-columns: 1fr; padding-top: var(--sp-7); padding-bottom: var(--sp-7); }
  .hero__art { order: -1; }
  .features, .steps, .role-cards { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }

  .nav__toggle { display: inline-flex; }
  .nav__links {
    position: absolute; left: 0; right: 0; top: 72px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: var(--sp-3) var(--sp-5); box-shadow: var(--shadow);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__links li { padding: var(--sp-2) 0; }
}
