/* =========================================================================
   Crew Sheet — crewsheet.xymex.app
   Single shared stylesheet. No JavaScript, no external resources.
   System font stacks only. Dark-first with light via prefers-color-scheme.

   Palette is taken from the app itself: the accent is CuePhase.active
   (HSB 0.38/0.72/0.78) and the phase ladder below mirrors CuePhase.color,
   so the site and the product agree on what each phase looks like.
   ========================================================================= */

/* ---- Tokens: dark theme (default) ------------------------------------- */
:root {
  --bg: #0c0f12;
  --surface: #14181d;
  --surface-2: #1a1f26;
  --surface-border: rgba(255, 255, 255, 0.08);
  --text: #e7e9ec;
  --text-secondary: #99a0a8;

  --accent: #37c760; /* CuePhase.active — fills, motif, links on dark */
  --accent-text: #4ed673; /* inline link colour on dark */
  --accent-contrast: #05230f; /* text on an accent-filled button (dark) */
  --accent-tint: #102b19; /* SOLID chip tint — not a transparent color-mix, so
                             contrast stays determinable for a11y tooling */
  --accent-tint-border: #1d5330;

  /* The five cue phases, mirroring CuePhase.color (dark variants) */
  /* Lightened from the app's #70737a: as a label on --surface that value
     measured 3.75:1, under the 4.5:1 AA floor for text this size. #848890
     measures 5.01:1 and keeps the muted blue-grey. */
  --phase-upcoming: #848890;
  --phase-approaching: #e8c341;
  --phase-imminent: #f0973a;
  --phase-active: #37c760;
  --phase-overdue: #f2564d;

  --danger: #f2564d;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);

  /* Layout */
  --maxw: 68rem;
  --measure: 64ch;
  --radius: 16px;
  --radius-sm: 10px;
  --space: clamp(1rem, 0.6rem + 2vw, 1.5rem);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark light;
}

/* ---- Tokens: light theme --------------------------------------------- */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #f5f7f9;
    --surface-2: #eef1f4;
    --surface-border: rgba(0, 0, 0, 0.1);
    --text: #191c1f;
    --text-secondary: #585f66;

    /* Darkened so white labels clear AA 4.5:1 on the filled button */
    --accent: #14713a;
    --accent-text: #106332; /* inline TEXT/LINK colour on white */
    --accent-contrast: #ffffff;
    --accent-tint: #e3f4e8;
    --accent-tint-border: #bcdfc7;

    --phase-upcoming: #5f636a;
    --phase-approaching: #8a6a08;
    --phase-imminent: #9a5410;
    --phase-active: #14713a;
    --phase-overdue: #b3271f;

    --danger: #b3271f;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

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

img,
svg {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.4rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem);
  font-weight: 650;
}

h3 {
  font-size: 1.15rem;
  font-weight: 650;
}

p {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

a {
  color: var(--accent-text);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- Skip link -------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* ---- Layout ----------------------------------------------------------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space);
}

section {
  padding: clamp(3rem, 2rem + 5vw, 5.5rem) 0;
}

section + section {
  border-top: 1px solid var(--surface-border);
}

.lede {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: var(--measure);
}

/* ---- Header ----------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--surface-border);
  padding: 1rem 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  min-height: 44px;
}

.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

/* The page claims 44pt targets in the app; the nav should not undercut it.
   inline-flex + min-height grows the hit area without moving the text. */
.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
}

/* ---- Hero ------------------------------------------------------------- */
.hero {
  padding-top: clamp(3rem, 2rem + 6vw, 6rem);
}

.hero p.lede {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem);
  margin-bottom: 1.75rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
  background: var(--accent-tint);
  border: 1px solid var(--accent-tint-border);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

/* ---- Buttons ---------------------------------------------------------- */
.cta-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  min-height: 44px; /* same 44pt touch target the app enforces */
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--surface-border);
}

.btn-secondary:hover {
  background: var(--surface);
}

/* The pre-launch, non-clickable CTA. Swap for a real <a> when the app is live. */
.btn-pending {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px dashed var(--surface-border);
  cursor: default;
}

.note {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ---- Cards ------------------------------------------------------------ */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-top: 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h3 {
  margin-top: 0;
}

.card p {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
}

.card p + p {
  margin-top: 0.75rem;
}

/* ---- Phase ladder ----------------------------------------------------- */
.ladder {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.ladder li {
  display: grid;
  grid-template-columns: 0.75rem minmax(7rem, auto) 1fr;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
}

.ladder .swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  display: block;
}

.ladder .phase-name {
  font-weight: 650;
}

.ladder .phase-when {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* One class per phase so the swatch colour is data, not decoration. */
.p-upcoming .swatch { background: var(--phase-upcoming); }
.p-approaching .swatch { background: var(--phase-approaching); }
.p-imminent .swatch { background: var(--phase-imminent); }
.p-active .swatch { background: var(--phase-active); }
.p-overdue .swatch { background: var(--phase-overdue); }

.p-upcoming .phase-name { color: var(--phase-upcoming); }
.p-approaching .phase-name { color: var(--phase-approaching); }
.p-imminent .phase-name { color: var(--phase-imminent); }
.p-active .phase-name { color: var(--phase-active); }
.p-overdue .phase-name { color: var(--phase-overdue); }

/* ---- Pricing ---------------------------------------------------------- */
.price-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  margin-top: 2rem;
  align-items: start;
}

.price-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.price-card.featured {
  border-color: var(--accent-tint-border);
  background: var(--accent-tint);
}

.price-tag {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0.25rem 0 0.15rem;
}

.price-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.price-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.price-card li {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.5rem;
  align-items: start;
  font-size: 0.98rem;
}

.price-card li svg {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.22rem;
  flex: none;
}

.tick {
  color: var(--accent-text);
}

/* ---- Prose (privacy / support) ---------------------------------------- */
.prose {
  max-width: var(--measure);
}

.prose h2 {
  margin-top: 2.5rem;
}

.prose h3 {
  margin-top: 1.75rem;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose li > ul {
  margin-top: 0.4rem;
}

.page-meta {
  color: var(--text-secondary);
  font-size: 0.92rem;
  border-left: 3px solid var(--accent-tint-border);
  padding: 0.5rem 0 0.5rem 1rem;
  margin-bottom: 2rem;
}

.page-meta p {
  margin: 0;
}

.page-meta p + p {
  margin-top: 0.35rem;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.1rem 1.25rem;
  margin: 1.5rem 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout h3 {
  margin-top: 0;
}

/* ---- FAQ -------------------------------------------------------------- */
.faq {
  margin-top: 2rem;
  display: grid;
  gap: 0.75rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.4rem;
}

.faq-item h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.faq-item p:last-child {
  margin-bottom: 0;
  color: var(--text-secondary);
}

/* ---- Table ------------------------------------------------------------ */
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.97rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--surface-border);
  vertical-align: top;
}

th {
  font-weight: 650;
  color: var(--text);
}

td {
  color: var(--text-secondary);
}

/* ---- Footer ----------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--surface-border);
  padding: 2.5rem 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--text);
}

/* ---- 404 -------------------------------------------------------------- */
.center {
  text-align: center;
  padding: clamp(4rem, 3rem + 8vw, 8rem) 0;
}

.center p {
  margin-left: auto;
  margin-right: auto;
}

.center .cta-row {
  justify-content: center;
}

/* ---- Motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Print ------------------------------------------------------------ */
@media print {
  .site-header,
  .site-footer,
  .cta-row,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
