/* Sonivault website. Colours are the iOS app's Theme tokens
   (ProducerPractice/Utilities/Theme.swift), so the site and app match. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-sans-latin.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  --canvas: #0a0e1a;
  --surface: #141b2e;
  --surface-raised: #1b2439;
  --hairline: #2a3344;
  --text: #f2f4f8;
  --text-2: #a3acbd;
  --text-3: #8b95a8;
  --accent: #16db65;
  --accent-ink: #0a0e1a;
  --amber: #f59e0b;
  --pink: #ed4d9c;
  --pink-soft: #f472b6;
  --focus: #f2f4f8;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 6.5rem;

  --radius: 16px;
  --radius-sm: 12px;
  --max: 72rem;
  --gutter: 1rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

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

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--gutter);
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
  }
}

/* Mono labels echo the app's monospaced step numbers and readouts. */
.label {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(10 14 26 / 0.92);
  border-bottom: 1px solid var(--hairline);
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: rgb(10 14 26 / 0.8);
    backdrop-filter: blur(12px);
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 var(--space-2);
  min-height: 4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  color: var(--text);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.625rem;
  color: var(--text-2);
  font-size: 0.9375rem;
  text-decoration: none;
  border-radius: 8px;
  transition: color 150ms ease-out;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: 0;
}

/* Phones: brand on its own row, the three links as a full-width row
   beneath it. The header scrolls away instead of sticking, so two rows
   never cover the content. */
@media (max-width: 29.99rem) {
  html {
    scroll-padding-top: 1rem;
  }
  .site-header {
    position: static;
  }
  .site-header .wrap {
    min-height: 0;
  }
  .brand {
    min-height: 56px;
  }
  .site-nav {
    flex-basis: 100%;
    border-top: 1px solid var(--hairline);
  }
  .site-nav ul {
    justify-content: space-between;
  }
  .site-nav li:first-child a {
    padding-left: 0;
  }
  .site-nav li:last-child a {
    padding-right: 0;
  }
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}

.button--primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button--primary:hover {
  background: #3ee581;
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--hairline);
}

.button--ghost:hover {
  border-color: var(--text-3);
}

/* ---------- Status pill ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.875rem;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex: none;
}

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

.hero {
  position: relative;
  padding-block: var(--space-5) var(--space-6);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 60rem;
  height: 60rem;
  background: radial-gradient(closest-side, rgb(22 219 101 / 0.1), transparent);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.5rem + 3.6vw, 3.75rem);
  font-weight: 700;
  margin-block: var(--space-3) var(--space-3);
  max-width: 16ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.lede {
  font-size: 1.125rem;
  color: var(--text-2);
  max-width: 36rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-4);
}

.hero-figure {
  justify-self: center;
  margin: 0;
}

@media (min-width: 60rem) {
  .hero {
    padding-block: clamp(2rem, 6vh, 4rem) var(--space-7);
    padding-block-start: clamp(2rem, 6svh, 4rem);
  }
  .hero .wrap {
    grid-template-columns: 1.15fr 0.85fr;
  }
  /* Scale with the viewport's height so the whole device, with its frame,
     fits below the sticky header on a 1280x720 laptop screen. */
  .hero h1 {
    font-size: clamp(2.75rem, 7.5vh, 3.75rem);
    font-size: clamp(2.75rem, 7.5svh, 3.75rem);
  }
  .hero .phone {
    width: auto;
    height: clamp(30rem, calc(100vh - 9rem), 40rem);
    height: clamp(30rem, calc(100svh - 9rem), 40rem);
  }
}

/* Phone screenshots. Real captures from the current build. */
.phone {
  width: min(18.5rem, 78vw);
  aspect-ratio: 600 / 1304;
  border-radius: 2.4rem;
  border: 1px solid var(--hairline);
  background: var(--surface);
  box-shadow:
    0 0 0 6px #05070d,
    0 0 0 7px var(--hairline),
    0 30px 80px -30px rgb(22 219 101 / 0.25);
  overflow: hidden;
}

.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Step sequencer divider (decorative) ---------- */

