/* ---------- Fonts (self-hosted so it works offline) ---------- */
@font-face { font-family: "Poppins"; font-weight: 200; font-display: swap; src: url(assets/fonts/poppins-200.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 300; font-display: swap; src: url(assets/fonts/poppins-300.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 400; font-display: swap; src: url(assets/fonts/poppins-400.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url(assets/fonts/poppins-600.woff2) format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url(assets/fonts/poppins-700.woff2) format("woff2"); }
@font-face { font-family: "Caveat Brush"; font-weight: 400; font-display: swap; src: url(assets/fonts/caveat-brush-400.woff2) format("woff2"); }

/* ---------- Tokens (colours are overwritten from content.js) ---------- */
:root {
  --from: #3B0F2E;
  --to: #D8283C;
  --accent: #FFD500;
  --ink: #1B1530;
  --muted: #5B5470;
  --line: #D9D4E3;
  --field-line: #857D9A;   /* input underlines: >=3:1 on white (WCAG 1.4.11) */
  --card: #FFFFFF;
  --radius: 16px;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat Brush", "Comic Sans MS", cursive;
  --bar-h: 92px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  color: #fff;
  background: var(--from);
  background-image: linear-gradient(135deg, var(--from) 0%, color-mix(in srgb, var(--from) 45%, var(--to)) 55%, var(--to) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.45;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; background: var(--accent); color: var(--ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; z-index: 50; }
.skip-link:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------- Header ---------- */
.hero { padding-top: calc(28px + env(safe-area-inset-top, 0px)); padding-bottom: 20px; }
.title { font-weight: 200; font-size: clamp(2.3rem, 10vw, 4.6rem); line-height: 1.02; margin: 0 0 12px; letter-spacing: -0.01em; }
.title b { font-weight: 700; }
.intro strong { font-weight: 600; }
.intro { margin: 0 0 16px; max-width: 36em; font-size: 0.98rem; opacity: 0.95; }
.wins-pill { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 8px 16px 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.3); font-weight: 400; }
.wins-pill strong { font-weight: 700; font-size: 1.15em; }
.wins-star { color: var(--accent); font-size: 1.1em; }

/* ---------- Install banner ---------- */
.install { background: rgba(0,0,0,0.25); border-block: 1px solid rgba(255,255,255,0.18); margin-bottom: 16px; }
.install-inner { display: flex; align-items: center; gap: 12px; padding-block: 12px; }
.install-inner img { border-radius: 10px; flex: none; }
.install-inner p { margin: 0; flex: 1; font-size: 0.88rem; }
.install-close { background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; padding: 4px 8px; cursor: pointer; }

/* ---------- Cards ---------- */
.card { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 18px 16px 14px; box-shadow: 0 6px 24px rgba(20, 4, 20, 0.22); }
.card-heading { font-weight: 300; font-size: 1.15rem; line-height: 1.25; margin: 0 0 12px; }
.section-heading { font-weight: 300; font-size: clamp(1.35rem, 5vw, 1.8rem); margin: 36px 0 14px; }

/* Feelings */
.feelings { margin-bottom: 16px; }
.feelings-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 520px) { .feelings-row { grid-template-columns: repeat(6, 1fr); } }
.feeling { position: relative; }
.feeling input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.feeling label { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 2px 10px; border-radius: 14px; border: 2px solid transparent; cursor: pointer; font-size: 0.78rem; font-weight: 400; text-align: center; transition: background .15s, border-color .15s, transform .15s; }
.feeling img { width: 56px; height: 56px; transition: transform .2s; }
.feeling input:checked + label { border-color: var(--ink); background: #F5F2FA; }
.feeling input:checked + label img { transform: scale(1.12) rotate(-4deg); }
.feeling input:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 1px; box-shadow: 0 0 0 5px var(--ink); }

/* Menu + plan grids */
.menu-grid, .plan-grid { display: grid; gap: 14px; }
@media (min-width: 760px) {
  .menu-grid, .plan-grid { grid-template-columns: repeat(3, 1fr); }
  .feelings-row { max-width: 720px; }
}

/* Option rows (the tick circles) */
.options { list-style: none; margin: 0; padding: 0; }
.option { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid #F0EDF5; }
.option:first-child { border-top: 0; }
.tick { position: relative; flex: none; width: 34px; height: 34px; }
.tick input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.tick span { position: absolute; inset: 0; border: 1.5px solid var(--ink); border-radius: 50%; background: #fff; transition: background .15s, border-color .15s, transform .15s; }
.tick span::after { content: ""; position: absolute; left: 11px; top: 6px; width: 8px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .15s; }
.tick input:checked + span { background: linear-gradient(135deg, var(--from), var(--to)); border-color: transparent; transform: scale(1.04); }
.tick input:checked + span::after { transform: rotate(45deg) scale(1); }
.tick input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
.option-text { flex: 1; font-size: 0.9rem; cursor: pointer; padding-block: 4px; }
.option.done .option-text { color: var(--muted); }
.option-extra { flex: none; }

.mini-btn { display: inline-flex; align-items: center; gap: 4px; font: 600 0.78rem/1 var(--sans); color: #fff; background: var(--ink); border: 0; border-radius: 999px; padding: 9px 12px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.mini-btn:hover { background: #352a55; }

.option-sub { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.service-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.link-btn.inline { padding: 0; font-size: inherit; }

/* Service picker */
.picker .timer-inner { text-align: left; }
.picker .timer-title { padding-right: 36px; font-size: 1.35rem; }
.picker .timer-sub { margin: 0 0 16px; max-width: none; }
.picker-heading { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 8px; opacity: 0.85; }
.picker-group { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.picker-item { width: 100%; text-align: left; font: 400 1rem var(--sans); color: var(--ink); background: #fff; border: 2px solid transparent; border-radius: 14px; padding: 13px 16px; cursor: pointer; }
.picker-item:hover { background: #F5F2FA; }
.picker-item.current { border-color: var(--accent); font-weight: 600; }

.reset-row { text-align: center; margin-top: 14px; }

/* Inputs */
.line-input { flex: 1; min-width: 0; font: 300 0.92rem var(--sans); color: var(--ink); border: 0; border-bottom: 1.5px solid var(--field-line); padding: 8px 2px; background: transparent; }
.line-input:focus { outline: none; border-bottom-color: var(--ink); }
.line-input::placeholder, .notes::placeholder { color: #6F6885; }
.option .else-wrap { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.option .else-wrap .option-text { flex: none; }
.option .else-wrap .line-input { flex: 1; min-width: 8em; }
.notes { width: 100%; font: 300 0.92rem/32px var(--sans); color: var(--ink); border: 0; resize: vertical; min-height: 200px; padding: 0 2px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--line) 31px 32px); background-attachment: local; }
.notes:focus { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 4px; }

.notes-print { display: none; white-space: pre-wrap; }
.saved-note { margin: 10px 2px 0; font-size: 0.875rem; min-height: 1.2em; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 0.95rem/1.2 var(--sans); border-radius: 999px; padding: 13px 20px; border: 2px solid transparent; cursor: pointer; text-decoration: none; min-height: 48px; transition: transform .1s, background .15s; }
.btn:active { transform: scale(0.97); }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 0.85rem; }
.btn-light { background: #fff; color: var(--ink); }
/* Matches the icecreates.com primary pill: 5px white outline + soft shadow */
.btn-gold { background: var(--accent); color: var(--ink); border: 5px solid #fff; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.15); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.7); }
.link-btn { background: none; border: 0; padding: 8px; color: #fff; font: 400 0.88rem var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.plan-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- Reminder + footer ---------- */
.reminder { font-family: var(--hand); font-size: clamp(1.35rem, 5vw, 1.75rem); line-height: 1.3; margin: 40px 0 28px; max-width: 30em; }
.footer { border-top: 1px solid rgba(255,255,255,0.25); padding-top: 18px; font-size: 0.85rem; }
.footer p { margin: 0 0 10px; }
.clear-zone .link-btn { padding-left: 0; }
.confirm { background: rgba(0,0,0,0.25); border-radius: 12px; padding: 14px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm p { flex-basis: 100%; }
/* Logo is sized to exactly match the width of the "Created by" text above it */
.credit { display: inline-grid; justify-items: start; row-gap: 6px; margin-top: 8px; font-size: 0.85rem; }
.credit-text { white-space: nowrap; }
.credit-logo { width: 0; min-width: 100%; height: auto; display: block; }

/* ---------- Sticky action bar ---------- */
.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(27, 8, 26, 0.88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid rgba(255,255,255,0.15);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.action-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-block: 12px; }
.action-inner .btn { padding-inline: 10px; }
@media (min-width: 760px) { .action-inner { max-width: 520px; } }

/* ---------- Timer dialog ---------- */
.timer { border: 0; padding: 0; width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); border-radius: 24px; color: #fff; background: linear-gradient(160deg, var(--from), var(--to)); box-shadow: 0 20px 60px rgba(0,0,0,0.5); overflow: auto; }
.timer::backdrop { background: rgba(15, 3, 14, 0.7); }
.timer-inner { position: relative; padding: 28px 22px 24px; text-align: center; }
.timer-close { position: absolute; right: 8px; top: 6px; background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; padding: 6px 12px; cursor: pointer; }
.timer-title { font-weight: 700; font-size: 1.6rem; margin: 0 0 6px; }
.timer-sub { margin: 0 auto 18px; max-width: 22em; font-size: 0.9rem; }
.breath { position: relative; width: 220px; height: 220px; margin: 0 auto 20px; display: grid; place-items: center; }
.breath-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.28), rgba(255,255,255,0.08) 70%); border: 2px solid rgba(255,255,255,0.55); transform: scale(0.62); }
.breath-ring.run { animation: breathe 10s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.62); } 40%, 50% { transform: scale(1); } }
.breath-text { position: relative; display: flex; flex-direction: column; align-items: center; }
.time { font-weight: 600; font-size: 2.6rem; font-variant-numeric: tabular-nums; line-height: 1; }
.breath-cue { font-family: var(--hand); font-size: 1.35rem; margin-top: 6px; }
.timer-actions { display: flex; flex-direction: column; gap: 10px; }
.timer-done-msg { font-weight: 600; font-size: 1.1rem; margin: 0 0 4px; }

/* ---------- Celebration toast ---------- */
.toast { position: fixed; z-index: 40; left: 50%; top: 50%; right: auto; bottom: auto; margin: 0; border: 0; max-height: calc(100% - 32px); transform: translate(-50%, -50%); width: min(380px, calc(100% - 32px)); background: #fff; color: var(--ink); border-radius: 24px; padding: 28px 22px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.45); overflow: hidden; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.toast::backdrop { background: rgba(27,21,48,0.55); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0.8); opacity: 0; } }
.toast-count { margin: 0; }
.toast-count span { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, var(--from), var(--to)); color: #fff; font-weight: 700; font-size: 1.9rem; }
.toast-msg { font-family: var(--hand); font-size: 1.5rem; line-height: 1.25; margin: 14px 0 18px; }
.toast .btn-light { background: var(--ink); color: #fff; }
.snow { position: absolute; inset: 0; pointer-events: none; }
.snow i { position: absolute; top: -12px; color: var(--to); font-style: normal; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(340px) rotate(200deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .breath-ring.run { animation: none; transform: scale(0.85); }
}

/* ---------- Print / Save as PDF: an A4 version of the sheet ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; color: var(--ink); padding: 0; font-size: 10pt; }
  .install, .action-bar, .timer, .toast, #serviceChange, .skip-link, .reset-row, .plan-actions, .clear-zone, .saved-note, .intro, .option-extra { display: none !important; }
  .hero { padding: 0 0 4mm; }
  .hero, .reminder { color: var(--ink); }
  .title { font-size: 30pt; margin-bottom: 2mm; }
  .wins-pill { background: none; border: 1px solid var(--line); color: var(--ink); }
  .card { box-shadow: none; border: 1px solid #C9C3D6; padding: 4mm; break-inside: avoid; }
  .menu-grid, .plan-grid { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .feelings-row { grid-template-columns: repeat(6, 1fr); }
  .feeling img { width: 32px; height: 32px; }
  .section-heading { color: var(--ink); margin: 6mm 0 3mm; }
  .option { padding: 1mm 0; }
  .tick { width: 20px; height: 20px; }
  .tick span::after { left: 6px; top: 2px; width: 6px; height: 11px; border-width: 0 2px 2px 0; }
  .tick span, .tick input:checked + span, .toast-count span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .option-text, .line-input { font-size: 8.5pt; }
  .notes { display: none; }
  .notes-print { display: block; font-size: 8.5pt; line-height: 1.5; }
  .reminder { font-size: 15pt; margin: 6mm 0 4mm; }
  .footer { color: var(--ink); border-color: var(--line); font-size: 8pt; }
  a { color: inherit; text-decoration: none; }
  .credit-logo { filter: brightness(0); } /* white logo would vanish on white paper */
}
