/* soberfirstaid.com — the app's design system, in a browser.
   Every colour is a token from lib/core/theme/palette.dart. The type is
   the app's two variable fonts. The water is the app's shallow preset.
   Nothing here is invented for the website. */

/* ------------------------------------------------------------------ */
/* Fonts                                                                */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-Variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/Figtree-Italic-Variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}
/* Metric-matched fallbacks, so the swap does not move the page.
   size-adjust is measured by tools/brand/make_site_assets.py. */
@font-face {
  font-family: "Fraunces Fallback";
  src: local("Georgia");
  ascent-override: 97.8%;
  descent-override: 25.5%;
  line-gap-override: 0%;
  size-adjust: 104.4%;
}
@font-face {
  font-family: "Figtree Fallback";
  src: local("Arial");
  ascent-override: 95%;
  descent-override: 25%;
  line-gap-override: 0%;
  size-adjust: 101%;
}

/* ------------------------------------------------------------------ */
/* Tokens                                                               */
/* ------------------------------------------------------------------ */

:root {
  --sunlit: #FBF8F1;
  --card: #FFFFFF;
  --shoreline: #E3DECE;
  --hairline-soft: #F0EBE0;
  --ink: #20313A;
  --ink-muted: #5C6E6B;
  --ink-faint: #9AA8A5;
  --tide: #27856B;
  --tide-deep: #1F6B57;
  --seaglass: #7FB6A4;
  --gold: #E2B53F;
  --ember: #B4574A;
  --dawn-wash-soft: #FDF4E7;
  --dawn-line: #E9D9BE;

  --page: 1080px;
  --gutter: clamp(20px, 5vw, 48px);
  --measure: 62ch;
}

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

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

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

body {
  margin: 0;
  background: var(--sunlit);
  color: var(--ink);
  font-family: "Figtree", "Figtree Fallback", system-ui, sans-serif;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

/* Fraunces: every axis, every time. The file's own defaults are wght
   900 and WONK 1, so nothing may inherit the family alone. Weight goes
   through font-weight; the custom axes go through these properties. */
.fraunces {
  font-family: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --opsz: 40;
  --soft: 100;
  --wonk: 0;
  font-variation-settings: "opsz" var(--opsz), "SOFT" var(--soft), "WONK" var(--wonk);
}

h1, h2, h3, p, ol, ul, figure { margin: 0; }

h1 {
  font-weight: 480;
  --opsz: 60;
  font-size: clamp(40px, 6vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.005em;
  max-width: 16ch;
}

h2 {
  font-weight: 480;
  --opsz: 40;
  font-size: 34px;
  line-height: 1.1;
  max-width: 20ch;
}

h3 {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.3;
}

p { max-width: var(--measure); }
p + p { margin-top: 14px; }

.small {
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

a {
  color: var(--tide-deep);
  text-decoration-color: rgba(31, 107, 87, 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: currentColor; }

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

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

.horizon { display: block; }

/* ------------------------------------------------------------------ */
/* Header                                                               */
/* ------------------------------------------------------------------ */

.site-header {
  max-width: var(--page);
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.wordmark { display: inline-flex; padding: 4px 0; }
.wordmark img { width: auto; height: 22px; display: block; }


/* ------------------------------------------------------------------ */
/* Hero — the welcome screen, with the home screen standing in water    */
/* ------------------------------------------------------------------ */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.hero__inner {
  position: relative;
  z-index: 3;
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) var(--gutter) 96px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 48px;
  align-items: end;
}

.hero__copy { padding-bottom: 204px; }
.hero__copy .horizon { margin-bottom: 26px; }
.hero__copy h1 { margin-bottom: 22px; }

.hero__sub {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 40ch;
}

.hero__status {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.soon {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--shoreline);
  border-radius: 16px;
  background: var(--card);
  font-weight: 600;
  font-size: 16.5px;
  letter-spacing: 0.16px;
  color: var(--ink);
}

.hero__note { color: var(--ink-muted); }

.hero__phone { justify-self: end; }

.phone {
  width: 296px;
  padding: 10px;
  border-radius: 34px;
  background: var(--ink);
  box-shadow:
    0 34px 60px -28px rgba(32, 49, 58, 0.55),
    0 8px 16px -8px rgba(32, 49, 58, 0.3);
}
.phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 25px;
  background: var(--sunlit);
}

/* The water. Two layers of the app's shallow preset, each a tile one
   wavelength wide, translated by exactly one wavelength per loop —
   seamless by construction, composited rather than repainted. The
   phone's foot sits between the two layers. */
.water {
  position: absolute;
  inset: auto 0 0 0;
  height: 280px;
  overflow: hidden;
  pointer-events: none;
}
.water__layer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + 720px);
  background-repeat: repeat-x;
  background-position: 0 0;
  background-size: 720px 100%;
  animation: drift-720 20s linear infinite;
  will-change: transform;
}
.water__layer--foam {
  background-image: url("/waves/foam-720.svg");
  z-index: 1;
}
.water__layer--shoal {
  background-image: url("/waves/shoal-720.svg");
  z-index: 4;
  animation-direction: reverse;
  animation-duration: 26s;
}
/* WaterBackground(fadeTop:): the water dissolves into the page. */
.water::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 78px;
  z-index: 2;
  background: linear-gradient(#FBF8F1, rgba(251, 248, 241, 0));
}

@keyframes drift-720 { to { transform: translateX(-720px); } }
@keyframes drift-360 { to { transform: translateX(-360px); } }

@media (prefers-reduced-motion: reduce) {
  .water__layer { animation-play-state: paused; }
}

/* ------------------------------------------------------------------ */
/* Sections                                                             */
/* ------------------------------------------------------------------ */

.how, .features, .pair {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) var(--gutter) 0;
}