.steps-row {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  max-width: 26rem;
  margin-top: var(--space-4);
}

.steps-row span {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
}

.steps-row span.on {
  background: var(--accent);
  border-color: var(--accent);
}

.steps-row span.off-beat {
  background: rgb(22 219 101 / 0.35);
  border-color: transparent;
}

/* ---------- Readout (content numbers) ---------- */

.readout {
  border-block: 1px solid var(--hairline);
  background: var(--surface);
}

.readout dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.readout div {
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--hairline);
}

.readout div:nth-child(odd) {
  border-right: 1px solid var(--hairline);
}

.readout dt {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.readout dd {
  margin: 0 0 0.25rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.readout div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
}

@media (min-width: 48rem) {
  .readout dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .readout div {
    border-bottom: 0;
    border-right: 1px solid var(--hairline);
    padding-inline: var(--space-3);
  }
  .readout div:last-child {
    border-right: 0;
  }
}

@media (max-width: 47.99rem) {
  .readout div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

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

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

.section-head {
  max-width: 40rem;
  margin-bottom: var(--space-5);
}

.section-head h2,
.feature-title {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  margin-top: 0.75rem;
}

.section-head p {
  margin-top: var(--space-2);
  color: var(--text-2);
  font-size: 1.0625rem;
}

/* Features: one per app tab, each with a real screenshot. */
.feature {
  display: grid;
  gap: var(--space-4);
  align-items: center;
  padding-block: var(--space-5);
  border-top: 1px solid var(--hairline);
}

.feature:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.feature-copy p {
  margin-top: var(--space-2);
  color: var(--text-2);
  max-width: 34rem;
}

.facts {
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.625rem;
  max-width: 34rem;
}

.facts li {
  position: relative;
  padding-left: 1.5rem;
}

.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--accent);
}

.feature figure {
  margin: 0;
  justify-self: center;
}

/* Supporting screenshots are smaller than the hero device on phones, so
   four of them don't dominate the scroll. */
.feature .phone {
  width: min(15rem, 66vw);
  border-radius: 2rem;
}

@media (min-width: 60rem) {
  .feature .phone {
    width: min(18.5rem, 78vw);
    border-radius: 2.4rem;
  }
}

.feature figcaption {
  margin-top: var(--space-2);
  color: var(--text-3);
  font-size: 0.875rem;
  text-align: center;
}

@media (min-width: 60rem) {
  .feature {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }
  .feature:nth-of-type(even) figure {
    order: -1;
  }
}

/* ---------- Sample question ---------- */

.question {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-3);
  max-width: 40rem;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--space-2);
}

.tag {
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  color: var(--pink-soft);
  background: rgb(237 77 156 / 0.14);
}

.tag--level {
  color: var(--accent);
  background: rgb(22 219 101 / 0.12);
}

.question fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.question legend {
  padding: 0;
  font-size: 1.1875rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.options {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  overflow: hidden;
}

/* Mirrors the app's answer list: plain rows, a checkmark on the chosen
   one. The radio input stays in the DOM for keyboard and screen readers. */
.option {
  position: relative;
}

.option + .option {
  border-top: 1px solid var(--hairline);
}

.option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.option label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 150ms ease-out;
}

.option label:hover {
  background: rgb(242 244 248 / 0.04);
}

.option input:checked + label {
  background: rgb(22 219 101 / 0.07);
}

.option input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
  border-radius: 0;
}

.check {
  flex: none;
  width: 22px;
  height: 22px;
  visibility: hidden;
}

.check circle {
  fill: var(--accent);
}

.check path {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.option input:checked + label .check {
  visibility: visible;
}

/* Answer locked after Submit, as in the app. */
.question fieldset:disabled label {
  cursor: default;
}

.question fieldset:disabled label:hover {
  background: none;
}

.question fieldset:disabled input:not(:checked) + label {
  color: var(--text-3);
}

.question fieldset:disabled input:checked + label {
  background: rgb(22 219 101 / 0.07);
}

.question-actions {
  margin-top: var(--space-3);
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.button:disabled {
  cursor: not-allowed;
  background: var(--surface-raised);
  color: var(--text-3);
  border-color: var(--hairline);
}

.feedback {
  margin-top: var(--space-2);
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  background: var(--surface-raised);
}

.feedback:focus-visible {
  outline-offset: 2px;
}

.feedback-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--accent);
}

