/* The marketing site (docs/06 §6j). Every value is a token from dist/tokens.css, generated from
   src/theme/tokens.ts. web-css (D63): the reset, logical properties, one focus ring, hover only
   with a fine pointer, press feedback, motion only when allowed, a content grid with breakouts. */

/* The reset (web-css foundations) */
*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

:root {
  interpolate-size: allow-keywords;
  scrollbar-gutter: stable;
  text-wrap: pretty;
  overflow-wrap: break-word;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--body);
  line-height: var(--lh-body);
}

main {
  flex: 1;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
  font-family: var(--serif);
  font-weight: 500;
  line-height: var(--lh-display);
  margin: 0;
}

p {
  margin: 0;
}

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

button,
a,
[role='button'] {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* One focus ring (web-css interaction) */
:focus-visible {
  outline: max(2px, 0.08em) solid currentColor;
  outline-offset: 0.25em;
}

/* Press feedback on everything pressable */
a:active {
  transform: scale(var(--press-scale));
}

@media (prefers-reduced-motion: no-preference) {
  a {
    transition: transform var(--press-ms) ease-out;
  }
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--accent);
  }
}

/* Content grid with breakouts (web-css layout) */
.content-grid {
  --breakout: calc(var(--content) + var(--gutter) * 4);
  display: grid;
  grid-template-columns:
    [full-width-start] minmax(var(--gutter), 1fr)
    [breakout-start] minmax(0, calc((var(--breakout) - var(--content)) / 2))
    [content-start] min(100% - var(--gutter) * 2, var(--content)) [content-end]
    minmax(0, calc((var(--breakout) - var(--content)) / 2)) [breakout-end]
    minmax(var(--gutter), 1fr) [full-width-end];
  row-gap: var(--gutter);
}

.content-grid > * {
  grid-column: content;
}

.content-grid > .breakout {
  grid-column: breakout;
}

.prose.content-grid {
  --content: var(--prose);
}

section,
article {
  padding-block: var(--section-gap);
}

/* Skip link */
.skip {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: calc(var(--gutter) * -4);
  padding: calc(var(--gutter) / 3) calc(var(--gutter) / 2);
  background: var(--button-bg);
  color: var(--button-text);
}

.skip:focus-visible {
  inset-block-start: calc(var(--gutter) / 2);
  outline-color: var(--button-bg);
}

/* Header and footer */
.site-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: calc(var(--gutter) / 2) var(--gutter);
  padding: var(--gutter);
  border-block-end: 1px solid var(--hairline);
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gutter);
  margin-inline-start: auto;
}

.site-header nav a,
.site-footer nav a {
  position: relative;
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: var(--track-button);
  text-transform: uppercase;
  text-decoration: none;
}

/* Small links still get a 44px target (web-css: hit area larger than the visual) */
.site-header nav a::after,
.site-footer nav a::after {
  content: '';
  position: absolute;
  inset: min(0px, (100% - 44px) / 2);
}

.site-header nav a[aria-current='page'] {
  color: var(--accent);
}

.brand {
  flex: none;
  display: block;
}

.brand img {
  inline-size: calc(var(--gutter) * 4);
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: calc(var(--gutter) * 0.75);
  padding: var(--section-gap-sm) var(--gutter);
  border-block-start: 1px solid var(--hairline);
  text-align: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gutter);
}

.site-footer .mark {
  flex: none;
}

.site-footer .line {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--voice);
}

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

/* Type roles */
.eyebrow {
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow a {
  text-decoration: none;
}

h1 {
  font-size: var(--hero-display-sm);
}

h2 {
  font-size: var(--section-title-sm);
}

h3 {
  font-size: var(--card-title);
}

.lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--voice);
  color: var(--muted);
}

@container page (inline-size > 720px) {
  h1 {
    font-size: var(--hero-display);
  }

  h2 {
    font-size: var(--section-title);
  }
}

main {
  container: page / inline-size;
}

/* App Store placeholder: an outlined note, not a button (no listing yet) */
.app-store {
  justify-self: start;
  padding: calc(var(--gutter) / 2) var(--gutter);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: var(--track-button);
  text-transform: uppercase;
}

/* Hero: copy above the phones on a phone, beside them on a wide screen */
.hero {
  padding-block-start: var(--section-gap-sm);
  align-items: center;
}

@container page (inline-size > 960px) {
  .hero > .hero-copy {
    grid-row: 1;
    justify-self: start;
    max-inline-size: calc(var(--content) - var(--phone-width) * 2 - var(--gutter) * 3);
  }

  .hero > .phones {
    grid-column: content;
    grid-row: 1;
    justify-self: end;
    margin-block-start: 0;
  }
}

