/*
 * Sleep Static — ss.vuba.one
 *
 * Tokens are the app's own (Sources/SleepStaticCore/Theme/ThemeTokens.swift): dark is the
 * default like the app, light follows the system. Rounded system font, soft 16–18px
 * corners, faint borders, one warm accent. No external fonts or images (CSP: 'self').
 * No inline style anywhere: the CSP forbids it, so every variant is a class.
 */

:root {
  --surface:   #1c1a16;
  --raised:    #262218;
  --well:      #0d0c0a;
  --accent:    #e9a23b;
  --accent-tx: #e9a23b;
  --text:      #cfc3ac;
  --secondary: #a79b86;
  --on-accent: #171410;
  --border:    #756b59;
  --error:     #ff8b7c;
  --line:      rgba(117, 107, 89, .35);
  --accent-soft: rgba(233, 162, 59, .14);
  --shadow:    0 18px 48px rgba(0, 0, 0, .35);
  --radius:    18px;
  --radius-sm: 12px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --surface:   #f2ede2;
    --raised:    #faf6ee;
    --well:      #ded7ca;
    --accent:    #d99428;
    --accent-tx: #8b4300;
    --text:      #29251f;
    --secondary: #625b50;
    --border:    #80786a;
    --error:     #af251b;
    --line:      rgba(128, 120, 106, .35);
    --accent-soft: rgba(217, 148, 40, .16);
    --shadow:    0 18px 48px rgba(60, 45, 20, .14);
    color-scheme: light;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-tx); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { color: var(--text); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(34px, 6vw, 56px); letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 18px; font-weight: 650; }
p  { margin: 0 0 1em; }

.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  padding-left:  max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ------------------------------------------------------------------ top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 22px 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand img { border-radius: 8px; display: block; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .28em; text-transform: none; color: var(--secondary); }
.spacer { flex: 1; }

.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: 14px;
  background: var(--raised); color: var(--text); font-size: 15px;
}
.langs summary::-webkit-details-marker { display: none; }
.langs[open] summary { box-shadow: inset 0 0 0 1px var(--line); }
.langs-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60; min-width: 190px;
  max-height: calc(100vh - 120px); overflow-y: auto; overscroll-behavior: contain;
  list-style: none; margin: 0; padding: 6px; border-radius: 16px;
  background: var(--raised); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
/* Fifteen languages: two columns once there is room, so the menu stays on screen. */
@media (min-width: 560px) {
  .langs-list { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); column-gap: 4px; }
}
.langs-list a { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--text); text-decoration: none; }
.langs-list a:hover { background: var(--accent-soft); }
.langs-list a[aria-current] { color: var(--accent-tx); font-weight: 650; }
.langs-list a[aria-current]::after { content: "✓"; margin-inline-start: auto; padding-inline-start: 10px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; border: 0;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-quiet { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn-soon { background: var(--raised); color: var(--secondary); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.btn-store .applemark { width: 26px; height: 26px; fill: currentColor; }
.lockup { display: flex; flex-direction: column; line-height: 1.1; text-align: start; }
.lockup small { font-size: 11px; font-weight: 500; }
.lockup strong { font-size: 19px; }

/* --------------------------------------------------------------------- hero */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center;
  padding: 40px 0 72px;
}
.eyebrow { color: var(--accent-tx); font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.lede { font-size: 19px; color: var(--secondary); max-width: 34em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 12px; }
.cta-note { font-size: 14px; color: var(--secondary); }

/* The deck mock-up: the app's Deck screen in miniature. */
.deck {
  margin: 0; padding: 22px; border-radius: 28px;
  background: var(--surface); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.deck-status {
  display: flex; align-items: center; gap: 10px; padding: 16px 18px; margin-bottom: 20px;
  border-radius: var(--radius); background: var(--raised); color: var(--secondary); font-size: 15px;
}
.deck-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--secondary); opacity: .8; }
.deck-timer { margin-inline-start: auto; color: var(--accent-tx); font-size: 22px; line-height: 1; font-weight: 700; }
.faders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; align-items: start; }
.fader { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
.fader .level { text-align: center; font-size: 13px; color: var(--accent-tx); font-variant-numeric: tabular-nums; }
.fader .track {
  position: relative; height: 210px; border-radius: 14px; overflow: hidden;
  background: var(--well); box-shadow: inset 0 0 0 1px var(--line);
}
.fader .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 14px; background: var(--accent); }
.fader .name {
  display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 52px;
  padding: 6px 4px; border-radius: 10px; text-align: center; font-size: 12.5px; line-height: 1.25;
  color: var(--text); box-shadow: inset 0 0 0 1px var(--line); overflow-wrap: anywhere;
}
.fader.is-muted .level, .fader.is-muted .name { color: var(--secondary); }
.fader.is-muted .fill { background: var(--border); opacity: .75; }
.lv-15 { height: 15%; } .lv-29 { height: 29%; } .lv-36 { height: 36%; } .lv-70 { height: 70%; } .lv-79 { height: 79%; }
.deck-actions { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 8px; margin-top: 18px; }
.pill {
  display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 8px;
  border-radius: 14px; background: var(--raised); color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden;
}
.pill-play { background: var(--accent); color: var(--on-accent); font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
  .fader .fill { animation: breathe 7s ease-in-out infinite; transform-origin: bottom; }
  .fader:nth-child(2) .fill { animation-delay: -1.4s; }
  .fader:nth-child(3) .fill { animation-delay: -2.8s; }
  .fader:nth-child(4) .fill { animation: none; }
  .fader:nth-child(5) .fill { animation-delay: -4.2s; }
  @keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.965); } }
}

