/*
 * Design tokens + primitives shared by the public site, the booking sheet and the owner dashboard.
 *
 * Theme tokens (colour, typeface) are the ONLY place a business's identity lives. They are set at runtime by
 * UI.applyTheme() from the business config, so a barber, a salon or a studio re-skins without touching a component.
 * Nothing below this block hardcodes an industry colour.
 */
@font-face{font-family:Inter;font-style:normal;font-weight:400 700;font-display:swap;src:url(../../../fonts/inter-latin.woff2) format("woff2");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:"Bricolage Grotesque";font-style:normal;font-weight:200 800;font-display:swap;src:url(../assets/fonts/bricolage-grotesque-wght.woff2) format("woff2")}
@font-face{font-family:"Instrument Serif";font-style:normal;font-weight:400;font-display:swap;src:url(../assets/fonts/instrument-serif-400-normal.woff2) format("woff2")}
@font-face{font-family:"Instrument Serif";font-style:italic;font-weight:400;font-display:swap;src:url(../assets/fonts/instrument-serif-400-italic.woff2) format("woff2")}

:root {
  /* ---- theme tokens (overridden at runtime) ---- */
  --brand: #242026;        /* primary dark: headings, primary buttons, the one dark section */
  --on-brand: #f7f3ed;
  --on-accent: #ffffff;
  --ink: #242026;          /* text colour on the canvas */
  --bg: #f7f3ed;           /* canvas */
  --surface-2: #ded4c9;    /* secondary surface */
  --muted: #645e63;        /* secondary text (>= 4.5:1 on --bg) */
  --accent: #a65e4d;       /* decorative accent */
  --accent-text: #9c5545;  /* accent when used as text on --bg (>= 4.5:1) */
  --accent-on-dark: #d9917f; /* accent when used as text on --brand (>= 4.5:1) */
  --display-weight: 700; --display-track: -.04em; --display-lh: .94;
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* ---- derived surfaces (never set by hand) ---- */
  --surface: color-mix(in srgb, #fff 62%, var(--bg));
  --tint: color-mix(in srgb, var(--surface-2) 38%, var(--bg));
  --line: color-mix(in srgb, var(--ink) 13%, var(--bg));
  --line-strong: color-mix(in srgb, var(--ink) 42%, var(--bg));
  --faint: var(--muted);
  --focus: var(--ink);

  /* ---- status ---- */
  --ok: #2f6b4a; --ok-bg: #e2efe7; --warn: #7a4f00; --warn-bg: #f7ead0; --bad: #a3321f; --bad-bg: #f6e1dc;

  /* ---- spacing scale: 4 8 12 16 24 32 48 64 96 ---- */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* ---- type scale ---- */
  /* one scale for the whole site: 12.5 label · 14 small · 15 body-small · 16 body · 18 lead · 20 title · 24 title-large */
  --fs-label: 12.5px;                       /* uppercase tracked labels only */
  --fs-xs: 14px; --fs-s: 15px; --fs-m: 16px; --fs-lg: 18px; --fs-h3: 20px; --fs-h3-lg: 24px; --fs-l: var(--fs-h3);
  --fs-h2: clamp(26px, 3.4vw, 34px);        /* section headings: UI face, tight */
  --fs-hero: clamp(44px, 6.6vw, 76px);      /* display face, hero only */

  /* ---- shape ---- */
  --r-s: 6px; --r: 10px; --r-l: 14px; --r-btn: 4px; --r-img: 4px;
  --shadow: 0 1px 2px rgba(36,32,38,.06), 0 8px 24px rgba(36,32,38,.07);
  --ease: cubic-bezier(.2,.7,.2,1);
  --photo-grade: saturate(.9) contrast(1.03) sepia(.05);   /* one shared grade so hero, work and team photos read as one business */

  /* ---- layout ---- */
  --max: 1200px;
  --gut: clamp(20px, 5.6vw, 24px);
  /* Reading widths, shared by every section so paragraphs never run too wide or too narrow:
     --measure-sm short statements and button-side copy, --measure-md body paragraphs, --measure-lg long descriptions. */
  --measure-sm: 30ch; --measure-md: 44ch; --measure-lg: 58ch;
}
@media (min-width: 720px) { :root { --gut: 32px; } }
@media (min-width: 1100px) { :root { --gut: 48px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; font: 400 16px/1.55 var(--body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--body); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin: 0; text-wrap: balance; }
.display { font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-track); line-height: var(--display-lh); }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
.sr-only, .sr-copy { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--s-2); top: -60px; background: var(--brand); color: var(--on-brand); padding: var(--s-3) var(--s-4); border-radius: var(--r-s); z-index: 100; }
.skip:focus { top: var(--s-2); }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

