/* =============================================================================
   Sangfroid — sangfroid.app

   The tokens here are transcribed from DESIGN.md / src/ui/tokens.ts so the site
   and the app are recognisably the same object. Dark only, same as the app (§1).

   Two rules this file exists to honour:
     · No third-party requests. Satoshi is self-hosted, there is no analytics
       script, no CDN, no embedded video. A site for a privacy-first app must not
       leak its visitors' IPs to Google Fonts on page load — which in Germany is
       not merely impolite (LG München I, 3 O 17493/20).
     · No fixed-width text containers. FR runs ~13% longer than EN, DE ~14% and
       unhyphenatable; `hyphens: auto` plus the `lang` attribute does the work.
   ============================================================================= */

@font-face {
  font-family: 'Satoshi';
  /* Variable, 300–900 on the wght axis — one file for the whole site. */
  src: url('/fonts/Satoshi-Variable.woff2') format('woff2-variations');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* §2 Colour */
  --base: #0e0e11;
  --surface: #16161a;
  --surface-high: #1e1e24;
  --line: #26262d;
  --ink: #edebe7;
  --ink-muted: #9c9a96;
  --ink-faint: #5e5c5a;
  --amber: #e8a33d;
  --amber-dim: #8a6224;
  --amber-wash: rgba(232, 163, 61, 0.12);

  /* §4 Layout */
  --measure: 34rem;      /* prose column — ~66 characters */
  --gutter: clamp(1.5rem, 5vw, 4.5rem);
  --margin-col: 9.5rem;  /* the editorial left margin holding labels + numerals */
  --shell: 66rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ----------------------------------------------------------------- reset ---- */

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

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

body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: 'Satoshi', ui-sans-serif, system-ui, sans-serif;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Warm, near-invisible grain. Without it a flat #0E0E11 field reads as a dead
   pixel on OLED; with it the page has a surface. 3.5% opacity, no animation. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a {
  color: inherit;
  text-decoration: none;
}

/* -------------------------------------------------------------- typography -- */

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

/* Light weight at large sizes. The app's `display` token is 300, and at this
   scale it is what separates composed from shouting. */
.display {
  font-size: clamp(2.5rem, 7.2vw, 5rem);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.375rem);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.lede {
  font-size: clamp(1.125rem, 1.9vw, 1.375rem);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: -0.012em;
  color: var(--ink-muted);
  max-width: 30rem;
}

.label {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
}
.faint {
  color: var(--ink-faint);
}
.small {
  font-size: 0.875rem;
  line-height: 1.55;
}

/* German compounds (Datenschutzerklärung) must be allowed to break; every
   locale gets hyphenation from its own `lang`. */
p,
li,
dd,
.h2,
.display,
.h3 {
  hyphens: auto;
  overflow-wrap: break-word;
}

/* --------------------------------------------------------------- the spine -- */

/*
 * A 1px plumb line down the left edge, with an amber segment that tracks scroll
 * position. It is the page's one ornament and its only progress indicator.
 * Scroll-driven, no JS; where `animation-timeline` is unsupported the line is
 * simply static, which is fine.
 */
.spine {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--gutter) / 2);
  width: 1px;
  background: var(--line);
  z-index: 2;
  pointer-events: none;
}

.spine__fill {
  position: absolute;
  inset: 0 0 auto 0;
  height: 100%;
  background: linear-gradient(to bottom, var(--amber-dim), var(--amber));
  transform-origin: top;
  transform: scaleY(0);
}

@supports (animation-timeline: scroll()) {
  .spine__fill {
    animation: spine-grow linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes spine-grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@media (max-width: 52rem) {
  .spine {
    display: none;
  }
}

/* ----------------------------------------------------------------- layout --- */

.shell {
  position: relative;
  z-index: 1;
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/*
 * The editorial two-column: a narrow left margin for section labels and step
 * numerals, main content beside it. Collapses to one column early — the margin
 * column is an affordance, never load-bearing.
 */
.row {
  display: grid;
  grid-template-columns: var(--margin-col) minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 4vw, 3rem);
}

@media (max-width: 52rem) {
  .row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }
}

section {
  padding-block: clamp(4rem, 9vw, 8rem);
  border-top: 1px solid var(--line);
}

section:first-of-type {
  border-top: 0;
}

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

/* ------------------------------------------------------------------- nav ---- */

.masthead {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 1.75rem;
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* The one flourish on the wordmark: an amber full stop. */
.wordmark::after {
  content: '.';
  color: var(--amber);
}

.masthead nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  flex-wrap: wrap;
}

.masthead nav a {
  font-size: 0.875rem;
  color: var(--ink-muted);
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.masthead nav a:hover,
.masthead nav a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--amber);
}

/* ------------------------------------------------------------------ hero ---- */

.hero {
  padding-block: clamp(3rem, 8vw, 7rem) clamp(4rem, 9vw, 8rem);
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
  border-top: 0;
}

@media (max-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hero__eyebrow {
  margin-bottom: 1.75rem;
}

.hero .display {
  margin-bottom: 1.75rem;
}

.hero__actions {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.875rem;
}

/* ---------------------------------------------------------------- button ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.9375rem 1.5rem;
  border-radius: 999px;
  background: var(--amber);
  color: #17130b;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  min-height: 3rem;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease),
    background-color 0.2s var(--ease);
}

.btn:hover,
.btn:focus-visible {
  background: #f2b055;
  transform: translateY(-1px);
  box-shadow: 0 0.75rem 2rem -0.5rem rgba(232, 163, 61, 0.45);
}

.btn:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: transparent;
  border-color: var(--amber-dim);
  box-shadow: none;
}

/* An inline text link that reads as a link without shouting. */
.link {
  display: inline-block;
  color: var(--amber);
  font-weight: 600;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--amber-dim);
  padding-bottom: 1px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.link:hover,
.link:focus-visible {
  border-bottom-color: var(--amber);
}

/* ----------------------------------------------------------------- breath ---- */

/*
 * The panic flow's breathing pacer, rendered as the page's only motion: four
 * seconds in, six out, ten to the cycle. It is the product's core gesture and
 * the one thing here that should be remembered.
 */
.breath {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: min(100%, 22rem);
  margin-inline: auto;
}

.breath__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--amber-dim);
  opacity: 0;
  transform: scale(0.28);
  animation: breath-out 10s var(--ease) infinite;
}

