/*
 * Aspinflu website — shared styles for every page.
 *
 * Deliberately self-contained: system fonts only, no web fonts, no scripts.
 * A privacy policy that sent its readers' IP addresses to a font CDN would be
 * contradicting itself, and `_headers` forbids any third-party request anyway.
 *
 * Colours are the Aspinflu design tokens (design/Aspinflu Design Master
 * Context.md): violet on lavender paper by day, "Midnight" by night. The muted
 * text is a shade darker than the token so small print stays above 4.5:1.
 */

:root {
  color-scheme: light dark;

  --paper: #fffaff;
  --surface: #ffffff;
  --sunken: #f4effa;
  --primary: #5730b2;
  --heading: #432a80;
  --ink: #281d42;
  --muted: #75608f;
  --chip: #f1ebff;
  --hairline: #e9e1f2;
  --sparkle: #e15aa9;
  --glow-a: rgba(87, 48, 178, 0.16);
  --glow-b: rgba(255, 102, 196, 0.15);
  --shadow-card: 0 13px 27px rgba(72, 43, 121, 0.12);
  --shadow-panel: 0 8px 22px rgba(68, 43, 116, 0.06);

  --chip-violet-bg: #f1ebff;
  --chip-violet-fg: #5730b2;
  --chip-blue-bg: #e4f2ff;
  --chip-blue-fg: #3c7eae;
  --chip-green-bg: #dff8ec;
  --chip-green-fg: #26835e;
  --chip-pink-bg: #ffe6f4;
  --chip-pink-fg: #c2307f;

  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Baloo 2", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #150a21;
    --surface: #26123a;
    --sunken: #30164a;
    --primary: #ff66c4;
    --heading: #e8b4ff;
    --ink: #fff5fd;
    --muted: #c9a0e0;
    --chip: #3b1b59;
    --hairline: #52277d;
    --sparkle: #ff66c4;
    --glow-a: rgba(166, 75, 255, 0.2);
    --glow-b: rgba(255, 102, 196, 0.13);
    --shadow-card: 0 13px 27px rgba(0, 0, 0, 0.35);
    --shadow-panel: 0 8px 22px rgba(0, 0, 0, 0.25);

    --chip-violet-bg: #3b1b59;
    --chip-violet-fg: #e8b4ff;
    --chip-blue-bg: rgba(60, 126, 174, 0.28);
    --chip-blue-fg: #a9d4f5;
    --chip-green-bg: rgba(38, 131, 94, 0.3);
    --chip-green-fg: #94e3bf;
    --chip-pink-bg: rgba(255, 102, 196, 0.2);
    --chip-pink-fg: #ffa3dc;
  }
}

/* ---------- Base ---------- */

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

html {
  background-color: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

/* The two soft corner glows from the app, painted behind everything. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  pointer-events: none;
}

body::before {
  top: -38vmax;
  left: -30vmax;
  background: radial-gradient(closest-side, var(--glow-a), transparent);
}

body::after {
  bottom: -38vmax;
  right: -30vmax;
  background: radial-gradient(closest-side, var(--glow-b), transparent);
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

/* Long URLs in the policy text may break anywhere; navigation never should. */
main a {
  overflow-wrap: anywhere;
}

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

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

strong {
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 6vw, 2.9rem);
  font-weight: 800;
  margin: 0.25rem 0 0.5rem;
}

h2 {
  font-size: clamp(1.45rem, 3.6vw, 1.75rem);
  font-weight: 800;
  margin: 2.75rem 0 0.75rem;
  scroll-margin-top: 1.5rem;
}

h3 {
  font-size: 1.2rem;
  font-weight: 750;
  margin: 2rem 0 0.5rem;
  scroll-margin-top: 1.5rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.35rem;
}

li + li {
  margin-top: 0.35rem;
}

