/* ===== Brand fonts (self-hosted; same families as the Serenity Beauty website) ===== */
@font-face { font-family: "Poppins"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/poppins-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/poppins-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/playfair-display-latin-400-normal.woff2") format("woff2"); }

/* ===== Brand tokens =====
   Source of truth: the live Serenity Beauty theme (colour schemes in config/settings_data.json).
   Website values:  white #ffffff · plum text #3a2733 · button pink #b8326f · secondary label #8e2457
                    blush #ffdef1 · pale pink #ffedf7  (light scheme only; plum #3a2733 is used as text ink).
   Derived (tints between the brand plum and pink, used only for layers/borders/muted text):
                    --muted, --control, --surface-dark layers. Every pair is checked for WCAG 2.2 AA. */
:root {
  --bg: #ffedf7;            /* brand pale pink */
  --surface: #ffffff;       /* brand white (cards) */
  --surface-2: #ffdef1;     /* brand blush */
  --text: #3a2733;          /* brand plum */
  --muted: #6b5663;         /* derived: plum tint, 5.4:1 or better on every surface */
  --line: rgba(58, 39, 51, .12);   /* website cards use a 10% plum border */
  --control: #85707f;       /* derived: 3.6:1 or better on every surface (inputs, choices) */
  --accent: #b8326f;        /* brand button pink */
  --accent-text: #8e2457;   /* brand secondary button label: text/links */
  --accent-ink: #ffffff;    /* brand button label */
  --accent-soft: #ffdef1;   /* brand blush */
  --ok: #2f6b4d;
  --warn-soft: #ffdef1;
  --warn-ink: #3a2733;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --radius: 16px;           /* website card radius */
  --shadow: none;           /* website cards use no shadow */
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: var(--accent-text); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: 1.75rem; }
h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; }
h3 { font-size: 1rem; }
h2.h3 { font-family: var(--font); font-weight: 600; font-size: 1rem; }  /* correct heading level, same look as before */
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* ===== Layout ===== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text);
  font: 400 .85rem/1 var(--font-display); letter-spacing: .04em;
}
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; object-fit: cover; }
.brand-text { font-family: var(--font-display); font-size: 1.1rem; }
.icon-btn { color: var(--muted); padding: 8px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn:hover, .icon-btn[aria-current="page"] { color: var(--accent-text); }

main { max-width: 520px; margin: 0 auto; padding: 8px 16px 24px; outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: .72rem; text-decoration: none; color: var(--muted);
  min-height: 56px;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.tabbar.hidden, .icon-btn.hidden { display: none; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card.soft { background: var(--surface-2); border-color: transparent; box-shadow: none; }
.card.alert { background: var(--warn-soft); border: 1.5px solid var(--accent); color: var(--warn-ink); }
.card.alert h2, .card.alert p { color: var(--warn-ink); }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ===== Buttons & forms ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 12px 18px;
  border: 1px solid transparent; border-radius: 40px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.secondary { background: transparent; color: var(--accent-text); border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--control); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn + .btn, .btn-row { margin-top: 10px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-row .btn { margin: 0; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
input[type="email"], input[type="date"], input[type="time"], select {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--control); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit;
}
input:focus-visible, select:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent-text); outline-offset: 2px;
}
.choice-group { display: grid; gap: 10px; margin-bottom: 16px; border: 0; padding: 0; }
.choice-group legend { font-weight: 600; margin-bottom: 8px; font-size: .95rem; padding: 0; }
.choice {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 14px; border: 1px solid var(--control); border-radius: 14px; cursor: pointer;
  background: var(--surface);
}
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { accent-color: var(--accent); width: 24px; height: 24px; flex: none; }
.choice small { display: block; color: var(--muted); }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin: 4px 0 14px; cursor: pointer; }
.consent input { accent-color: var(--accent); width: 24px; height: 24px; margin-top: 0; flex: none; }

/* ===== Today ===== */
.hero { text-align: center; padding: 22px 18px; }
.hero h1 { margin-bottom: 4px; }
.check-btn {
  width: 168px; height: 168px; margin: 18px auto 10px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent-text);
  font: 600 1rem/1.25 var(--font); cursor: pointer; padding: 18px;
  -webkit-tap-highlight-color: transparent; transition: transform .15s ease;
}
.check-btn:active { transform: scale(.96); }
.check-btn svg { width: 40px; height: 40px; margin: 0 auto 6px; display: block; }
.check-btn.done { border-style: solid; background: var(--accent); color: var(--accent-ink); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font: 400 1.6rem/1.1 var(--font-display); }
.stat span { font-size: .8rem; color: var(--muted); }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.day {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); font: inherit; font-size: .72rem;
}
.day i {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--control); font-style: normal; font-size: .85rem; color: var(--text);
}
.day.on i { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.day.today i { border-color: var(--accent); }
.day[disabled] { opacity: .35; cursor: default; }

.progress { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; }
.card.alert .progress { background: var(--surface); }

/* ===== Products ===== */
.product { display: grid; grid-template-columns: 88px 1fr; gap: 14px; align-items: center; }
.product img { width: 88px; height: 88px; object-fit: cover; border-radius: 14px; background: var(--surface-2); }
.product h3 { margin: 0 0 2px; }
.price { font-weight: 600; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; }

/* ===== Lists ===== */
ul.clean { padding-left: 1.2em; margin: 0 0 .5em; }
ul.clean li { margin-bottom: .35em; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding-left: 40px; margin-bottom: 12px; }
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: .85rem;
  display: grid; place-items: center;
}
.claim { font-family: var(--font-display); font-size: 1.1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  font-size: .9rem; transition: all .2s ease; max-width: calc(100% - 32px); text-align: center; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.noscript { padding: 24px; text-align: center; }

/* ===== Accessibility helpers ===== */
.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;
}
.form-error {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); font-size: .9rem;
}
.form-error[hidden] { display: none; }
input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"][aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; background: var(--warn-soft); color: var(--warn-ink); border-bottom: 1.5px solid var(--accent); padding: 8px 14px; text-align: center; font-size: .9rem; }
input::-webkit-calendar-picker-indicator:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 4px; }
