/*
 * Charlotte Eleanor — booking and diary styles.
 *
 * Written for a phone held at arm's length in a kitchen. Everything here is
 * sized up from a typical web app: 19px base text, 60px minimum touch targets,
 * and contrast that clears WCAG AAA on body copy rather than scraping AA.
 *
 * If the main site's variables change, the eight colours in :root are the only
 * things that need to match.
 */

:root {
  /* Brand */
  --ink:          #241318;   /* the site's dark band */
  --heather:      #7C5A72;
  --heather-deep: #5E4256;   /* 7.1:1 on cream — safe for text */
  --brass:        #8A6A2F;

  /* Surfaces */
  --cream:        #FBF8F7;
  --card:         #FFFFFF;
  --tint:         #F3ECEF;
  --hairline:     #E3D8DC;   /* decorative dividers only, never a control edge */
  --rule:         #9D8C95;   /* 3.0:1 on cream — WCAG 1.4.11 needs 3:1 for control edges */

  /* Text */
  --body:         #33292E;   /* 11.9:1 on cream */
  --muted:        #61535A;   /*  6.4:1 on cream */

  /* Meaning */
  --good:         #2F5C44;
  --good-tint:    #E6F0EA;
  --warn:         #7A5A20;
  --warn-tint:    #F7F0E1;
  --stop:         #96382F;
  --stop-tint:    #FAE8E6;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(36,19,24,.06), 0 8px 24px rgba(36,19,24,.05);
  --focus:  0 0 0 3px var(--cream), 0 0 0 6px var(--heather);

  /* em-based, so the scale follows the body size rather than the 16px root */
  --step-1: .82em;
  --step0:  1em;
  --step1:  1.12em;
  --step2:  1.35em;
  --step3:  1.6em;
  --step4:  1.95em;
}

*, *::before, *::after { box-sizing: border-box; }

/* [hidden] must beat any display a class sets, or hiding silently fails. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  /* Nothing may push the page sideways. Wide content scrolls inside its own box. */
  overflow-x: hidden;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--cream);
  color: var(--body);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  color: var(--ink);
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
  line-height: 1.15;
}
h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); letter-spacing: -.015em; }
/* Long words break rather than widen the page. */
h1, h2, h3, p, dd, .choice-label, .choice-detail { overflow-wrap: break-word; }
h2 { font-size: clamp(1.45rem, 6vw, 1.9rem); }
h3 { font-size: var(--step1); font-weight: 600; font-family: inherit; }
p  { margin: 0; }

a { color: var(--heather-deep); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 6px;
}
/* Headings are focused when a step changes so screen readers announce it.
   That is a programmatic move, not keyboard navigation — no ring wanted. */
:where(h1, h2, h3)[tabindex="-1"]:focus,
:where(h1, h2, h3)[tabindex="-1"]:focus-visible { box-shadow: none; outline: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 20;
  background: var(--ink); color: var(--cream);
  padding: .75rem 1.1rem; border-radius: 6px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- shell ---------- */

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1.15rem 5rem;
}
.page--wide { max-width: 54rem; }

