/*
 * RainLily site styles. Uses ONLY the semantic tokens in tokens.css (var(--color-*), --step-*,
 * --space-*, …); a literal colour here is a bug (the print stylesheet at the end is the one
 * deliberate exception: paper is white and ink is black). Shared by the placeholder and the launch
 * site, so it must say nothing about the app: rules for the launch home page's feature art live in
 * sites/launch/css/home.css. No JavaScript anywhere, and the CSP forbids inline styles, so every
 * variant is a class.
 */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: var(--weight-body);
  line-height: var(--leading-body);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  /* The one stacking context for the watercolor washes: a .blob (z-index -1) paints above the
     page background and below every piece of in-flow content, in any section. */
  isolation: isolate;
}

/* Belt and braces: nothing inside main may ever cause sideways page scroll. */
main { flex: 1 0 auto; overflow-x: clip; }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-heading);
  font-synthesis-weight: none;
  line-height: var(--leading-heading);
  margin: 0 0 var(--space-s);
  text-wrap: balance;
}
h1 { font-size: var(--step-4); letter-spacing: -0.015em; }
h2 { font-size: var(--step-3); letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); }

p, ul, ol, dl, table { margin: 0 0 var(--space-s); }
p { text-wrap: pretty; }
strong, b { font-weight: var(--weight-strong); }

a {
  color: var(--color-link);
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--color-link-hover);
  text-decoration-color: var(--color-underline-hover);
  text-decoration-thickness: 0.14em;
}
a:focus-visible, :focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  left: var(--space-s);
  top: -100px;
  z-index: 10;
  padding: var(--space-2xs) var(--space-s);
  background: var(--color-surface);
  color: var(--color-link);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-card);
}
.skip-link:focus { top: var(--space-s); }

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

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: currentColor;
}

/* ── Header ───────────────────────────────────────────────────────────────────────────── */
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2xs) var(--space-m);
  padding-block: var(--space-s);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-height: var(--target-min);
  color: var(--color-text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: var(--weight-heading);
  font-size: var(--step-1);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--color-text); }
.brand img { width: 2rem; height: 2rem; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  color: var(--color-text);
  text-decoration-line: none;
  font-weight: 500;
}
.site-nav a:hover {
  text-decoration-line: underline;
  text-decoration-color: var(--color-underline-hover);
}
/* The current page's only visual cue, so it uses the AA accent-text colour, not decorative poppy. */
.site-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-color: var(--color-accent-text);
  text-decoration-thickness: 0.14em;
}

/* ── Watercolor washes (decorative only: aria-hidden, never behind essential text alone) ── */
.has-washes {
  /* The containing block for its washes, and their sideways clip. Deliberately NOT a stacking
     context (no isolation, no z-index): a wash that bleeds into a neighbouring section must still
     paint under that section's text, which only happens if it resolves in body's context. */
  position: relative;
  overflow-x: clip;
  overflow-y: visible;
}

.blob {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.blob--a { -webkit-mask-image: url("/img/wash-blob-1.svg"); mask-image: url("/img/wash-blob-1.svg"); }
.blob--b { -webkit-mask-image: url("/img/wash-blob-2.svg"); mask-image: url("/img/wash-blob-2.svg"); }
.blob--sage { background-color: var(--color-wash-sage); opacity: var(--wash-opacity-sage); }
.blob--blue { background-color: var(--color-wash-blue); opacity: var(--wash-opacity-blue); }
.blob--poppy { background-color: var(--color-wash-poppy); opacity: var(--wash-opacity-poppy); }

/* Placements. Sizes scale with the viewport; positions are relative to the section. */
.blob--hero-1 { width: min(46rem, 95vw); aspect-ratio: 600 / 520; top: -14%; right: -18%; }
.blob--hero-2 { width: min(30rem, 70vw); aspect-ratio: 640 / 420; bottom: -10%; left: -16%; }
.blob--art { width: 135%; aspect-ratio: 640 / 420; top: 50%; left: 50%; translate: -50% -50%; }
.blob--corner { width: min(34rem, 90vw); aspect-ratio: 600 / 520; top: -4rem; right: -20%; }


/* ── Sections & shared text pieces ────────────────────────────────────────────────────── */
.section { padding-block: var(--space-2xl); }
.section--tight { padding-block: var(--space-xl); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  margin: 0 0 var(--space-2xs);
  color: var(--color-eyebrow);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  max-width: 38rem;
}

.muted { color: var(--color-text-muted); }

/* ── Hero ─────────────────────────────────────────────────────────────────────────────── */
.hero { padding-block: var(--space-xl) var(--space-2xl); }
.hero__grid {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
}
.hero h1 { max-width: 16ch; }

@media (min-width: 56rem) {
  .hero__grid { grid-template-columns: 7fr 5fr; }
}

/* Hero art: the brand mark over washes. Decorative (aria-hidden); swaps with img/mark.svg. */
.hero-art {
  /* Not isolated: its wash must resolve in body's layer like every other wash, or it would
     paint over the text beside it in single-column layouts. */
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(11rem, 28vw, 22rem);
}
.hero-art__mark { width: clamp(7.5rem, 17vw, 12.5rem); height: auto; }
.blob--art-small { width: 46%; aspect-ratio: 640 / 420; right: 2%; bottom: 6%; }

.card-grid {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  align-items: start;
}
.card h2 { font-size: var(--step-2); }
.card p:last-child, .card dl:last-child { margin-bottom: 0; }

/* ── Cards ────────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-card);
  padding: var(--space-m);
}
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  gap: var(--space-2xs) var(--space-m);
  margin: 0;
}
.facts dt { color: var(--color-text-muted); }
.facts dd { margin: 0; }

/* Standalone links get a 44px-tall target (the header, nav and footer links already do). */
.facts a, .toc a, .email-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
}