.wrap { width: min(var(--max), 100% - var(--gut) * 2); margin-inline: auto; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 48px; padding: 0 var(--s-5); border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); border-radius: var(--r-btn); font-weight: 500; font-size: var(--fs-s); letter-spacing: .01em; text-decoration: none; transition: background .18s, color .18s, border-color .18s, transform .15s var(--ease); white-space: nowrap; }
.btn:hover { background: color-mix(in srgb, var(--brand) 82%, var(--accent)); border-color: color-mix(in srgb, var(--brand) 82%, var(--accent)); }
.btn:active { transform: scale(.985); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.accent:hover { background: color-mix(in srgb, var(--accent) 84%, #000); border-color: color-mix(in srgb, var(--accent) 84%, #000); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--tint); border-color: var(--ink); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { min-height: 40px; padding: 0 var(--s-4); font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; }
.icon-btn:hover { background: var(--tint); }
.link { background: none; border: 0; padding: 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; color: var(--ink); font-weight: 500; }
.link:hover { text-decoration-color: var(--accent); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: var(--s-3); }
.field > label, .field > .lbl { font-size: 14px; font-weight: 500; }
.field .hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.field .err { font-size: var(--fs-xs); color: var(--bad); font-weight: 500; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=time], input[type=number], input[type=search], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s); transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
input[aria-invalid=true] { border-color: var(--bad); }
input[type=color] { width: 56px; height: 48px; padding: var(--s-1); border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--brand); }
.check { display: flex; gap: var(--s-3); align-items: flex-start; min-height: 44px; padding: var(--s-2) 0; cursor: pointer; }
.check span { display: grid; }
.check small { color: var(--muted); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- layout helpers ---------- */
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; gap: 0 var(--s-4); grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: var(--fs-s); margin-bottom: var(--s-4); max-width: 46ch; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px var(--s-3); border-radius: 999px; background: var(--tint); font-size: var(--fs-xs); font-weight: 500; color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); } .chip.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- sheet: centred panel on desktop, full-height on phones ----------
 * head (fixed) / .sheet-prog (fixed) / .sheet-body (scrolls) / .sheet-foot (fixed action bar)
 * Content scrolls in its own region, so nothing is ever hidden behind the header or the action bar. */
dialog.sheet { max-width: 100%; border: 0; padding: 0; width: min(540px, 100%); max-height: min(90dvh, 880px); background: var(--bg); color: var(--ink); border-radius: var(--r-l); box-shadow: 0 24px 80px rgba(20,16,14,.32); overflow: hidden; margin: auto; }
dialog.sheet.wide { width: min(720px, 100%); }
dialog.sheet[open] { display: flex; flex-direction: column; animation: rise .26s var(--ease); }
dialog.sheet::backdrop { background: rgba(26,22,28,.55); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-2) 0 var(--s-5); min-height: 52px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: var(--fs-m); font-weight: 600; letter-spacing: -.01em; }
.sheet-head .icon-btn { width: 40px; height: 40px; }
.sheet-prog { flex: none; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-5); min-height: 44px; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); }
.sheet-prog .back { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 0 -8px; padding: 0 var(--s-2); min-height: 40px; color: var(--ink); text-decoration: none; font-size: var(--fs-s); }
.sheet-prog .back[hidden] { display: none; }
.sheet-prog progress { flex: 1; min-width: 0; height: 3px; appearance: none; border: 0; background: var(--line); border-radius: 2px; overflow: hidden; }
.sheet-prog progress::-webkit-progress-bar { background: var(--line); }
.sheet-prog progress::-webkit-progress-value { background: var(--ink); transition: width .3s var(--ease); }
.sheet-prog progress::-moz-progress-bar { background: var(--ink); }
.sheet-prog .count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.sheet-body { flex: 1 1 auto; padding: var(--s-5); overflow: auto; overscroll-behavior: contain; min-height: 0; }
.sheet-foot { flex: none; display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-5) calc(var(--s-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.sheet-foot .btn { flex: 1 1 0; }
.sheet-foot .btn.grow { flex: 2 1 0; }
.sheet-foot[hidden], .sheet-prog[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
@media (max-width: 640px) {
  dialog.sheet, dialog.sheet.wide { width: 100%; max-height: calc(100dvh - var(--s-4)); margin: auto 0 0; border-radius: var(--r-l) var(--r-l) 0 0; }
  dialog.sheet.booking { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  dialog.sheet.booking.compact { height: fit-content; max-height: 100dvh; border-radius: var(--r-l) var(--r-l) 0 0; }
  .sheet-head { padding-left: var(--gut); }
  .sheet-prog { padding-inline: var(--gut); }
  .sheet-body { padding: var(--s-4) var(--gut) calc(var(--s-5) + env(safe-area-inset-bottom)); }
  .sheet-foot { padding-inline: var(--gut); }
  dialog.sheet:has(.sheet-foot:not([hidden])) .sheet-body { padding-bottom: var(--s-4); }
}

#toast { position: fixed; left: 50%; bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: var(--s-3) var(--s-5); border-radius: var(--r-btn); font-weight: 500; font-size: var(--fs-s); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--ease); z-index: 200; max-width: calc(100% - var(--s-6)); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
#toast.ok { background: var(--ok); color: #fff; }

.demo-banner { background: var(--ink); color: color-mix(in srgb, var(--bg) 85%, var(--ink)); font-size: var(--fs-xs); text-align: center; padding: var(--s-2) var(--s-4); line-height: 1.4; }
.demo-banner a { color: var(--bg); font-weight: 500; text-underline-offset: 3px; }