.masthead {
  display: flex; flex-direction: column; gap: .35rem;
  padding-bottom: 1.25rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--hairline);
}
.masthead .brand {
  font-family: Newsreader, Georgia, serif;
  font-size: var(--step1); color: var(--ink); letter-spacing: .01em;
}
.masthead .tag { font-size: var(--step-1); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

/* ---------- shell: content + sticky summary rail ---------- */

.shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
@media (min-width: 900px) {
  .page { max-width: 66rem; }
  .shell { grid-template-columns: minmax(0, 1fr) 20.5rem; align-items: start; }
  .rail { position: sticky; top: 1rem; }
}
.summary { background: var(--card); border: 1px solid var(--hairline); border-radius: 14px;
  box-shadow: var(--shadow); overflow: hidden; }
.summary-head { background: var(--ink); color: #fff; padding: 1rem 1.15rem;
  display: flex; flex-direction: column; gap: .1rem; }
.summary-head .s-brand { font-family: Newsreader, Georgia, serif; font-size: 1.06rem; }
.summary-head .s-sub { font-size: .72rem; color: #C9B4BE; letter-spacing: .07em; text-transform: uppercase; }
.summary-body { padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .55rem; }
.s-row { display: flex; justify-content: space-between; gap: .8rem; font-size: .95em; }
.s-row .k { color: var(--muted); }
.s-row .v { font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.s-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.s-chip { font-size: .72rem; font-weight: 700; color: var(--heather-deep);
  background: var(--tint); border-radius: 5px; padding: .15em .5em; }
.s-total { border-top: 1px solid var(--hairline); padding-top: .55rem; }
.s-total .s-row .v { font-size: 1.1em; }
.s-note { font-size: .78rem; color: var(--muted); }
.s-empty { color: var(--muted); font-size: .92em; }

/* mobile bottom bar version of the summary */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--ink);
  color: #fff; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 1rem; box-shadow: 0 -6px 20px rgba(36,19,24,.25); }
.bar .b-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.bar .b-line { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .b-sub { font-size: .75rem; color: #C9B4BE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .b-price { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (min-width: 900px) { .bar { display: none; } }
body:has(.bar:not([hidden])) .page { padding-bottom: 7.5rem; }

/* ---------- stage breadcrumb ---------- */

.crumbs { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin-bottom: 1.5rem;
  font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.crumb::after { content: "\203A"; color: var(--rule); }
.crumb:last-child::after { content: ""; }
.crumb[data-state="current"] { color: var(--heather-deep); font-weight: 700; }
.crumb[data-state="done"] { color: var(--good); }
.crumb[data-state="done"]::before { content: "\2713 "; font-weight: 700; }

/* ---------- category pills ---------- */

.pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill { font: inherit; font-size: .92rem; font-weight: 600; color: var(--ink);
  background: var(--card); border: 2px solid var(--rule); border-radius: 99px;
  padding: .45rem 1.05rem; min-height: 2.9rem; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill-count { display: inline-grid; place-items: center; min-width: 1.35em; height: 1.35em;
  margin-left: .3em; border-radius: 99px; background: var(--heather); color: #fff;
  font-size: .78em; font-weight: 700; }
.pill[aria-pressed="true"] .pill-count { background: #fff; color: var(--ink); }

/* ---------- date chips ---------- */

.datestrip { display: flex; gap: .55rem; overflow-x: auto; padding: .2rem .1rem .5rem;
  scrollbar-width: thin; }
.datechip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  gap: .05rem; min-width: 5.8rem; padding: .6rem .8rem; border: 2px solid var(--rule);
  border-radius: var(--radius); background: var(--card); font: inherit; cursor: pointer;
  color: var(--body); }
.datechip .dow { font-size: .76em; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.datechip .dnum { font-size: 1.2em; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.datechip .dbadge { font-size: .6em; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--good); background: var(--good-tint); border-radius: 4px; padding: .1em .4em; margin-top: .15rem; }
.datechip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.datechip[aria-pressed="true"] .dow, .datechip[aria-pressed="true"] .dnum { color: #fff; }

.month-heading { font-size: var(--step0); font-weight: 600; color: var(--muted);
  letter-spacing: .02em; margin: -.4rem 0 .6rem; }

/* service-card meta with price and duration stacked */
.choice-meta-col { display: flex; flex-direction: column; align-items: flex-end; gap: .05rem;
  margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.choice-meta-col .price { font-size: .92em; color: var(--heather-deep); font-weight: 700; }
.choice-meta-col .mins { font-size: .78em; color: var(--muted); }

/* ---------- progress ---------- */

.progress { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.75rem; }
.progress-text { font-size: var(--step-1); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.progress-track { height: 8px; background: var(--hairline); border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%; background: var(--heather); border-radius: 99px;
  transition: width .35s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } }

/* ---------- steps ---------- */

.step { display: none; flex-direction: column; gap: 1.5rem; }
.step[data-active] { display: flex; }

.step-head { display: flex; flex-direction: column; gap: .5rem; }
.step-head p { color: var(--muted); font-size: var(--step0); max-width: 34rem; }

/* ---------- choice cards ---------- */

.choices { display: flex; flex-direction: column; gap: .65rem; }
.choices--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

.choice {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  width: 100%; min-height: 4rem; padding: 1rem 1.15rem;
  background: var(--card); color: var(--body);
  border: 2px solid var(--rule); border-radius: var(--radius);
  font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice:hover { border-color: var(--heather); }
.choice[aria-pressed="true"] {
  border-color: var(--heather-deep);
  background: var(--tint);
  box-shadow: inset 0 0 0 1px var(--heather-deep);
}
.choice-body { display: flex; flex-direction: column; gap: .12rem; flex: 1; min-width: 0; }
.choice-label { font-size: var(--step1); font-weight: 600; color: var(--ink); }
.choice-detail { font-size: var(--step-1); color: var(--muted); }
.choice-meta {
  font-size: var(--step-1); color: var(--heather-deep); font-weight: 600;
  white-space: nowrap; font-variant-numeric: tabular-nums; margin-left: auto;
}
.choice-figure { flex: 0 0 auto; width: 3rem; height: 3.4rem; }

/* the tick, so selection is not carried by colour alone */
.choice-mark {
  flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 2px solid var(--rule); display: grid; place-items: center;
}
.choice[aria-pressed="true"] .choice-mark { background: var(--heather-deep); border-color: var(--heather-deep); }
.choice-mark svg { width: .9rem; height: .9rem; opacity: 0; }
.choice[aria-pressed="true"] .choice-mark svg { opacity: 1; }

.group-label {
  font-size: var(--step-1); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-top: .75rem;
}
.group-label:first-child { margin-top: 0; }

/* ---------- fields ---------- */

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 600; color: var(--ink); font-size: var(--step0); }
.field .hint { font-size: var(--step-1); color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; font-size: var(--step1);
  padding: .8rem .9rem; min-height: 3.4rem;
  border: 2px solid var(--rule); border-radius: var(--radius);
  background: var(--card); color: var(--body); width: 100%;
}
.field textarea { min-height: 6rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--heather); }
.field[data-invalid] input, .field[data-invalid] select, .field[data-invalid] textarea { border-color: var(--stop); }
.field-error { font-size: var(--step-1); color: var(--stop); font-weight: 600; }

.fields { display: flex; flex-direction: column; gap: 1.15rem; }

/* ---------- quote panel ---------- */

.quote {
  background: var(--ink); color: #F1E7EB;
  border-radius: var(--radius); padding: 1.35rem;
  display: flex; flex-direction: column; gap: .9rem;
}
.quote h3 { color: #fff; font-family: Newsreader, Georgia, serif; font-size: var(--step2); font-weight: 500; }
.quote-rows { display: flex; flex-direction: column; gap: .45rem; }
.quote-row { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--step0); }
.quote-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; color: #fff; }
.quote-total {
  border-top: 1px solid rgba(255,255,255,.22); padding-top: .7rem;
  font-size: var(--step1);
}
.quote-note { font-size: var(--step-1); color: #C9B4BE; }

/* ---------- notices ---------- */

.notice {
  border-radius: var(--radius); padding: 1.1rem 1.2rem;
  display: flex; flex-direction: column; gap: .4rem;
  border-left: 5px solid;
}
.notice h3 { font-size: var(--step0); }
.notice p { font-size: var(--step0); }
.notice--info { background: var(--warn-tint); border-color: var(--brass); }
.notice--info h3 { color: var(--warn); }
.notice--good { background: var(--good-tint); border-color: var(--good); }
.notice--good h3 { color: var(--good); }
.notice--stop { background: var(--stop-tint); border-color: var(--stop); }
.notice--stop h3 { color: var(--stop); }

/* ---------- day / slot picker ---------- */

.days { display: flex; flex-direction: column; gap: 1.1rem; }
.day { display: flex; flex-direction: column; gap: .6rem; }
.day-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.day-name { font-size: var(--step1); font-weight: 600; color: var(--ink); }
.badge {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700;
  padding: .2rem .5rem; border-radius: 4px; background: var(--good-tint); color: var(--good);
}
.slots { display: flex; flex-wrap: wrap; gap: .55rem; }
.slot {
  min-height: 3.4rem; padding: .7rem 1.1rem;
  border: 2px solid var(--rule); border-radius: var(--radius);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: var(--step1); font-weight: 600;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.slot:hover { border-color: var(--heather); }
.slot[aria-pressed="true"] { background: var(--heather-deep); border-color: var(--heather-deep); color: #fff; }

.step-nudge {
  margin-top: 1.25rem; padding: .8rem 1rem;
  background: var(--warn-tint); border-left: 5px solid var(--brass);
  border-radius: var(--radius); color: var(--warn); font-weight: 600;
  font-size: var(--step0);
}

/* ---------- actions ---------- */

.actions {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
  padding-top: .5rem;
}
.button {
  font: inherit; font-size: var(--step1); font-weight: 600;
  min-height: 3.6rem; padding: .85rem 1.6rem;
  border-radius: var(--radius); border: 2px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  text-decoration: none;
}
.button--primary { background: var(--ink); color: #fff; }
.button--primary:hover { background: #352027; }
.button--primary[disabled] { background: var(--rule); color: var(--muted); cursor: not-allowed; }
.button--quiet { background: transparent; color: var(--heather-deep); border-color: var(--rule); }
.button--quiet:hover { border-color: var(--heather); }

.helpline {
  margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--hairline);
  font-size: var(--step0); color: var(--muted);
}
.helpline a { font-weight: 600; white-space: nowrap; }

.loading { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: var(--step0); }
.spinner {
  width: 1.2rem; height: 1.2rem; border-radius: 50%;
  border: 3px solid var(--rule); border-top-color: var(--heather);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- diary ---------- */

.diary-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.75rem;
}
.summary-cell { background: var(--card); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; }
.summary-cell .n { font-size: var(--step3); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.summary-cell .l { font-size: var(--step-1); color: var(--muted); }

.stops { display: flex; flex-direction: column; gap: 0; list-style: none; margin: 0; padding: 0; }
.leg {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 0 .6rem 1.4rem; color: var(--muted); font-size: var(--step-1);
  border-left: 2px dashed var(--rule); margin-left: 1.4rem;
}
.stop {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.15rem 1.25rem; display: flex; flex-direction: column; gap: .8rem;
  box-shadow: var(--shadow);
}
.stop-head { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.stop-time { font-size: var(--step2); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stop-service { font-size: var(--step1); font-weight: 600; color: var(--heather-deep); }
/* A held slot is not a booking. Said in words and given a border, never in
   colour alone — the brief is a 70-year-old to an 18-year-old. */
.stop-held { display: inline-block; padding: 0.15em 0.7em; border: 2px solid var(--heather-deep);
  border-radius: 999px; font-size: 0.78em; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--heather-deep); }
.stop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .8rem 1.5rem; }
.stop-item { display: flex; flex-direction: column; }
.stop-item dt { font-size: var(--step-1); color: var(--muted); }
.stop-item dd { margin: 0; font-size: var(--step0); color: var(--body); }
.stop-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.stop-actions .button { min-height: 3rem; font-size: var(--step0); padding: .6rem 1.1rem; }

@media (min-width: 40rem) {
  body { font-size: 20px; }
}

@media print {
  body { background: #fff; font-size: 12pt; }
  .no-print { display: none !important; }
  .stop { break-inside: avoid; box-shadow: none; }
}

/* On desktop the rail already carries the numbers - one source of truth per viewport. */
@media (min-width: 900px) { .step[data-step="time"] .quote { display: none; } }

/* ---------------------------------------------------------------------------
   The staff form on the day sheet (task 02b).

   A tool, not a journey. Everything on one screen, laid out to be filled in
   with a keyboard while somebody is on the phone. Nothing here is reachable
   from /book/ — the client flow needs the opposite shape and must not inherit
   this one.
   --------------------------------------------------------------------------- */

.staff-panel {
  margin-top: 2.5rem; padding: 1.5rem 1.5rem 1.75rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 1.1rem;
}
.staff-panel h2 { margin: 0; font-size: var(--step2); color: var(--ink); }
.staff-lede { margin: 0; color: var(--muted); font-size: var(--step-1); max-width: 46em; }

#add-form { display: flex; flex-direction: column; gap: 1.1rem; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.1rem; }

/* `.field label` already carries this; a labelled GROUP has no label element. */
.field-label { font-weight: 600; color: var(--ink); font-size: var(--step0); }

.ticks { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .4rem; }
.tick {
  display: flex; align-items: center; gap: .7rem; min-height: 3.4rem;
  padding: .5rem .8rem; border: 1px solid var(--rule); border-radius: var(--radius);
  cursor: pointer; font-size: var(--step0);
}
.tick:hover { border-color: var(--heather); }
/* Selection is never carried by colour alone — the tick itself is the signal
   and the border only reinforces it. */
.tick:has(input:checked) { border-color: var(--heather-deep); border-width: 2px; background: var(--tint); }
.tick input { width: 1.4em; height: 1.4em; flex: none; accent-color: var(--heather-deep); }
.tick-note { color: var(--muted); font-size: var(--step-1); }

.staff-suggestion { margin: 0; font-size: var(--step0); color: var(--body); }

.staff-details > summary {
  cursor: pointer; padding: .8rem 0; font-weight: 600; color: var(--heather-deep);
  font-size: var(--step0); min-height: 3rem; display: flex; align-items: center;
}
.staff-details[open] > summary { margin-bottom: .8rem; }

/* Move and cancel, inline on the row they belong to. */
.row-form {
  margin-top: .4rem; padding: 1.1rem; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--tint);
  display: flex; flex-direction: column; gap: .9rem;
}
.row-form h3 { margin: 0; font-size: var(--step1); color: var(--ink); }
.row-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .9rem; }

/* An overridden booking says so in words, not in a colour. */
.stop-squeezed {
  display: inline-block; padding: 0.15em 0.7em; border: 2px solid var(--warn);
  border-radius: 999px; font-size: 0.78em; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--warn);
}
