/*
  Pivox marketing site.

  Visual language follows docs/planning/flat-application-design-system.md so the
  site and the authenticated app read as one product (decision DE-10): one
  continuous surface, hierarchy from typography and spacing, dividers instead of
  card borders, small radii reserved for controls.

  Brand cyan (--brand) matches --ion-color-primary in app/src/theme/variables.css.
  It is a fill colour, not a text colour: cyan text on white fails WCAG AA, so
  --brand-ink is used wherever brand colour carries words.
*/

:root {
  --brand: #00bfe8;
  --brand-shade: #00a9cf;
  --brand-ink: #056d85;
  --on-brand: #04222a;

  --page: #ffffff;
  --surface-alt: #f6f7f9;
  --control: #f3f4f5;
  --divider: rgba(28, 31, 36, 0.12);

  --text: #1c1f24;
  --text-secondary: #5c6169;
  --text-tertiary: #767c85;

  --radius-control: 8px;
  --radius-chip: 9999px;

  --wrap: 1120px;
  --wrap-narrow: 720px;
  --gutter: 20px;

  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #111318;
    --surface-alt: #171a20;
    --control: #20242c;
    --divider: rgba(255, 255, 255, 0.14);

    --brand-ink: #5fd9f4;
    --text: #f4f5f7;
    --text-secondary: #b5bac3;
    --text-tertiary: #8f96a1;

    color-scheme: dark;
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.125rem; }

p { margin: 0; }

a {
  color: var(--brand-ink);
  text-underline-offset: 3px;
}

a:hover { text-decoration: none; }

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

ul,
ol { margin: 0; padding: 0; }

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

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  border-radius: var(--radius-control);
  transition: top 0.15s ease;
}

.skip-link:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.wrap-narrow { max-width: var(--wrap-narrow); }

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover { background: var(--brand-shade); }

.btn-ghost {
  background: transparent;
  border-color: var(--divider);
  color: var(--text);
}

.btn-ghost:hover { background: var(--control); }

.btn-sm { min-height: 38px; padding: 6px 14px; font-size: 0.9375rem; }
.btn-lg { min-height: 52px; padding: 14px 24px; font-size: 1.0625rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  text-decoration: none;
}

.link-arrow:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled { border-bottom-color: var(--divider); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-control);
}

.site-nav a:hover {
  color: var(--text);
  background: var(--control);
}

.site-nav a.btn {
  color: var(--on-brand);
  margin-left: 8px;
}

.site-nav a.btn:hover { color: var(--on-brand); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius-control);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bars {
  display: grid;
  gap: 4px;
}

.nav-toggle-bars span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    display: none;
    padding: 8px var(--gutter) 16px;
    background: var(--page);
    border-bottom: 1px solid var(--divider);
  }

  .site-nav.is-open { display: block; }

  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .site-nav a {
    padding: 12px;
    font-size: 1rem;
  }

  .site-nav a.btn {
    margin: 8px 0 0;
    justify-content: center;
  }
}

/* ------------------------------------------------------------------- hero */

.hero {
  padding-block: clamp(56px, 10vw, 104px) clamp(40px, 7vw, 72px);
  text-align: center;
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--brand-ink);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero h1 { max-width: 16ch; margin-inline: auto; }

.lede {
  max-width: 62ch;
  margin: 20px auto 0;
  color: var(--text-secondary);
  font-size: clamp(1.0625rem, 2vw, 1.1875rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.hero-note {
  margin-top: 20px;
  color: var(--text-tertiary);
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------- sections */

.section { padding-block: clamp(48px, 8vw, 88px); }

.section-alt {
  background: var(--surface-alt);
  border-block: 1px solid var(--divider);
}

.section-head { max-width: 60ch; margin-bottom: 40px; }

.section-head p {
  margin-top: 12px;
  color: var(--text-secondary);
}

/* Feature rows: dividers, not cards (flat design system §5.3). */

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
  list-style: none;
  border-top: 1px solid var(--divider);
}

.feature {
  padding: 28px 24px 28px 0;
  border-bottom: 1px solid var(--divider);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: var(--radius-control);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand-ink);
}

.feature p,
.step p {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.9875rem;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  list-style: none;
  counter-reset: step;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-bottom: 14px;
  border-radius: var(--radius-chip);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  font-size: 0.9375rem;
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

.split-text p {
  margin-block: 16px 20px;
  color: var(--text-secondary);
}

.split-points {
  list-style: none;
  border-top: 1px solid var(--divider);
}

.split-points li {
  display: flex;
  gap: 14px;
  padding-block: 20px;
  border-bottom: 1px solid var(--divider);
}

.split-points .icon {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  color: var(--brand-ink);
}

.split-points p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* -------------------------------------------------------------------- faq */

.faq { border-top: 1px solid var(--divider); }

.faq details { border-bottom: 1px solid var(--divider); }

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: '+';
  flex: none;
  color: var(--brand-ink);
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1;
}

.faq details[open] summary::after { content: '–'; }

.faq-body {
  padding-bottom: 20px;
  max-width: 68ch;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------- contact */

.contact-block p {
  margin-block: 16px 24px;
  color: var(--text-secondary);
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cta-band {
  padding-block: clamp(48px, 8vw, 80px);
  border-top: 1px solid var(--divider);
  background: var(--surface-alt);
  text-align: center;
}

.cta-band p {
  margin: 14px auto 28px;
  max-width: 52ch;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------------- footer */

.site-footer {
  padding-block: 56px 32px;
  border-top: 1px solid var(--divider);
  font-size: 0.9375rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 40px 32px;
}

@media (max-width: 820px) {
  .footer-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}

.footer-brand p {
  margin-top: 14px;
  max-width: 34ch;
  color: var(--text-secondary);
}

.footer-col h2 {
  margin-bottom: 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.footer-col ul { list-style: none; }

.footer-col li + li { margin-top: 10px; }

.footer-col a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--text);
  text-decoration: underline;
}

.muted {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.disclaimer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--divider);
  max-width: 90ch;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.copyright {
  margin-top: 20px;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

/* ------------------------------------------------- long-form document page */

.doc { padding-block: clamp(40px, 7vw, 72px); }

.doc-header { padding-bottom: 28px; border-bottom: 1px solid var(--divider); }

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 20px 0 0;
}

.doc-meta div { display: flex; gap: 8px; }

.doc-meta dt {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.doc-meta dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.doc-summary {
  margin-top: 20px;
  max-width: 70ch;
  color: var(--text-secondary);
}

.prose { padding-top: 8px; }

.prose h2 {
  margin-top: 44px;
  font-size: 1.375rem;
  scroll-margin-top: 96px;
}

.prose h3 { margin-top: 28px; }

.prose p,
.prose ul,
.prose ol {
  margin-top: 16px;
  max-width: 74ch;
  color: var(--text-secondary);
}

.prose ul,
.prose ol { padding-left: 22px; }

.prose li + li { margin-top: 8px; }

.prose strong { color: var(--text); }

.prose hr {
  margin-top: 48px;
  border: 0;
  border-top: 1px solid var(--divider);
}

.source-note {
  margin-top: 24px;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.source-note code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--control);
  font-size: 0.8125rem;
}

.error-page { text-align: center; }
.error-page .hero-actions { justify-content: center; }

/* -------------------------------------------------------------- animation */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
