/* Lettertypen staan op de eigen site (geen Google Fonts): beter voor privacy en beveiliging.
   Figtree en Young Serif, SIL Open Font License 1.1 (zie fonts/OFL-*.txt). */
@font-face { font-family: 'Figtree'; src: url('fonts/figtree-latin.woff') format('woff'); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Young Serif'; src: url('fonts/young-serif-latin.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; }

/* Adem en ik / Breath and me — een rustige, mistige kustpalet met één levendig accent.
   Layout: één smalle kolom (max 720px) met vaste tabbalk onderaan; schermen
   zoals de sessie en de betaalmuur schuiven er als volledig scherm overheen. */

:root {
  --bg: #edf1f0;
  --surface: #f8faf9;
  --surface-2: #e2e9e7;
  --line: #cfd9d6;
  --fg: #16272a;
  --muted: #566a6c;
  --accent: #1f6f69;
  --accent-soft: #cfe5e1;
  --accent-ink: #ffffff;
  --gold: #8a5f0e;
  --gold-soft: #f1e4c6;
  --danger: #b3402f;
  --shadow: 0 1px 2px rgb(22 39 42 / 0.06), 0 8px 24px rgb(22 39 42 / 0.06);

  --font-display: 'Young Serif', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Figtree', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --tabbar: 64px;
}

