/*
 * engine.css — the functional components every business site ships with.
 * Load it AFTER the business's own styles.css. It reads only these tokens,
 * which styles.css must define on :root (the design is the business's, not this file's):
 *
 *   --surface      reading surface for dialogs/forms (e.g. the site's light board colour)
 *   --field        input background            --line     input/divider line colour
 *   --ink          main text                   --ink-2    secondary text
 *   --accent       primary action / errors     --accent-deep  darker accent (error text)
 *   --ok           success colour (copied)     --ease-out     e.g. cubic-bezier(0.23, 1, 0.32, 1)
 *   --body         body font stack             --display  display font stack
 *   --fab-bg / --fab-ink   (optional) floating button colours; default accent / surface
 *   --radius       control corner radius
 *
 * Buttons: the engine uses the business's own button class on its buttons. Set it in
 * index.html (the template uses class="btn btn--primary" / "btn btn--quiet"; rename to
 * the design's own button classes).
 */

[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 700;
}
.skip:focus { top: 12px; }

/* ── Compose dialog ───────────────────────────────────────── */
.compose {
  width: min(520px, calc(100% - 32px)); max-width: none;
  padding: 0; border: 0; border-radius: calc(var(--radius) + 10px);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out), overlay 220ms allow-discrete, display 220ms allow-discrete;
}
@starting-style { .compose[open] { opacity: 0; transform: scale(0.96) translateY(8px); } }
.compose::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.compose__card { display: grid; gap: 14px; padding: 28px 26px 24px; }
.compose__title { font-family: var(--display); font-weight: 400; font-size: 1.8rem; line-height: 1.1; color: var(--accent); margin: 0; }
.compose__hint { color: var(--ink-2); font-size: 1rem; margin: 0; }
.compose textarea, .field input:not([type="checkbox"]), .field select, .field textarea {
  width: 100%; min-height: 52px;
  font: inherit; font-size: 1.1rem; color: var(--ink);
  background: var(--field); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color 160ms ease;
}
.compose textarea { resize: vertical; min-height: 9.5em; line-height: 1.5; }
.compose textarea:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 2px; border-color: transparent;
}
.compose__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.compose__actions > :first-child { flex: 1 1 220px; }
.compose__status { font-weight: 700; color: var(--accent-deep); margin: 0; }
.compose__status:empty { display: none; }
.compose__next {
  display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--field); box-shadow: inset 0 0 0 2px var(--line);
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}
@starting-style { .compose__next { opacity: 0; transform: translateY(6px); } }
.compose__done { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--ok); margin: 0; }
.compose__done svg { width: 1.4em; height: 1.4em; }
.compose__steps { margin: 0; padding-inline-start: 1.3em; display: grid; gap: 2px; color: var(--ink-2); }
.compose__next > a { justify-self: start; }

/* ── Contact form ─────────────────────────────────────────── */
.cform { display: grid; gap: 18px; }
.cform__row { display: grid; gap: 18px; }
@media (min-width: 760px) { .cform__row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 800; font-size: 1.05rem; }
.field__req, .field__opt { font-weight: 600; color: var(--ink-2); font-size: 0.95rem; }
.field input[type="tel"] { text-align: right; }
.field textarea { resize: vertical; min-height: 7.5em; line-height: 1.5; }
.field select {
  appearance: none; -webkit-appearance: none;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23333' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat left 14px center / 18px;
  padding-left: 42px;
}
.field input[aria-invalid="true"]:not([type="checkbox"]), .field textarea[aria-invalid="true"] { border-color: var(--accent); }
.field__error { color: var(--accent-deep); font-weight: 700; font-size: 0.98rem; margin: 0; }
.field--check { grid-template-columns: auto 1fr; align-items: start; gap: 4px 12px; }
.field--check input { width: 24px; height: 24px; margin-top: 3px; accent-color: var(--accent); }
.field--check label { font-weight: 600; }
.field--check .field__error { grid-column: 2; }
.cform__note { color: var(--ink-2); font-size: 0.98rem; margin: 0; }
.cform__submit { justify-self: start; }

/* ── Opening hours ────────────────────────────────────────── */
[data-hours] dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 24px; margin: 0; font-variant-numeric: tabular-nums; }
[data-hours] dd { margin: 0; }

/* ── Floating message button ───────────────────────────────
   Sits in the inline-end corner; site.js lifts it to dodge text and controls and
   gives it a small spring on scroll. Optional tokens: --fab-bg, --fab-ink. */
.fab {
  position: fixed; z-index: 40;
  inset-inline-end: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  width: 62px; height: 62px;
  will-change: transform;
  pointer-events: none;
}
.fab__btn {
  pointer-events: auto;
  display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--fab-bg, var(--accent)); color: var(--fab-ink, var(--surface));
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.55);
  transition: opacity 220ms var(--ease-out), transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.fab__btn svg { width: 30px; height: 30px; }
.fab__btn:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) { .fab__btn:hover { filter: brightness(0.9); } }
.fab.is-hidden .fab__btn { opacity: 0; transform: scale(0.6); pointer-events: none; transition: opacity 160ms ease, transform 200ms var(--ease-out); }

/* ── Scroll fade (site.js adds .rv / .is-in / .from-top) ───── */
.js .rv { opacity: 0; transform: translateY(28px); filter: blur(4px); transition: none; }
.js .rv.from-top { transform: translateY(-28px); }
.js .rv.rv--section { transform: none; filter: none; }
.js .rv.is-in {
  opacity: 1; transform: none; filter: blur(0);
  transition: opacity 700ms var(--ease-out), transform 800ms var(--ease-out), filter 700ms var(--ease-out);
  transition-delay: var(--rv-delay, 0ms);
}
.js .rv.rv--section.is-in { transition: opacity 900ms var(--ease-out); }

/* ── Legal / document pages ───────────────────────────────── */
.doc { display: grid; gap: 18px; max-width: 860px; margin-inline: auto; }
.doc h2 { font-size: 1.35rem; font-weight: 800; margin: 10px 0 0; }
.doc ul { margin: 0; padding-inline-start: 1.2em; }
.doc p, .doc li { max-width: 68ch; }
.doc a { color: var(--accent); }
.doc__links { padding-top: 14px; border-top: 2px solid var(--line); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv, .js .rv.from-top { transform: none; filter: none; }
  .js .rv.is-in { transition: opacity 300ms ease; transition-delay: 0ms; }
  .fab__btn { transition: opacity 200ms ease; }
  .fab.is-hidden .fab__btn { transform: none; }
}