.hero-copy {
  display: grid;
  gap: var(--gutter);
  justify-items: start;
  max-inline-size: var(--prose);
}

.phones {
  display: flex;
  justify-content: center;
  align-items: start;
  gap: var(--gutter);
  margin-block-start: var(--gutter);
}

.phone-figure {
  flex: 0 1 var(--phone-width);
  display: grid;
  gap: var(--gutter);
  margin: 0;
}

.phone-figure + .phone-figure {
  margin-block-start: calc(var(--gutter) * 2);
}

.phone {
  padding: var(--phone-bezel);
  border-radius: var(--phone-radius);
  background: var(--phone-edge);
  border: 1px solid var(--hairline-strong);
}

.phone img {
  inline-size: 100%;
  border-radius: var(--phone-screen-radius);
}

.phone-figure figcaption {
  font-family: var(--serif);
  font-size: var(--voice);
  line-height: var(--lh-display);
  text-align: center;
}

.phone-figure .who {
  display: block;
  font-family: var(--sans);
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--muted);
  margin-block-end: calc(var(--gutter) / 4);
}

/* How it works: an intrinsic grid of three steps */
.how,
.closing {
  background: var(--surface);
  border-block: 1px solid var(--hairline);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gutter);
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(100%, calc(var(--phone-width) - var(--gutter))), 1fr)
  );
}

.step {
  display: grid;
  gap: calc(var(--gutter) / 2);
  align-content: start;
  padding-block-start: var(--gutter);
  border-block-start: 1px solid var(--hairline-strong);
}

.step-no {
  font-family: var(--serif);
  font-size: var(--section-title-sm);
  color: var(--accent);
}

.step p {
  color: var(--muted);
}

/* Privacy promise */
.privacy {
  text-align: center;
  justify-items: center;
}

.privacy > * {
  max-inline-size: var(--prose);
}

.signature {
  font-family: var(--serif);
  font-size: var(--card-title);
  color: var(--accent);
}

.closing {
  justify-items: center;
  text-align: center;
}

.closing .app-store {
  justify-self: center;
}

/* Guides */
.disclosure {
  font-size: var(--small);
  color: var(--muted);
  padding-block: calc(var(--gutter) / 2);
  border-block: 1px solid var(--hairline);
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gutter);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--phone-width)), 1fr));
}

.card {
  position: relative;
  display: grid;
  gap: calc(var(--gutter) / 2);
  align-content: start;
  padding: var(--gutter);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.card h2 {
  font-size: var(--card-title);
}

.card-link {
  text-decoration: none;
}

/* Whole card clickable from one link (web-css interaction) */
.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.card-link:focus-visible {
  outline: 2px solid transparent;
}

.card:has(.card-link:focus-visible) {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.card:has(.card-link:active) {
  transform: scale(var(--press-scale));
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform var(--press-ms) ease-out;
  }
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: var(--hairline-strong);
  }
}

.card p {
  color: var(--muted);
}

.card .more {
  font-size: var(--eyebrow);
  font-weight: 500;
  letter-spacing: var(--track-button);
  text-transform: uppercase;
  color: var(--accent);
}

/* Long-form pages (guides, legal) */
.page {
  padding-block-start: var(--section-gap-sm);
}

.prose h2 {
  margin-block-start: var(--gutter);
}

.prose ul,
.prose ol {
  margin: 0;
  padding-inline-start: var(--gutter);
  display: grid;
  gap: calc(var(--gutter) / 3);
}

.prose blockquote {
  margin: 0;
  padding-inline-start: var(--gutter);
  border-inline-start: 1px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--voice);
}

/* Legal drafts: placeholders stay visible until DJ fills them in */
.placeholder {
  padding-inline: calc(var(--gutter) / 8);
  background: var(--surface-alt);
  color: var(--accent);
  font-family: var(--sans);
  font-size: var(--small);
  border-radius: var(--radius);
}

.prose hr {
  inline-size: 100%;
  border: 0;
  border-block-start: 1px solid var(--hairline);
}

.prose blockquote > * + * {
  margin-block-start: calc(var(--gutter) / 2);
}

.prose blockquote:has(ul) {
  padding: var(--gutter);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--sans);
  font-style: normal;
  font-size: var(--body);
}

/* A wide table scrolls inside its own box instead of the page */
.table {
  overflow-x: auto;
  border: 1px solid var(--hairline);
}

.table table {
  border-collapse: collapse;
  font-size: var(--small);
}

.table :is(th, td) {
  padding: calc(var(--gutter) / 3) calc(var(--gutter) / 2);
  text-align: start;
  vertical-align: top;
  border-block-end: 1px solid var(--hairline);
}

.table th {
  font-weight: 500;
  white-space: nowrap;
}