:root[data-accent='dawn'] { --accent: #a8414f; --accent-soft: #f3d9dc; }
:root[data-accent='forest'] { --accent: #3b6528; --accent-soft: #dce8d2; }
:root[data-accent='dusk'] { --accent: #4b4fa8; --accent-soft: #dedff4; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d1718; --surface: #142123; --surface-2: #1b2b2d; --line: #29393b;
    --fg: #e3ecea; --muted: #93a6a7; --accent: #74c7bc; --accent-soft: #1c3b39; --accent-ink: #0d1718;
    --gold: #e2b65a; --gold-soft: #3a2e14; --danger: #f08a77;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
  :root:not([data-theme='light'])[data-accent='dawn'] { --accent: #f09aa6; --accent-soft: #47242a; }
  :root:not([data-theme='light'])[data-accent='forest'] { --accent: #9bcb7c; --accent-soft: #27381e; }
  :root:not([data-theme='light'])[data-accent='dusk'] { --accent: #a7aaf2; --accent-soft: #2a2c55; }
}
:root[data-theme='dark'] {
  --bg: #0d1718; --surface: #142123; --surface-2: #1b2b2d; --line: #29393b;
  --fg: #e3ecea; --muted: #93a6a7; --accent: #74c7bc; --accent-soft: #1c3b39; --accent-ink: #0d1718;
  --gold: #e2b65a; --gold-soft: #3a2e14; --danger: #f08a77;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}
:root[data-theme='dark'][data-accent='dawn'] { --accent: #f09aa6; --accent-soft: #47242a; }
:root[data-theme='dark'][data-accent='forest'] { --accent: #9bcb7c; --accent-soft: #27381e; }
:root[data-theme='dark'][data-accent='dusk'] { --accent: #a7aaf2; --accent-soft: #2a2c55; }

/* ------------------------------------------------------------ basis */

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 28px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ------------------------------------------------------------ home */

.hero { display: flex; flex-direction: column; gap: 8px; padding-block: 8px 4px; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); line-height: 1.15; max-width: 22ch; }
.streak { color: var(--muted); }
.streak-n { font-family: var(--font-display); color: var(--accent); font-size: 1.25rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.section-h { font-size: 1.25rem; margin-top: 8px; }

.pcard {
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px 16px 12px; min-width: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.pcard:hover { border-color: var(--accent); }
.pcard:active { transform: scale(0.98); }
.pcard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.pcard-name { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.2; }
.pcard-rhythm { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.85rem; letter-spacing: 0.04em; }
.pcard.is-locked .pcard-name, .pcard.is-locked .wave { opacity: 0.6; }

.wave { width: 100%; height: 36px; display: block; }
.wave path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.wave-lg { height: 90px; }
.wave-lg path { stroke-width: 3; }

.pcard-new {
  align-items: center; justify-content: center; flex-direction: row; gap: 10px;
  border-style: dashed; background: transparent; color: var(--muted); min-height: 120px;
}
.plus { font-size: 1.6rem; line-height: 1; color: var(--accent); }

.goal {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.goal::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.goal-focus::before { background: var(--gold); }
.goal-sleep::before { background: var(--muted); }
.goal-custom::before { background: transparent; border: 1.5px solid var(--accent); }

.lock {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600; color: var(--gold);
  background: var(--gold-soft); padding: 2px 8px 2px 6px; border-radius: 99px;
}
.lock-ico { width: 12px; height: 12px; flex: none; }

.premium-strip {
  display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0; border-radius: var(--r-md); padding: 14px 16px;
  background: var(--gold-soft); color: var(--gold); font-weight: 600;
}
.premium-strip .lock-ico { width: 16px; height: 16px; }
.premium-strip span:nth-child(2) { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ tabbalk */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.tab {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; padding: 6px 4px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 0.75rem; font-weight: 600;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.on { color: var(--accent); }

/* ------------------------------------------------------------ panelen */

.page-h h1 { font-size: 2rem; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 18px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden;
}
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-h h2 { font-size: 1.2rem; }
.sub-h { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

.streak-panel { flex-direction: row; align-items: baseline; gap: 12px; }
.big-n { font-family: var(--font-display); font-size: 3rem; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-v { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; height: 1em; }
.bar-track { flex: 1; width: 100%; max-width: 30px; background: var(--surface-2); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: var(--accent); border-radius: 6px; opacity: 0.75; }
.bar.today .bar-fill { opacity: 1; }
.bar-d { font-size: 0.75rem; color: var(--muted); }
.bar.today .bar-d { color: var(--fg); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.tile-l { font-size: 0.78rem; color: var(--muted); }
.tile-v { font-family: var(--font-display); font-size: 1.4rem; font-variant-numeric: tabular-nums; }

.prows { display: flex; flex-direction: column; gap: 8px; }
.prow { display: grid; grid-template-columns: minmax(0, 9rem) 1fr auto; gap: 10px; align-items: center; font-size: 0.9rem; }
.prow-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.prow-track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.prow-v { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }

.locked-preview { filter: blur(5px); opacity: 0.55; pointer-events: none; user-select: none; display: flex; flex-direction: column; gap: 14px; }
.locked-cover {
  position: absolute; inset: 56px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 16px;
}
.locked-cover p { max-width: 32ch; }

/* ------------------------------------------------------------ instellingen */

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 2px; }
.row > span, .row > label { min-width: 0; flex: 1 1 12rem; }
.row small { display: block; color: var(--muted); font-size: 0.8rem; }
.row.is-disabled > span:first-child { color: var(--muted); }
.native-list { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.chip { flex: none !important; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-b { border: 0; background: none; padding: 6px 12px; border-radius: 99px; font-size: 0.88rem; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.seg-b.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-weight: 600; }
.seg-b .lock-ico { color: var(--gold); }

.switch { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); transition: transform 0.2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.swatches { display: flex; gap: 10px; flex: none; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; position: relative; display: grid; place-items: center; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }
.swatch .lock-ico { color: #fff; width: 13px; height: 13px; }
.sw-kelp { background: #1f6f69; }
.sw-dawn { background: #b5495b; }
.sw-forest { background: #3f6b2a; }
.sw-dusk { background: #4b4fa8; }
.status-on { color: var(--accent); font-weight: 600; }

/* ------------------------------------------------------------ knoppen */

.btn { border: 0; border-radius: 99px; padding: 12px 22px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--fg); }
.btn-danger { background: none; color: var(--danger); padding-inline: 8px; }
.btn-wide { width: 100%; padding-block: 15px; font-size: 1.05rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.center { justify-content: center; }
.link { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 6px 0; }
.center-link { align-self: center; }

/* ------------------------------------------------------------ overlay en sheets */

.overlay {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto; background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: rise 0.25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.sheet {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 40px;
  display: flex; flex-direction: column; gap: 16px;
}
.sheet-bar { display: flex; justify-content: space-between; align-items: center; min-height: 40px; }
.sheet h2 { font-size: 2rem; line-height: 1.1; }
.lead { font-size: 1.05rem; color: var(--muted); }
.setup-name { font-size: 2.2rem !important; }

.setup-wave { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.setup-wave figcaption { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.9rem; }
.rhythm { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; font-weight: 600; }

.caution { background: var(--gold-soft); color: var(--fg); border-radius: var(--r-sm); padding: 12px 14px; font-size: 0.9rem; }

.durs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dur { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 10px 4px; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.dur.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.dur.is-locked { color: var(--muted); }
.dur .lock-ico { color: var(--gold); }

/* ------------------------------------------------------------ sessie */

.ov-session { background: var(--bg); }
.session {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px;
}
.session-name { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.breath { position: relative; width: min(72vw, 320px); aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; margin-block: 12px; }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px dashed var(--line); }
.orb {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, color-mix(in srgb, var(--accent) 55%, var(--surface)), var(--accent) 70%);
  box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: scale(0.42); will-change: transform;
}
.count { position: relative; font-family: var(--font-display); font-size: 3rem; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.phase { font-family: var(--font-display); font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.1; min-height: 1.1em; }
.cue { color: var(--muted); min-height: 1.5em; }
.session-meta { display: flex; gap: 18px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }

/* ------------------------------------------------------------ klaar */

.done { padding-top: 15vh; }
.upsell { background: var(--gold-soft); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.upsell h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; color: var(--fg); }

/* ------------------------------------------------------------ betaalmuur */

.features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.features li { padding-left: 28px; position: relative; }
.features li::before {
  content: ''; position: absolute; left: 2px; top: 0.3em; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 5px var(--accent-soft), inset 0 0 0 16px var(--accent);
}
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.plan {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-width: 0;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 12px;
}
.plan.on { border-color: var(--accent); background: var(--accent-soft); }
.plan-l { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.plan-p { font-family: var(--font-display); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.plan-p s { font-family: var(--font-body); font-size: 0.85rem; color: var(--muted); }
.plan-per { font-size: 0.8rem; color: var(--muted); }
.plan-note { font-size: 0.75rem; color: var(--accent); font-weight: 600; margin-top: 4px; }
a.btn { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.web-note { background: var(--accent-soft); border-radius: var(--r-sm); padding: 12px 14px; font-size: 0.92rem; }
.fine a { color: inherit; }
.demo-note { font-size: 0.82rem; border: 1px dashed var(--gold); color: var(--gold); border-radius: var(--r-sm); padding: 8px 12px; }

@media (max-width: 460px) {
  .plans { grid-template-columns: 1fr; }
  .plan { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; }
  .plan-l { grid-column: 1; }
  .plan-p { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .plan-per { grid-column: 1; }
  .plan-note { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------ editor */

.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.field input { font: inherit; font-size: 1.05rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.stepper { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 4px; border-bottom: 1px solid var(--line); }
.stepper-c { display: flex; align-items: center; gap: 6px; }
.step-b { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.3rem; line-height: 1; }
.step-v { min-width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.1rem; }
.step-v small { font-weight: 400; color: var(--muted); font-size: 0.75rem; margin-left: 3px; }
.error { color: var(--danger); font-size: 0.9rem; }

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + 20px + env(safe-area-inset-bottom, 0px));
  background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600;
  max-width: calc(100% - 32px); text-align: center; box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  .overlay { animation: none; }
  .pcard { transition: none; }
}