.feedback-title::before {
  content: "\2713";
  content: "\2713" / "";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 700;
}

.feedback[data-state="incorrect"] {
  border-left-color: var(--pink-soft);
}

.feedback[data-state="incorrect"] .feedback-title {
  color: var(--pink-soft);
}

.feedback[data-state="incorrect"] .feedback-title::before {
  content: "\2715";
  content: "\2715" / "";
  background: var(--pink-soft);
}

.feedback-text {
  margin-top: 0.25rem;
  color: var(--text-2);
}

.question-note {
  margin-top: var(--space-2);
  max-width: 40rem;
  color: var(--text-3);
  font-size: 0.9375rem;
}

.answer-fallback summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--accent);
  font-weight: 600;
}

.answer-fallback p {
  color: var(--text-2);
}

.js .answer-fallback {
  display: none;
}

.js-only {
  display: none;
}

.js .js-only {
  display: flex;
}

.panel-link {
  margin-top: var(--space-3);
}

/* ---------- Callouts ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-3);
}

@media (min-width: 48rem) {
  .panel {
    padding: var(--space-5);
  }
}

.panel h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.125rem);
  margin-top: 0.75rem;
}

.panel > p {
  margin-top: var(--space-2);
  color: var(--text-2);
  max-width: 44rem;
}

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

@media (min-width: 60rem) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Long-form pages (support, privacy) ---------- */

.page-head {
  padding-block: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--hairline);
}

.page-head h1 {
  font-size: clamp(2rem, 1.5rem + 2.4vw, 3rem);
  margin-top: 0.75rem;
}

.page-head p {
  margin-top: var(--space-2);
  color: var(--text-2);
  max-width: 40rem;
  font-size: 1.0625rem;
}

.prose {
  max-width: 44rem;
  padding-block: var(--space-4) var(--space-6);
}

.prose h2 {
  font-size: 1.5rem;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.prose h3 {
  font-size: 1.125rem;
  margin-top: var(--space-4);
  margin-bottom: var(--space-1);
}

.prose p,
.prose ul,
.prose ol {
  margin-block: 0 var(--space-2);
  color: var(--text-2);
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose strong {
  color: var(--text);
}

.contact-card {
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.contact-card .email {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 0.9rem + 0.8vw, 1.375rem);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.faq details {
  border-top: 1px solid var(--hairline);
}

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

.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  min-height: 56px;
  padding-block: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  content: "+" / "";
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--accent);
  flex: none;
}

.faq details[open] summary::after {
  content: "\2212";
  content: "\2212" / "";
}

.faq details > div {
  padding-bottom: var(--space-2);
}

/* Privacy statements awaiting the owner's confirmation. Visible on
   purpose, and scripts/check.py --release refuses to pass while any
   remain. */
.confirm {
  background: rgb(245 158 11 / 0.16);
  color: #fcd38a;
  border-bottom: 1px dashed var(--amber);
  padding: 0 0.15em;
}

.draft-banner {
  margin-top: var(--space-3);
  padding: 1rem 1.25rem;
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  background: rgb(245 158 11 / 0.08);
  color: var(--text);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-block: var(--space-2) var(--space-3);
  font-size: 0.9375rem;
}

.summary-table th,
.summary-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--hairline);
}

.summary-table th {
  color: var(--text);
  font-weight: 600;
}

.summary-table td {
  color: var(--text-2);
}

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

.site-footer {
  border-top: 1px solid var(--hairline);
  padding-block: var(--space-4);
  color: var(--text-3);
  font-size: 0.9375rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  justify-content: space-between;
  align-items: center;
}

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

.site-footer a {
  overflow-wrap: anywhere;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text-2);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .steps-row span.on,
  .facts li::before {
    background: CanvasText;
  }
  .confirm {
    border-bottom-style: solid;
  }
}