/* ── Contact & support ────────────────────────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  gap: var(--space-m);
  margin-block: var(--space-l);
}
@media (min-width: 44rem) {
  .contact-grid { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
}
.contact-grid h2 { font-size: var(--step-1); }
.email-link {
  font-weight: 600;
  font-size: var(--step-1);
  overflow-wrap: anywhere;
}

.faq { max-width: var(--measure); }
.faq h2 { margin-top: var(--space-xl); }
.faq h3 { margin-top: var(--space-l); margin-bottom: var(--space-2xs); }

/* ── Page header for inner pages ──────────────────────────────────────────────────────── */
.page-head { padding-block: var(--space-xl) var(--space-l); }
.page-head .lede { margin-bottom: 0; }

/* ── Legal prose ──────────────────────────────────────────────────────────────────────── */
.prose { max-width: var(--measure); padding-bottom: var(--space-2xl); }
.prose h2 {
  font-size: var(--step-2);
  margin-top: var(--space-xl);
  scroll-margin-top: var(--space-m);
}
.prose h3 { margin-top: var(--space-l); }
.prose li + li { margin-top: var(--space-3xs); }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose .updated { color: var(--color-text-muted); font-size: var(--step--1); }
.prose .summary {
  padding: var(--space-m);
  border-radius: var(--radius-m);
  background: var(--color-surface);
  border: 1px solid var(--color-rule);
}
.prose .summary h2 { margin-top: 0; font-size: var(--step-1); }
.prose .summary ul { margin-bottom: 0; }

.toc {
  margin-block: var(--space-l);
  padding: var(--space-m);
  border-radius: var(--radius-m);
  border: 1px solid var(--color-rule);
}
.toc h2 { font-family: var(--font-body); font-size: var(--step-0); font-weight: 650; margin: 0 0 var(--space-2xs); }
.toc ol { margin: 0; columns: 2 16rem; column-gap: var(--space-l); }
.toc li { break-inside: avoid; }

/* Inner pages' content column is a size container, so a data table can grow past the prose
   measure up to the full content width (100cqi) without ever causing horizontal page scroll. */
main > .wrap { container-type: inline-size; }
.table-scroll {
  width: min(64rem, 100cqi);
  overflow-x: auto;
  margin-block: var(--space-m);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-m);
}
.table-scroll:focus-visible { outline-offset: 2px; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 46rem;
  font-size: var(--step--1);
  margin: 0;
}
caption {
  text-align: left;
  padding: var(--space-s) var(--space-s) var(--space-2xs);
  font-weight: 600;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-2xs) var(--space-s);
  border-top: 1px solid var(--color-rule);
}
thead th { background: var(--color-surface-2); }
tbody th { font-weight: 600; }

/* ── Footer ───────────────────────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-rule);
  font-size: var(--step--1);
}
.site-footer .wrap { padding-block: var(--space-l); display: grid; gap: var(--space-s); }
.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-m);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer li a { display: inline-flex; align-items: center; min-height: var(--target-min); }
.site-footer p { margin: 0; }
.site-footer .credit { color: var(--color-text-muted); }

/* Unfilled owner input. scripts/check-local.sh refuses to pass while any "[OWNER" text remains,
   so this style only ever shows in local previews. */
.owner {
  outline: 2px dashed var(--color-accent-text);
  outline-offset: 2px;
  background: var(--color-pill-bg);
}

/* ── 404 ──────────────────────────────────────────────────────────────────────────────── */
.not-found { padding-block: var(--space-2xl); }
.not-found h1 { max-width: 18ch; }

/* ── Preferences ──────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (forced-colors: active) {
  .blob { display: none; }
}

@media print {
  .site-header nav, .skip-link, .blob, .toc { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .table-scroll { overflow: visible; border: 0; }
  table { min-width: 0; }
}
