/*
  Baristary website. Plain CSS, no framework, no scripts, light only.
  Every colour, font and motion value comes from motion/MOTION.md (mode Calm) and docs/design-v2/DESIGN_V2.md.
*/

/* ---------- Fonts: Geist (SIL Open Font License, fonts/OFL.txt), subset to Latin ---------- */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/Geist-Medium.woff") format("woff"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist"; src: url("fonts/Geist-SemiBold.woff") format("woff"); font-weight: 600; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* MOTION.md §1 */
  --bg: #F7F1E8;
  --surf: #FFFDF9;
  --line: #E8DDCE;
  --text: #241B17;
  --muted: #7D6E62;
  --acc: #A8703F;
  --crema: #C58D5A;
  --ring: #D8C7B2;

  /* Type: five steps. Geist only, no italics (MOTION.md §2). */
  --t-display: clamp(2.75rem, 1.55rem + 3.4vw, 4.5rem);
  --t-head: clamp(1.625rem, 1.25rem + 1vw, 2.125rem);
  --t-lead: 1.25rem;
  --t-body: 1.0625rem;
  --t-small: 0.9375rem;
  --track-head: -0.02em;

  /* Motion (MOTION.md §3, §4) */
  --enter: cubic-bezier(0.22, 1, 0.36, 1);
  --exit: cubic-bezier(0.4, 0, 1, 1);
  --t-enter: 0.5s;
  --t-exit: 0.4s;

  /* Finish (MOTION.md §5) */
  --r-card: 18px;

  /* Frame */
  --gutter: clamp(20px, 4vw, 64px);
  --max: 1440px;
  --gap-section: clamp(96px, 12vw, 176px);
  --bar: 72px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--t-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-weight: 500; letter-spacing: var(--track-head); text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
strong { font-weight: 600; }
::selection { background: var(--line); color: var(--text); }

a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-decoration-color: var(--crema); text-underline-offset: 0.22em; transition: text-decoration-color var(--t-enter) var(--enter), color var(--t-enter) var(--enter); }
a:hover { text-decoration-color: var(--text); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 10; background: var(--text); color: var(--surf); padding: 10px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }

/* Placeholders that only Tim can fill (developer name, address, contact email, dates). Visible on purpose. */
.ph { background: var(--line); color: var(--text); border-radius: 6px; padding: 0.05em 0.35em; font-weight: 500; white-space: nowrap; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- Bar ---------- */
.bar { height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark { font-size: 1.625rem; font-weight: 500; letter-spacing: var(--track-head); text-decoration: none; line-height: 1; }
.bar nav { display: flex; gap: clamp(16px, 2.4vw, 36px); font-size: var(--t-small); }
.bar nav a { text-decoration: none; padding: 10px 0; text-decoration-line: underline; text-decoration-color: transparent; }
.bar nav a:hover, .bar nav a[aria-current="page"] { text-decoration-color: var(--crema); }
@media (max-width: 520px) { .bar nav .wide { display: none; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 26px; border-radius: 999px;
  background: var(--text); color: var(--surf);
  font-weight: 500; font-size: var(--t-body); text-decoration: none; letter-spacing: -0.005em;
  transition: transform 0.2s var(--enter), background-color var(--t-enter) var(--enter);
}
.btn:hover { background: #3A2C25; color: var(--surf); }
.btn:active { transform: scale(0.98); }

.note { font-size: var(--t-small); }

/* ---------- Hero ---------- */
.hero { display: grid; gap: 8px 48px; padding-top: 8px; }
.hero-text { display: flex; flex-direction: column; gap: 22px; align-self: center; }
.hero h1 { font-size: var(--t-display); line-height: 1.02; max-width: 12ch; }
.lead { font-size: var(--t-lead); line-height: 1.45; max-width: 30ch; }
.hero .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 10px; }

/* The Listen screen, built at the same scale and crop as the screenshots below (390 × 617 pt). */
.listen { width: 100%; max-width: 440px; margin-inline: auto; margin-top: -56px; }   /* the crop has empty space above the rings */
.listen svg { width: 100%; height: auto; overflow: visible; }
.listen text { font-family: "Geist", -apple-system, sans-serif; }
.ring { fill: none; stroke: var(--ring); stroke-width: 1.5; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; }
.rings-live .ring { opacity: 0; animation: ripple 3.6s ease-out infinite; }
.rings-live .ring:nth-child(2) { animation-delay: 1.2s; }
.rings-live .ring:nth-child(3) { animation-delay: 2.4s; }
.rings-still { display: none; }
@keyframes ripple {
  0% { transform: scale(0.505); opacity: 0; }
  8% { opacity: 0.7; }
  100% { transform: scale(1); opacity: 0; }
}

@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100svh - var(--bar)); padding-top: 0; }
  .hero-text { padding-bottom: 6svh; }
  .listen { max-width: none; margin-top: 0; height: min(calc(100svh - var(--bar) - 24px), 900px); display: flex; justify-content: center; }
  .listen svg { width: auto; height: 100%; }
}