.how h2, .features h2 { margin-bottom: 8px; }

.steps {
  list-style: none;
  padding: 0;
  margin-top: 28px;
  max-width: 720px;
}
.steps li {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 14px;
  padding: 26px 0;
  border-top: 1px solid var(--shoreline);
}
.steps li:first-child { border-top: 0; padding-top: 8px; }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--ink-muted); }

/* The index: the same serif figure the crisis card sets 988 in. */
.list-numeral {
  font-weight: 460;
  --opsz: 32;
  --soft: 60;
  font-size: 24px;
  line-height: 0.96;
  color: var(--tide-deep);
  padding-top: 3px;
}

.origin {
  margin-top: 44px;
  max-width: 62ch;
}
.origin .horizon { margin-bottom: 18px; }
.origin h3 { margin-bottom: 8px; font-size: 16px; }
.origin p { color: var(--ink-muted); }

/* What's in the app: six short things, two abreast. */
.feature-list {
  list-style: none;
  padding: 0;
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px 48px;
  max-width: 900px;
}
.feature-list h3 { margin-bottom: 6px; }
.feature-list p { color: var(--ink-muted); max-width: 44ch; }

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}
.pair h2 { margin-bottom: 18px; font-size: 30px; }
.pair p { max-width: 46ch; }
.pair__cost {
  padding: 30px 32px 34px;
  border: 1px solid var(--dawn-line);
  border-radius: 20px;
  background: var(--dawn-wash-soft);
}
.pair__words { padding: 30px 0 0; }

/* ------------------------------------------------------------------ */
/* Footer                                                               */
/* ------------------------------------------------------------------ */

.site-footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(72px, 10vw, 120px) var(--gutter) 56px;
}
.site-footer .horizon { margin-bottom: 22px; }
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  margin-bottom: 12px;
}
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.site-footer nav a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* Legal pages                                                          */
/* ------------------------------------------------------------------ */

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) var(--gutter) 24px;
}
.legal h1 {
  font-size: clamp(34px, 5vw, 44px);
  --opsz: 48;
  max-width: none;
  margin-bottom: 12px;
}
.legal .updated { margin-bottom: 40px; }
.legal h2 {
  font-size: 26px;
  --opsz: 32;
  --soft: 90;
  font-weight: 500;
  margin: 48px 0 12px;
  max-width: none;
}
.legal h3 { margin: 28px 0 8px; font-size: 17px; }
.legal p, .legal li { max-width: var(--measure); line-height: 1.6; }
.legal ul, .legal ol { padding-left: 22px; margin: 10px 0; }
.legal li + li { margin-top: 6px; }
.legal .steps-inline { margin: 12px 0; }
.legal table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0 8px;
  font-size: 15.5px;
}
.legal th, .legal td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px 12px 0;
  border-top: 1px solid var(--shoreline);
}
.legal th { font-weight: 600; }
.legal thead th { border-top: 0; color: var(--ink-muted); font-weight: 600; font-size: 14px; }
.legal .note {
  padding: 18px 22px;
  border: 1px solid var(--dawn-line);
  border-radius: 16px;
  background: var(--dawn-wash-soft);
  margin: 20px 0;
}
.legal .note p { max-width: none; }

/* The empty page. */
.lost {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(64px, 12vw, 140px) var(--gutter) 40px;
}
.lost .horizon { margin-bottom: 26px; }
.lost h1 { margin-bottom: 16px; }
.lost p { color: var(--ink-muted); }

/* ------------------------------------------------------------------ */
/* Narrow screens                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 899px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
    padding-bottom: 80px;
  }
  .hero__copy { padding-bottom: 0; }
  .hero__phone { justify-self: center; }
  .phone { width: 236px; padding: 8px; border-radius: 28px; }
  .phone img { border-radius: 21px; }

  .water { height: 220px; }
  .water__layer {
    width: calc(100% + 360px);
    background-size: 360px 100%;
    animation-name: drift-360;
  }
  .water__layer--foam { background-image: url("/waves/foam-360.svg"); }
  .water__layer--shoal { background-image: url("/waves/shoal-360.svg"); }
  .water::before { height: 60px; }

  h2 { font-size: 30px; }

  .feature-list { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .pair { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .pair__words { padding-top: 40px; }
}

@media (max-width: 480px) {
  .steps li { grid-template-columns: 30px minmax(0, 1fr); gap: 0 12px; }
  .list-numeral { font-size: 22px; }
  .hero__sub { font-size: 17.5px; }
}

/* ------------------------------------------------------------------ */
/* Print — the legal pages, on paper                                    */
/* ------------------------------------------------------------------ */

@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-header, .site-footer, .water { display: none; }
  .legal { max-width: none; padding: 0; }
  .legal .note { border-color: #999; background: none; }
  a { color: inherit; text-decoration: none; }
}
