/* =====================================================================
   B-Friends — customer site. Mobile-first.
   Brand colours are placeholders: replace the --brand-* tokens when the
   official logo/colours arrive. Everything else derives from them.
   ===================================================================== */
:root {
  --brand-primary: #5b6b52;   /* sage */
  --brand-primary-dark: #40493a;
  --brand-accent: #c17a56;    /* clay */
  --ivory: #faf6ef;
  --paper: #fffdfa;
  --ink: #2b2925;
  --ink-soft: #6b6559;
  --ink-faint: #a29a8c;
  --line: #e6ddce;
  --sage-light: #e7ede2;
  --clay-light: #f3e3d6;
  --alert: #a8442f;
  --alert-light: #f7e2dc;
  --grey-light: #eeebe5;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(43, 41, 37, .04), 0 8px 24px rgba(43, 41, 37, .06);
  --gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ivory); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-primary-dark); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { text-decoration: none; color: var(--ink); line-height: 1.1; }
.brand-mark { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: .06em; }
.brand-sub { display: block; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft); }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 500;
  padding: 8px 12px; border-radius: 999px;
}
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }

.demo-banner {
  background: var(--clay-light); color: #6d3f26; font-size: 13px; text-align: center; padding: 8px var(--gutter);
}

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.eyebrow { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--brand-primary); font-weight: 600; margin: 0 0 8px; }
.hero h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 7vw, 46px); line-height: 1.12; margin: 0 0 10px; letter-spacing: -.01em; }
.hero p.lead { color: var(--ink-soft); margin: 0; max-width: 46ch; }
.rule-card {
  margin-top: 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: grid; gap: 10px;
}
.rule-card strong { font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Status pill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .01em;
}
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-pending   { background: var(--clay-light);  color: #8a4b2b; }
.pill-confirmed { background: var(--sage-light);  color: var(--brand-primary-dark); }
.pill-full      { background: var(--ink);         color: var(--paper); }
.pill-cancelled { background: var(--alert-light); color: var(--alert); }
.pill-closed    { background: var(--grey-light);  color: var(--ink-soft); }
.pill-active    { background: var(--sage-light);  color: var(--brand-primary-dark); }

/* ---------- Day strip ---------- */
.toolbar { position: sticky; top: 60px; z-index: 10; background: var(--ivory); padding: 12px 0 10px; border-bottom: 1px solid transparent; }
.toolbar.stuck { border-bottom-color: var(--line); }
.scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px var(--gutter); margin: 0 calc(var(--gutter) * -1); scroll-snap-type: x proximity; }
.scroller::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; scroll-snap-align: start; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 14px; width: 58px; padding: 7px 0 8px; text-align: center; cursor: pointer; line-height: 1.15;
}
.day-chip small { display: block; font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }
.day-chip b { display: block; font-size: 19px; font-weight: 600; margin-top: 2px; }
.day-chip i { display: block; height: 5px; margin-top: 3px; font-style: normal; }
.day-chip i::after { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--brand-accent); vertical-align: top; }
.day-chip.empty i::after { background: transparent; }
.day-chip.all { width: auto; padding: 0 16px; display: flex; align-items: center; font-weight: 600; font-size: 14px; }
.day-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.day-chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .7); }
.type-chips { margin-top: 10px; }
.type-chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  border-radius: 999px; padding: 6px 14px; font-size: 13.5px; cursor: pointer; font-weight: 500;
}
.type-chip[aria-pressed="true"] { background: var(--sage-light); color: var(--brand-primary-dark); border-color: transparent; }