/* ------------------------------------------------------------------ sections */
.section { padding: 56px 0; border-top: 1px solid var(--line); }
.section-lede { color: var(--secondary); max-width: 40em; margin-bottom: 28px; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.card { padding: 22px; border-radius: var(--radius); background: var(--raised); }
.card h3 { margin-top: 14px; }
.card p { color: var(--secondary); font-size: 15px; margin: 0; }
.card-ico {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent-tx); font-size: 20px;
}

.sound-groups { display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; }
.sound-group { padding: 24px; border-radius: var(--radius); background: var(--raised); }
.chips { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-static {
  padding: 8px 14px; border-radius: 999px; font-size: 15px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.hz-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.hz-lab { width: 100%; font-size: 14px; color: var(--secondary); }
.hz {
  min-width: 52px; padding: 6px 10px; border-radius: 10px; text-align: center; font-size: 14px;
  font-variant-numeric: tabular-nums; background: var(--well);
}
.hz-on { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.small { font-size: 14px; color: var(--secondary); margin: 0; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { display: flex; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--raised); }
.step p { color: var(--secondary); font-size: 15px; margin: 0; }
.step-n {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700;
}

.faq { display: grid; gap: 10px; max-width: 820px; }
.qa { border-radius: 16px; background: var(--raised); }
.qa summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 14px 20px; font-weight: 600;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; margin-inline-start: auto; color: var(--accent-tx); font-size: 22px; line-height: 1; }
.qa[open] summary::after { content: "−"; }
.qa p { padding: 0 20px 18px; margin: 0; color: var(--secondary); }

.panel {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px; border-radius: var(--radius); background: var(--raised); box-shadow: inset 0 0 0 1px var(--line);
}
.panel h2 { font-size: 24px; }
.panel p { color: var(--secondary); margin: 0; }
.panel-ok { margin: 8px 0 32px; }
.panel-ok p { color: var(--text); }

/* -------------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--secondary); font-size: 14px; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--text); }
.footer-brand img { border-radius: 7px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; }
.footer-legal { margin: 0 0 6px; }

/* ------------------------------------------------------------- doc pages */
.doc { max-width: 760px; padding: 16px 0 56px; }
.doc h2 { font-size: 22px; margin-top: 36px; }
.doc ul { padding-inline-start: 1.2em; }
.doc li { margin-bottom: .6em; }
.doc li strong { color: var(--text); }
.backlink { display: inline-block; margin-bottom: 24px; text-decoration: none; }
.lead { font-size: 19px; color: var(--text); }
.updated { color: var(--secondary); font-size: 14px; }
.mailto { font-weight: 600; }
.credits { list-style: none; padding: 0 !important; display: grid; gap: 8px; }
.credits li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px;
  margin: 0 !important; padding: 14px 18px; border-radius: 14px; background: var(--raised);
}
.credit-name { font-weight: 600; }
.credit-by { color: var(--secondary); font-size: 15px; }

/* ------------------------------------------------------------------ feedback */
.fb-form { display: grid; gap: 8px; }
.fb-kinds { border: 0; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fb-kinds legend { padding: 0; margin-bottom: 8px; }
.fb-lab { font-size: 14px; color: var(--secondary); font-weight: 600; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px;
}
.chip input:checked + span { background: var(--accent); color: var(--on-accent); box-shadow: none; font-weight: 650; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 0;
  background: var(--well); color: var(--text); font: inherit; font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.field::placeholder { color: var(--secondary); opacity: .8; }
.field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
textarea.field { resize: vertical; min-height: 110px; }
.fb-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.fb-actions .btn { min-height: 48px; }
.fb-mine { font-size: 15px; }
.fb-note { font-size: 13px; color: var(--secondary); margin: 6px 0 0; }
.fb-hp { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.fb-bad { padding: 14px 18px; border-radius: 14px; color: var(--error); background: var(--raised); box-shadow: inset 0 0 0 1px var(--error); }
.fb-page { padding: 24px; border-radius: var(--radius); background: var(--raised); margin-bottom: 40px; }
.fb-empty { color: var(--secondary); }
.fb-list { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.fb-item { margin: 0 !important; padding: 16px 18px; border-radius: 14px; background: var(--raised); }
.fb-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--secondary); margin-bottom: 8px; }
.fb-body { margin: 0; }
.fb-from { margin: 8px 0 0; font-size: 14px; color: var(--secondary); }
.tag { padding: 2px 10px; border-radius: 999px; font-weight: 650; }
.tag-idea { background: var(--accent-soft); color: var(--accent-tx); }
.tag-problem { background: var(--well); color: var(--error); }

/* Floating button. Bare values first so browsers without env() still get a margin. */
.fab { position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 70; }
@supports (padding: env(safe-area-inset-bottom)) {
  .fab { right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); }
  [dir="rtl"] .fab { right: auto; left: calc(16px + env(safe-area-inset-left)); }
}
.fab-btn {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 20px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 650; box-shadow: var(--shadow);
}
.fab-btn::-webkit-details-marker { display: none; }
.fab[open] .fab-btn { background: var(--raised); color: var(--text); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); }
.fab-panel {
  position: absolute; inset-inline-end: 0; bottom: calc(100% + 12px);
  width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow: auto;
  padding: 20px; border-radius: 22px; background: var(--raised); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.fab-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 18px; }
.fab-intro { color: var(--secondary); font-size: 15px; }
.fab-x {
  display: none; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--surface); color: var(--text); font-size: 15px;
}
html.js .fab-x { display: inline-flex; align-items: center; justify-content: center; }
.fab .chip span { background: var(--surface); }
@media (prefers-reduced-motion: no-preference) {
  .fab[open] .fab-panel { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* ------------------------------------------------------------------ narrow */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 16px; }
  .deck { max-width: 560px; }
  .sound-groups, .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .topbar { gap: 8px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 14px; letter-spacing: .08em; }
  .langs summary { gap: 6px; padding: 0 10px; font-size: 14px; }
  .deck { padding: 14px; border-radius: 22px; }
  .fader .track { height: 170px; }
  .fader .name { font-size: 11.5px; }
  .pill { font-size: 13px; }
  .fab-txt { display: none; }
  .fab-btn { padding: 0 16px; }
  .footer { padding-bottom: 96px; }   /* room for the floating button over the last lines */
}