/* ---------- How it works ---------- */
.how { margin-top: var(--gap-section); }
.how h2 { font-size: var(--t-display); line-height: 1.02; }
.steps { display: grid; gap: 64px; margin-top: 40px; }
.step { display: grid; gap: 20px; }
.step-text { display: grid; gap: 14px; }
.step h3 { font-size: var(--t-head); line-height: 1.15; }
.step p { max-width: 40ch; }
.shot { order: -1; width: min(100%, 340px); height: auto; margin-inline: auto; }
.how-stage { display: none; }

@media (min-width: 900px) {
  .steps { gap: 0; margin-top: 0; }
  .step { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; align-items: center; min-height: 100svh; }
  .shot { order: 0; width: auto; height: min(calc(100svh - 48px), 900px); max-width: 100%; object-fit: contain; }
}

/* Where the browser can tie animation to scroll (no script needed): one screen stays put on the right and
   crossfades to the stage each step describes. Elsewhere the screens simply sit next to their steps. */
@supports (animation-timeline: view()) and (timeline-scope: --a) {
  @media (min-width: 900px) {
    .how-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 48px; timeline-scope: --s1, --s2, --s3; }
    .how-body .steps { grid-column: 1; grid-row: 1; }
    .step { grid-template-columns: minmax(0, 1fr); min-height: 88svh; }
    .step .shot { display: none; }
    .step:nth-child(1) { view-timeline: --s1 block; }
    .step:nth-child(2) { view-timeline: --s2 block; }
    .step:nth-child(3) { view-timeline: --s3 block; }
    /* MOTION.md scene rhythm on scroll: exit (0.4) → pause on bg (0.3) → enter (0.5). Steps are 88svh tall. While the
       border between two steps passes 62% → 38% of the viewport height, the old screen fades out (62 → 54, ease-in),
       nothing but bg shows (54 → 48), the new screen fades in (48 → 38, ease-out). For one screen that is its step's
       cover range 27.7% → 71.3%; the fades are the first 12.2% and the last 9.8% of it. */
    .how-stage { display: block; grid-column: 2; grid-row: 1; align-self: start; position: sticky; top: 0; height: 100svh; }
    .how-stage img { position: absolute; inset: 0; margin: auto; width: auto; height: min(calc(100svh - 48px), 900px); max-width: 100%; object-fit: contain; opacity: 0; animation: crossfade auto linear both; animation-range: cover 27.7% cover 71.3%; }
    .how-stage img:nth-child(1) { animation-name: fade-out; animation-timeline: --s1; }
    .how-stage img:nth-child(2) { animation-timeline: --s2; }
    .how-stage img:nth-child(3) { animation-name: fade-in; animation-timeline: --s3; }
  }
}
@keyframes crossfade {
  0% { opacity: 0; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  12.2% { opacity: 1; }
  90.2% { opacity: 1; animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
  100% { opacity: 0; }
}
@keyframes fade-out {
  0% { opacity: 1; }
  90.2% { opacity: 1; animation-timing-function: cubic-bezier(0.4, 0, 1, 1); }
  100% { opacity: 0; }
}
@keyframes fade-in {
  0% { opacity: 0; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  12.2% { opacity: 1; }
  100% { opacity: 1; }
}

/* ---------- Private by design (a full-width field) ---------- */
.field { background: var(--surf); margin-top: var(--gap-section); padding-block: clamp(80px, 10vw, 144px); }
.field-grid { display: grid; gap: 40px 48px; }
.field h2 { font-size: var(--t-display); line-height: 1.02; max-width: 9ch; }
.points { list-style: none; padding: 0; display: grid; gap: 28px; font-size: var(--t-lead); line-height: 1.45; }
.points li { max-width: 36ch; }
.field .more { margin-top: 36px; }
@media (min-width: 900px) {
  .field-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

/* ---------- Made for dialing in ---------- */
.dial { margin-top: var(--gap-section); display: grid; gap: 40px 48px; }
.dial h2 { font-size: var(--t-head); line-height: 1.15; }
.dial dl { display: grid; gap: 32px 48px; }
.dial dt { font-weight: 500; font-size: var(--t-lead); letter-spacing: -0.01em; }
.dial dd { margin-top: 6px; max-width: 38ch; }
@media (min-width: 700px) { .dial dl { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) {
  .dial { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1100px) {
  .dial { grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); }
}

/* ---------- Good to know + the closing action ---------- */
.close { margin-top: var(--gap-section); padding-bottom: var(--gap-section); display: grid; gap: 64px 48px; }
.close h2 { font-size: var(--t-head); line-height: 1.15; }
.close .facts { display: grid; gap: 16px; max-width: 46ch; }
.close .facts h2 { margin-bottom: 8px; }
.ask { display: grid; gap: 24px; align-content: start; }
.ask p { font-size: var(--t-lead); line-height: 1.45; max-width: 26ch; }
.ask .btn { justify-self: start; }
@media (min-width: 900px) {
  .close { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- Footer: the cup with crema, cropped large, beside the menu ---------- */
.foot { background: var(--surf); overflow: hidden; }
.foot-grid { display: grid; }
.foot-cup { position: relative; height: 46svh; min-height: 280px; overflow: hidden; background: var(--bg); }
.foot-cup img { position: absolute; max-width: none; height: auto; width: 248%; left: -86%; top: 67%; transform: translateY(-50%); }
.foot-menu { padding: 48px var(--gutter) 40px; display: grid; gap: 40px; align-content: start; }
.foot-menu .wordmark { font-size: 1.25rem; justify-self: start; padding-block: 5px; margin-block: -5px; }
.foot-links { list-style: none; padding: 0; display: grid; gap: 14px; }
.foot-links a { font-size: var(--t-head); font-weight: 500; letter-spacing: var(--track-head); line-height: 1.15; text-decoration: none; display: inline-block; transition: transform var(--t-enter) var(--enter), color var(--t-enter) var(--enter); }
.foot-links a:hover { transform: translateX(8px); }
.foot-links:hover a:not(:hover) { color: var(--muted); }
.foot-contact { display: grid; gap: 6px; font-size: var(--t-small); color: var(--muted); }
.foot-contact strong { color: var(--text); font-weight: 500; }
/* Hit area ≥ 24 px (WCAG 2.5.8) without moving the text: padding offset by a negative margin. */
.foot-contact a { justify-self: start; padding-block: 3px; margin-block: -3px; }
.legal { font-size: var(--t-small); color: var(--muted); }
@media (min-width: 900px) {
  .foot-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 78svh; }
  .foot-cup { height: auto; min-height: 0; }
  .foot-cup img { width: 224%; left: -70%; top: 60%; }
  .foot-menu { padding: 72px var(--gutter) 40px 48px; grid-template-rows: auto 1fr auto auto; gap: 48px; }
  .foot-links { gap: 18px; align-self: start; }
}
@media (min-width: 1500px) { .foot-menu { padding-right: calc((100vw - var(--max)) / 2 + var(--gutter)); } }

/* ---------- Document pages (privacy, support, imprint) ---------- */
.doc { display: grid; gap: 40px 64px; padding-top: clamp(32px, 6vw, 88px); padding-bottom: var(--gap-section); }
.doc > * { grid-column: 1; min-width: 0; }
.doc-head { display: grid; gap: 20px; max-width: 64ch; align-content: start; }
.doc h1 { font-size: var(--t-display); line-height: 1.02; }
.doc-head .meta { font-size: var(--t-small); }
.doc-head .lead { font-size: var(--t-lead); line-height: 1.45; max-width: none; }
.prose { max-width: 64ch; }
.prose section { padding-top: 56px; }
.prose h2 { font-size: var(--t-head); line-height: 1.15; margin-bottom: 18px; }
.prose p, .prose ul, .prose ol { margin-bottom: 16px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin-bottom: 8px; padding-left: 0.2em; }
.prose li::marker { color: var(--crema); }
.prose address { font-style: normal; line-height: 1.7; }

/* A whole section that is still to come (privacy: "This website"). Visible on purpose, like .ph. */

/* Imprint: the publisher's details on a surface card, beside the heading on desktop. */
.publisher { background: var(--surf); border-radius: var(--r-card); padding: clamp(24px, 3vw, 40px); align-self: start; }
.publisher h2 { font-size: var(--t-lead); line-height: 1.35; letter-spacing: -0.01em; margin-bottom: 28px; }
.publisher dl { display: grid; gap: 24px 40px; }
.publisher dt { font-weight: 500; }
.publisher dd { margin-top: 4px; line-height: 1.75; }
@media (min-width: 700px) and (max-width: 959px) { .publisher dl { grid-template-columns: 1fr 1fr; } }

/* The side panel: a surface card that stays in view while the text scrolls (desktop). */
.aside { background: var(--surf); border-radius: var(--r-card); padding: clamp(24px, 3vw, 40px); align-self: start; }
.aside h2 { font-size: var(--t-head); line-height: 1.15; margin-bottom: 20px; }
.aside ul { list-style: none; padding: 0; display: grid; gap: 14px; }
.aside li { padding-left: 22px; position: relative; }
.aside li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--crema); }
.aside .toc li::before { display: none; }
.aside .toc li { padding-left: 0; }
.aside .toc a { text-decoration: none; }
.aside .toc a:hover { text-decoration: underline; text-decoration-color: var(--crema); }
.aside .note { margin-top: 24px; }

/* Questions on the support page */
.qa h2 { font-size: var(--t-lead); font-weight: 500; letter-spacing: -0.01em; line-height: 1.35; margin-bottom: 12px; }
.qa section { padding-top: 48px; }

@media (min-width: 960px) {
  .doc { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .doc > .aside { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 24px; max-height: calc(100svh - 48px); overflow: auto; }
  .doc > .publisher { grid-column: 2; grid-row: 1; }
}

/* ---------- 404: the listening cup, and nothing to hear ---------- */
.lost { display: grid; gap: 40px 48px; padding-top: clamp(24px, 5vw, 64px); padding-bottom: var(--gap-section); align-items: center; }
.lost-text { display: grid; gap: 22px; }
.lost h1 { font-size: var(--t-display); line-height: 1.02; max-width: 12ch; }
.lost .lead { max-width: 34ch; }
.lost-links { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.lost-links a { font-size: var(--t-head); font-weight: 500; letter-spacing: var(--track-head); line-height: 1.2; text-decoration: none; display: inline-block; transition: transform var(--t-enter) var(--enter), color var(--t-enter) var(--enter); }
.lost-links a:hover { transform: translateX(8px); }
.lost-links:hover a:not(:hover) { color: var(--muted); }
.lost-cup { width: min(100%, 360px); margin-inline: auto; }
.lost-cup svg { width: 100%; height: auto; overflow: visible; }
@media (min-width: 900px) {
  .lost { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100svh - var(--bar)); padding-bottom: 6svh; }
  .lost-cup { width: min(100%, 520px); }
}

/* ---------- Entrances (CSS only; the content is visible without them) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter { animation: rise var(--t-enter) var(--enter) both; }
  .enter-2 { animation-delay: 80ms; }
  .enter-3 { animation-delay: 160ms; }
  .enter-4 { animation-delay: 240ms; }
  .listen { animation: appear 0.9s var(--enter) 0.2s both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }

/* Reduce Motion: the rings stand still, as the app's own design shows them (DESIGN_V2 §6). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rings-live { display: none; }
  .rings-still { display: inline; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
