/* Before It Slips website
   Foundations only: fonts, design tokens, reset, base type and utilities.
   Page level styles arrive with the pages themselves. See SPEC.md section 4.

   Fonts are self hosted. Nothing here may reference another domain. */

/* ---------------------------------------------------------------
   Fonts
   Inter Tight for headings and Inter for text, as the Before It Slips
   Design System sets them. Both are SIL Open Font License 1.1 from the
   Inter project, which reserves no font name; licence text beside the
   files in assets/fonts/. Latin subset, one variable file per family
   with the full 100 to 900 weight axis, copied from the Design System.
   --------------------------------------------------------------- */

@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-tight-variable-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-variable-latin.woff2") format("woff2");
}

/* ---------------------------------------------------------------
   Tokens
   Values are the light (cream) theme of the Before It Slips Design
   System, kept under the names this stylesheet already used. Ratios
   were measured against --paper unless stated.
   --------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* Colour                   use              Design System token  */
  --paper: #f5f3ee;         /* page            background           */
  --ink: #14182b;           /* text            text        15.8:1   */
  --muted: #4b5068;         /* small print     text-muted   7.2:1   */
  --line: #ddd8cc;          /* hairlines       divider              */
  --line-strong: #767b92;   /* field edges     border       3.8:1, 4.2:1 on white */
  --surface: #ffffff;       /* cards, inputs   surface              */
  --paper-sunken: #ece8df;  /* tinted bands    surface-sunken       */
  --primary: #14182b;       /* main button     primary              */
  --on-primary: #f5f3ee;    /* its text        on-primary, 15.8:1 on navy */
  --primary-hover: #2d3354; /* hover           primary-pressed      */
  --accent: #b97500;        /* graphics only   accent       3.4:1   */
  --tint: #f8e8c8;          /* nudge fill      kind-slip-bg         */
  --done: #0b6b5f;          /* done ticks      success              */
  --brand-amber: #ffb020;   /* the placeholder marker only          */

  /* The Design System's rule: amber and coral never carry text or
     meaning on cream. --accent is for graphics and large text only, so
     the main button is navy with cream text rather than amber. */

  /* Type */
  --font-display: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step-h1: clamp(2rem, 7vw, 3.25rem);
  --step-h2: clamp(1.5rem, 4.5vw, 2rem);
  --step-h3: clamp(1.125rem, 3vw, 1.3125rem);
  --step-body: 1.0625rem;   /* 17px */
  --step-small: 0.9375rem;  /* 15px */

  --measure: 62ch;

  /* Spacing, from the Design System's scale: 4, 8, 16, 24, 32, 48 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;

  --radius-card: 1.25rem;      /* radius-card, 20px    */
  --radius-control: 0.75rem;   /* radius-control, 12px */

  --elevation-1: 0 1px 3px rgba(20, 24, 43, 0.12);
}

/* ---------------------------------------------------------------
   Reset
   --------------------------------------------------------------- */

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

body,
h1,
h2,
h3,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

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

input,
button {
  font: inherit;
  color: inherit;
}

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

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

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-body);
  line-height: 1.53; /* 26 on 17, the Design System's body style */
  text-underline-offset: 0.2em;
  /* Long unbreakable strings, the contact address above all, would otherwise
     push the page sideways at 320px once text is scaled up. */
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-h1);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--step-h2);
  line-height: 1.2;
}

h3 {
  font-size: var(--step-h3);
  line-height: 1.3;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
}

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

small {
  font-size: var(--step-small);
  color: var(--muted);
}

/* One ring everywhere, in navy with a gap, as the Design System's
   focus-ring sets it. On the navy button the gap shows cream paper
   between the button and the ring, so the ring still reads. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------
   Utilities
   --------------------------------------------------------------- */

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-control);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.measure {
  max-width: var(--measure);
}

/* ---------------------------------------------------------------
   Layout
   --------------------------------------------------------------- */