/* ---------- Class list ---------- */
.day-group { margin: 22px 0 6px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.day-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin: 0; }
.day-head span { font-size: 13px; color: var(--ink-faint); }
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s ease;
}
.card.is-dim { opacity: .72; box-shadow: none; }
.card-media {
  position: relative; height: 132px; background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 12px;
}
.card-media .pill { position: absolute; top: 12px; left: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.card-media .time-tag {
  font-family: var(--font-display); font-size: 26px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .25); letter-spacing: .01em;
}
.card-media .time-tag small { font-family: var(--font-body); font-size: 13px; font-weight: 500; opacity: .9; margin-left: 4px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card-title h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0; line-height: 1.2; }
.price { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.meta { margin: -4px 0 0; font-size: 13.5px; color: var(--ink-soft); }

.meter { position: relative; height: 8px; border-radius: 99px; background: var(--grey-light); overflow: visible; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--brand-accent); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.is-confirmed .meter-fill, .is-full .meter-fill { background: var(--brand-primary); }
.is-cancelled .meter-fill, .is-closed .meter-fill { background: var(--ink-faint); }
.meter-min { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; opacity: .55; }
.meter-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-soft); }
.meter-row b { font-size: 17px; color: var(--ink); font-weight: 600; }
.msg { margin: 0; font-size: 14px; font-weight: 500; }
.is-pending .msg { color: #8a4b2b; }
.is-confirmed .msg { color: var(--brand-primary-dark); }
.is-cancelled .msg { color: var(--alert); }
.is-closed .msg, .is-full .msg { color: var(--ink-soft); }
.card .btn { margin-top: auto; }
.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--brand-accent); } 100% { box-shadow: var(--shadow); } }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 15.5px; text-decoration: none;
  transition: background .15s ease, opacity .15s ease;
}
.btn:hover { background: #000; }
.btn-primary { background: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-primary-dark); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: var(--paper); }
.btn-danger { background: transparent; color: var(--alert); box-shadow: inset 0 0 0 1px #e9c3b8; }
.btn-danger:hover { background: var(--alert-light); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; opacity: .75; }
.btn.is-loading::after { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; color: var(--brand-primary-dark); text-decoration: underline; cursor: pointer; padding: 0; font-size: 14px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; }
.field .hint { font-size: 12.5px; color: var(--ink-soft); }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font: inherit; color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--sage-light); }
.input.invalid { border-color: var(--alert); }
.input-code { font-size: 24px; letter-spacing: .3em; text-align: center; font-weight: 600; padding-left: .5em; }
.err { color: var(--alert); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; width: max-content; }
.stepper button { width: 48px; height: 46px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--ink); }
.stepper button[disabled] { color: var(--ink-faint); cursor: not-allowed; }
.stepper output { min-width: 40px; text-align: center; font-weight: 600; font-size: 17px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-soft); }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand-primary); flex: 0 0 auto; }

/* ---------- Bottom sheet dialog ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh;
  border-radius: 22px 22px 0 0; background: var(--ivory); color: var(--ink); overflow: auto;
}
dialog.sheet::backdrop { background: rgba(28, 27, 24, .45); }
dialog.sheet[open] { animation: up .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 640px) {
  dialog.sheet { margin: auto; max-width: 480px; border-radius: 22px; }
}
.sheet-inner { padding: 8px 20px 24px; display: grid; gap: 16px; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 6px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h2 { font-family: var(--font-display); font-size: 23px; margin: 0; font-weight: 600; line-height: 1.2; }
.sheet-close { border: 0; background: var(--paper); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--line); flex: 0 0 auto; }
.summary { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; color: var(--ink-soft); display: grid; gap: 4px; }
.summary b { color: var(--ink); font-weight: 600; font-size: 15.5px; }
.result { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 8px 0; }
.result-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: var(--sage-light); color: var(--brand-primary-dark); }
.result-icon.bad { background: var(--alert-light); color: var(--alert); }
.result h3 { font-family: var(--font-display); font-size: 24px; margin: 4px 0 0; font-weight: 600; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .08em; background: var(--paper); border: 1px dashed var(--line); padding: 8px 16px; border-radius: var(--radius-sm); }
.stack { display: grid; gap: 10px; }

/* ---------- Empty / loading ---------- */
.state { text-align: center; color: var(--ink-soft); padding: 48px 16px; }
.state h3 { font-family: var(--font-display); color: var(--ink); font-size: 21px; margin: 0 0 6px; font-weight: 600; }
.skeleton { height: 280px; border-radius: var(--radius); background: linear-gradient(90deg, var(--grey-light), var(--paper), var(--grey-light)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- My bookings ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 480px; display: grid; gap: 14px; }
.booking-item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.booking-item.is-dim { opacity: .65; }
.booking-item h3 { font-family: var(--font-display); font-size: 19px; margin: 0; font-weight: 600; }
.booking-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kv { font-size: 13.5px; color: var(--ink-soft); }
.kv b { color: var(--ink); font-weight: 600; }
.section-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 26px 0 10px; }

/* ---------- Prose (privacy) ---------- */
.prose { max-width: 70ch; padding: 24px 0 48px; }
.prose h1 { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin: 0 0 8px; }
.prose h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 28px 0 8px; }
.prose p, .prose li { color: #3e3b35; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; font-size: 13px; color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); transition: opacity .4s, transform .4s; }
.toast-error { background: var(--alert); }
.toast-success { background: var(--brand-primary-dark); }
.toast.out { opacity: 0; transform: translateY(8px); }

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