li::marker {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Header & footer ---------- */

.site-header,
.site-footer,
.page {
  width: 100%;
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--heading);
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: var(--shadow-panel);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.sparkle {
  color: var(--sparkle);
  margin-left: -0.35rem;
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.site-nav a {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--heading);
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .site-header {
    column-gap: 0.5rem;
  }

  .brand img {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .wordmark {
    font-size: 1.25rem;
  }

  .site-nav {
    gap: 0;
    font-size: 0.9rem;
  }

  .site-nav a {
    padding: 0.35rem 0.5rem;
  }
}

.site-nav a:hover {
  background: var(--chip);
}

.site-nav a[aria-current="page"] {
  background: var(--chip);
  color: var(--primary);
}

.site-footer {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- Document ---------- */

.page {
  padding-top: 1.5rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.doc-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.card > :last-child {
  margin-bottom: 0;
}

.summary h2 {
  margin-top: 0;
}

.lead {
  font-size: 1.1rem;
}

/* The "what leaves your phone" list: one pale chip per item, as in the app. */
.chip-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  display: grid;
  gap: 0.9rem;
}

.chip-list li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.85rem;
  align-items: start;
  margin: 0;
}

.chip {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-sm);
}

.chip svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip--violet {
  background: var(--chip-violet-bg);
  color: var(--chip-violet-fg);
}

.chip--blue {
  background: var(--chip-blue-bg);
  color: var(--chip-blue-fg);
}

.chip--green {
  background: var(--chip-green-bg);
  color: var(--chip-green-fg);
}

.chip--pink {
  background: var(--chip-pink-bg);
  color: var(--chip-pink-fg);
}

.chip-list p {
  margin: 0.4rem 0 0;
}

.toc {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-panel);
}

.toc-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc ol {
  margin: 0;
  padding-left: 1.4rem;
  columns: 2 15rem;
  column-gap: 2rem;
}

.toc li {
  break-inside: avoid;
  margin: 0 0 0.3rem;
}

/* For documents whose headings carry their own numbers ("1. The agreement"). */
.toc--plain ol {
  list-style: none;
  padding-left: 0;
}

.toc a {
  font-weight: 600;
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

.callout {
  background: var(--chip);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin: 0 0 1rem;
}

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

.steps > li {
  padding-left: 0.25rem;
}

.steps > li + li {
  margin-top: 0.7rem;
}

/* ---------- Tables (stack into cards on narrow screens) ---------- */

.table-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  border: 1px solid var(--hairline);
  overflow: hidden;
  margin: 0 0 1.25rem;
}

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

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 1rem;
}

thead th {
  background: var(--sunken);
  color: var(--heading);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr + tr td {
  border-top: 1px solid var(--hairline);
}

tbody td:first-child {
  font-weight: 700;
  width: 34%;
}

@media (max-width: 600px) {
  .table-card table,
  .table-card tbody,
  .table-card tr,
  .table-card td {
    display: block;
    width: 100%;
  }

  .table-card thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .table-card tbody tr {
    padding: 0.8rem 1rem;
  }

  .table-card tbody tr + tr {
    border-top: 1px solid var(--hairline);
  }

  .table-card tbody tr + tr td {
    border-top: 0;
  }

  .table-card td {
    padding: 0.15rem 0;
  }

  .table-card td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .table-card td + td {
    margin-top: 0.45rem;
  }

  tbody td:first-child {
    width: 100%;
  }

  .card,
  .toc {
    padding: 1.15rem;
  }
}

/* ---------- Landing & 404 ---------- */

.hero {
  text-align: center;
  padding: 2.5rem 1.5rem;
  margin-top: 1.5rem;
}

.hero img {
  width: 104px;
  height: 104px;
  border-radius: 26px;
  box-shadow: var(--shadow-card);
}

.hero h1 {
  margin-top: 1.25rem;
}

.hero p {
  max-width: 30rem;
  margin-left: auto;
  margin-right: auto;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-block;
  white-space: nowrap;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 800;
  text-decoration: none;
  background: var(--chip);
  color: var(--primary);
}

.button--primary {
  background: #5730b2;
  color: #ffffff;
  box-shadow: 0 5px 0 #35206d, 0 11px 20px rgba(77, 44, 154, 0.25);
}

.button--primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #35206d;
}

@media (prefers-color-scheme: dark) {
  .button--primary {
    background: #ff66c4;
    color: #150a21;
    box-shadow: 0 5px 0 #cc4499, 0 11px 20px rgba(0, 0, 0, 0.35);
  }

  .button--primary:active {
    box-shadow: 0 2px 0 #cc4499;
  }
}

/* ---------- Print ---------- */

@media print {
  body::before,
  body::after,
  .site-nav,
  .toc,
  .skip-link {
    display: none;
  }

  html,
  body {
    background: #ffffff;
    color: #000000;
  }

  .card,
  .table-card,
  .callout {
    box-shadow: none;
    border: 1px solid #cccccc;
  }

  a {
    color: #000000;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}

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