.wrap {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.section {
  padding-block: var(--space-6);
}

.section--tint {
  background-color: var(--paper-sunken);
}

section[id] {
  scroll-margin-top: var(--space-3);
}

.section > .wrap > * + * {
  margin-top: var(--space-4);
}

/* ---------------------------------------------------------------
   Buttons
   Navy fill with cream text, 15.8:1, and 11.1:1 on the hover navy.
   The fill is its own boundary at 15.8:1 against the paper.
   --------------------------------------------------------------- */

.btn,
.waitlist button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background-color: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: var(--radius-control);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover,
.waitlist button:hover {
  background-color: var(--primary-hover);
}

.btn--small {
  padding: 0.5rem 0.875rem;
  font-size: var(--step-small);
}

/* ---------------------------------------------------------------
   Header
   On phones the wordmark and the button only, with no menu toggle,
   so there is no hidden navigation to get wrong. The sections stay
   reachable by scrolling and by the footer links.
   --------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  padding-block: var(--space-3);
}

/* The row wraps rather than overflowing. At 320px with text at 200%, which is
   what a large Android font setting does, the wordmark and the button cannot
   sit side by side, so the button drops to its own line. Both stay visible,
   which is what the spec asks for on phones. */
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* The lockup is the Design System's on-light file, used as it is: it
   carries its own colours and its letters are outlines. 2.5rem tall is
   about 155px wide, which fits beside the button at 320px. */
.wordmark {
  display: block;
  line-height: 0;
}

.wordmark img {
  height: 2.5rem;
  width: auto;
}

.site-nav {
  display: none;
}

.site-nav__list {
  display: flex;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48em) {
  .site-nav {
    display: block;
  }
}

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */

.hero {
  padding-block: var(--space-5) var(--space-6);
}

.hero__inner {
  display: grid;
  gap: var(--space-5);
}

.hero__copy > * + * {
  margin-top: var(--space-3);
}

.eyebrow {
  font-size: var(--step-small);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.lead {
  font-size: clamp(1.0625rem, 2.5vw, 1.1875rem);
  max-width: var(--measure);
}

@media (min-width: 56em) {
  .hero__inner {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: var(--space-6);
  }
}

/* ---------------------------------------------------------------
   The card stack
   One card sits tilted, as if it is slipping off. On a phone it stays
   tilted with its nudge visible, so the whole idea reads without any
   interaction. The ease back is a pointer device enhancement only.
   --------------------------------------------------------------- */

.stack__list {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  box-shadow: var(--elevation-1);
}

.card__task {
  font-weight: 700;
}

.card--slipping {
  transform: rotate(-3.5deg);
}

.nudge {
  position: relative;
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background-color: var(--tint);
  color: var(--ink);
  border-radius: var(--radius-control);
  font-size: var(--step-small);
}

/* The tail, drawn in CSS rather than loaded as an image. */
.nudge::before {
  content: "";
  position: absolute;
  top: -0.5rem;
  left: var(--space-4);
  border-left: 0.5rem solid transparent;
  border-right: 0.5rem solid transparent;
  border-bottom: 0.5rem solid var(--tint);
}

@media (hover: hover) and (pointer: fine) {
  .card--slipping {
    transition: transform 240ms ease;
  }

  .stack:hover .card--slipping {
    transform: rotate(0deg);
  }
}

/* ---------------------------------------------------------------
   How it works
   --------------------------------------------------------------- */

.steps {
  display: grid;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  counter-increment: step;
  max-width: var(--measure);
}

.steps li::before {
  content: counter(step);
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--primary);
  color: var(--on-primary);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
}

.steps li > p {
  grid-column: 2;
}

.steps li > p + p {
  margin-top: var(--space-1);
}

.steps__lead {
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Tick lists
   The tick is drawn with two borders, so it needs no icon font and
   no character from outside the latin subset.
   --------------------------------------------------------------- */

.ticks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticks li {
  position: relative;
  padding-left: var(--space-4);
}

.ticks li + li {
  margin-top: var(--space-2);
}

.ticks li::before {
  content: "";
  position: absolute;
  top: 0.4em;
  left: 0.125rem;
  width: 0.4rem;
  height: 0.75rem;
  border-right: 2px solid var(--done);
  border-bottom: 2px solid var(--done);
  transform: rotate(45deg);
}

.note {
  font-size: var(--step-small);
  color: var(--muted);
}

/* ---------------------------------------------------------------
   Waitlist form
   --------------------------------------------------------------- */

.waitlist {
  display: grid;
  gap: var(--space-2);
  max-width: 26rem;
}

.waitlist label {
  font-weight: 700;
}

.waitlist input[type="email"] {
  /* Without this the input falls back to its intrinsic 20 character width,
     which overflows a 320px screen once the text is scaled up. */
  width: 100%;
  padding: 0.7rem 0.75rem;
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
}

.waitlist button {
  justify-self: start;
  margin-top: var(--space-2);
}

/* ---------------------------------------------------------------
   FAQ
   --------------------------------------------------------------- */

.faq details {
  border-top: 1px solid var(--line);
  padding-block: var(--space-3);
}

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

.faq summary {
  font-weight: 700;
  cursor: pointer;
}

.faq details p {
  margin-top: var(--space-2);
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-5);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-3);
}

.site-footer__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48em) {
  .site-footer__inner {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-4);
  }

  .site-footer__list {
    justify-content: center;
  }
}

/* ---------------------------------------------------------------
   Content pages
   Privacy, terms, support, delete account, thanks and 404.
   --------------------------------------------------------------- */

.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: var(--space-3);
}

.prose h2 {
  margin-top: var(--space-5);
}

.prose h3 {
  margin-top: var(--space-4);
}

.prose ul {
  padding-left: var(--space-4);
}

.prose li + li {
  margin-top: var(--space-1);
}

/* A visible note for a section that is not finished yet. */
.notice {
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-control);
  padding: var(--space-3);
}

/* Deliberately loud, and the one place the brand amber fills behind
   text. Nothing wearing this should reach production. Navy on amber is
   9.6:1, so it stays readable while it shouts. */
.placeholder {
  background-color: var(--brand-amber);
  color: var(--ink);
  padding: 0 0.25rem;
  border-radius: 3px;
  font-weight: 700;
}

/* ---------------------------------------------------------------
   Motion
   Nothing on this site needs movement to be understood. Honour the
   preference globally. The !important here outranks the component
   transitions above, whatever the source order.
   --------------------------------------------------------------- */

@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;
  }
}