.breath__ring:nth-child(2) {
  animation-delay: -3.333s;
}
.breath__ring:nth-child(3) {
  animation-delay: -6.666s;
}

.breath__core {
  position: relative;
  width: 28%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(232, 163, 61, 0.9), var(--amber-dim) 68%, transparent 72%);
  animation: breath-core 10s var(--ease) infinite;
}

/* The figure wrapping the pacer: label above, caption below, both in the margin
   voice so the whole thing reads as an instrument rather than a decoration. */
.breath-fig {
  margin: 0;
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  text-align: center;
}

.closing {
  display: grid;
  justify-items: start;
  gap: 1.75rem;
  max-width: 40rem;
}

.closing .small {
  max-width: 26rem;
}

@keyframes breath-out {
  0% {
    opacity: 0;
    transform: scale(0.28);
  }
  12% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* 4s expand, 6s release — the asymmetry is the point. */
@keyframes breath-core {
  0% {
    transform: scale(0.86);
  }
  40% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(0.86);
  }
}

/* ------------------------------------------------------------------ lists --- */

/* Hairline-separated rows rather than a grid of rounded cards. */
.stack {
  display: grid;
  gap: 0;
}

.stack > * + * {
  border-top: 1px solid var(--line);
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  padding-block: clamp(1.5rem, 3vw, 2.25rem);
}

.item:first-child {
  padding-top: 0;
}

.item p {
  color: var(--ink-muted);
  max-width: var(--measure);
}

/* The numeral in the margin, tabular so 1/2/3 sit on the same axis. */
.item__num {
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
}

.section__head {
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section__label {
  padding-top: 0.4rem;
}

@media (max-width: 52rem) {
  .section__label {
    padding-top: 0;
    margin-bottom: 0.75rem;
  }
}

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

.faq {
  display: grid;
  gap: 0;
  max-width: 44rem;
}

.faq > * + * {
  border-top: 1px solid var(--line);
}

.faq__item {
  padding-block: clamp(1.5rem, 3vw, 2rem);
}

.faq__item:first-child {
  padding-top: 0;
}

.faq__q {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.625rem;
  letter-spacing: -0.005em;
}

.faq__a {
  color: var(--ink-muted);
  max-width: var(--measure);
}

/* ------------------------------------------------------------------ notes --- */

/* The crisis block. Amber-washed, unmissable, never decorative. */
.callout {
  border: 1px solid var(--amber-dim);
  background: var(--amber-wash);
  border-radius: 1rem;
  padding: clamp(1.5rem, 3vw, 2rem);
  max-width: 44rem;
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}

/* ------------------------------------------------------------- legal pages -- */

.doc {
  max-width: var(--measure);
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(4rem, 9vw, 7rem);
}

.doc__title {
  margin-bottom: 0.5rem;
}

.doc__updated {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.doc h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.doc p {
  color: var(--ink-muted);
  margin-bottom: 1.125rem;
}

/* The policies use "- " bullets in the source strings; keep them as real list
   items so screen readers announce the count. */
.doc ul {
  list-style: none;
  padding: 0;
  margin-bottom: 1.125rem;
  display: grid;
  gap: 0.625rem;
}

.doc li {
  color: var(--ink-muted);
  padding-left: 1.125rem;
  position: relative;
}

.doc li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.4rem;
  height: 1px;
  background: var(--amber-dim);
}

/* ---------------------------------------------------------------- footer ---- */

footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 6vw, 4.5rem) 3rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.footer__col {
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.footer__col a {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  transition: color 0.2s var(--ease);
  width: fit-content;
}

.footer__col a:hover,
.footer__col a:focus-visible {
  color: var(--ink);
}

.footer__col a[aria-current='true'] {
  color: var(--ink);
}

.footer__col a[aria-current='true']::before {
  content: '— ';
  color: var(--amber);
}

.footer__base {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: baseline;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

/* -------------------------------------------------------------- 404 / misc -- */

.center-page {
  min-height: 68vh;
  display: grid;
  align-content: center;
  gap: 1.25rem;
  justify-items: start;
  padding-block: 4rem;
}

/* ------------------------------------------------------------ page-in load -- */

/*
 * One orchestrated entrance, staggered, then the page is still. `--i` carries
 * the index so the delay is declarative in the markup.
 */
.rise {
  animation: rise 0.7s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.625rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------- a11y & preferences -- */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface-high);
  color: var(--ink);
  padding: 0.75rem 1rem;
  z-index: 10;
  border-radius: 0 0 0.5rem 0;
}

.skip:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/*
 * DESIGN.md §254: Reduce Motion is honoured, not partially honoured. The breath
 * holds at rest, the spine stops tracking, nothing rises on load.
 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .breath__ring {
    opacity: 0.5;
    transform: scale(0.64);
  }

  .breath__ring:nth-child(2) {
    transform: scale(0.82);
  }

  .breath__ring:nth-child(3) {
    transform: scale(1);
  }

  .spine__fill {
    display: none;
  }
}

@media print {
  body::before,
  .spine,
  .breath {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
  .doc p,
  .doc li,
  .muted,
  .faint {
    color: #222;
  }
}
