/* ============================================================
   components.css — the component library.
   Every component is base class + modifier classes.
   States (hover/focus/disabled) are defined ONCE on the base.
   Catalogue each component in COMPONENTS.md.
   ============================================================ */

/* ---- Button ------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font: inherit;
  font-weight: var(--weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}
.btn:hover    { transform: translateY(-1px); }
.btn:active   { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary   { background: var(--color-brand); color: #fff; }
.btn--primary:hover { background: var(--color-brand-hover); }
.btn--secondary { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn--secondary:hover { border-color: var(--color-brand); }
.btn--ghost     { background: transparent; color: var(--color-brand); padding-inline: var(--space-2); }
.btn--danger    { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: color-mix(in srgb, var(--color-danger) 85%, #000); }

/* Sizes — share the control-height scale so buttons line up with inputs */
.btn--sm { height: var(--control-height-sm); padding-inline: var(--space-3); font-size: var(--text-sm); }
.btn--lg { height: var(--control-height-lg); padding-inline: var(--space-8); font-size: var(--text-lg); }
.btn { height: var(--control-height); }
.btn--block { width: 100%; }

/* ---- Card -------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}
.card--featured { border-color: var(--color-brand); box-shadow: var(--shadow-md); }
.card__title { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.card__body  { color: var(--color-text-muted); }

/* ---- Nav --------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding-block: var(--space-4);
}
.nav__links { display: flex; gap: var(--space-6); align-items: center; }
.nav__brand { font-weight: var(--weight-bold); color: var(--color-text); }
.nav__links a[aria-current="page"] { color: var(--color-text); font-weight: var(--weight-medium); }
/* Hamburger toggle — hidden on desktop, revealed on mobile only once JS
   enhances the nav. Without JS the links simply wrap (see below). */
.nav__toggle {
  display: none; align-items: center; justify-content: center;
  width: var(--control-height); height: var(--control-height); padding: 0;
  color: var(--color-text); background: transparent;
  border: 1px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer;
}
.nav__toggle:hover { border-color: var(--color-brand); }
.nav__toggle:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
@media (max-width: 640px) {
  .nav { flex-wrap: wrap; }
  /* No-JS fallback: the links wrap onto their own row and stay reachable. */
  .nav__links { flex-wrap: wrap; flex-basis: 100%; gap: var(--space-4); }
  /* Enhanced: the toggle controls a stacked disclosure menu. */
  .nav.is-enhanced .nav__toggle { display: inline-flex; }
  .nav.is-enhanced .nav__links { display: none; flex-direction: column; align-items: stretch; flex-basis: 100%; }
  .nav.is-enhanced .nav__links.is-open { display: flex; }
  .nav.is-enhanced .nav__links a { padding-block: var(--space-2); }
}

/* ---- Icon -------------------------------------------------
   <svg class="icon"><use href="assets/icons.svg#icon-NAME"></use></svg>
   Sizes in em so an icon scales with its surrounding text. */
.icon {
  width: 1.25em; height: 1.25em;
  flex: 0 0 auto;
  vertical-align: -0.18em;   /* optical alignment with text baseline */
  color: inherit;            /* strokes use currentColor */
}
.icon--sm { width: 1em;   height: 1em;   vertical-align: -0.12em; }
.icon--lg { width: 1.5em; height: 1.5em; vertical-align: -0.25em; }
.icon--xl { width: 2rem;  height: 2rem; }

/* ---- External icon utility (Lucide / Iconoir) -------------
   Renders any monochrome SVG via CSS mask so it inherits
   currentColor — works with Lucide & Iconoir CDN files alike:
   <i class="ico" style="--ico:url('…/coffee.svg')" aria-hidden="true"></i>
   Stroke icons stay crisp; multicolour icons aren't supported (by design). */
.ico {
  display: inline-block;
  width: 1.25em; height: 1.25em;
  flex: 0 0 auto;
  vertical-align: -0.18em;
  background-color: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
          mask: var(--ico) center / contain no-repeat;
}
.ico--sm { width: 1em;   height: 1em;   vertical-align: -0.12em; }
.ico--lg { width: 1.5em; height: 1.5em; vertical-align: -0.25em; }
.ico--xl { width: 2rem;  height: 2rem; }

/* ---- 2. Form field ---------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); max-width: var(--max-width-prose); }
.field__label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text); }
.field__label .req { color: var(--color-danger); }
.field__hint  { font-size: var(--text-xs); color: var(--color-text-muted); }
.field__error { font-size: var(--text-xs); color: var(--color-danger); }

.input {
  height: var(--control-height);
  padding: 0 var(--space-3);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea.input { height: auto; padding-block: var(--space-3); resize: vertical; min-height: 6rem; }
.input::placeholder { color: var(--color-text-muted); }
.input:hover { border-color: color-mix(in srgb, var(--color-border) 60%, var(--color-text-muted)); }
.input:focus-visible {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand) 30%, transparent);
}
.input:disabled { opacity: 0.5; cursor: not-allowed; }
/* Invalid state — paired with .field__error text, never colour alone */
.field--invalid .input,
.input[aria-invalid="true"] {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger) 25%, transparent);
}

/* ---- 7. Alert (static) + Toast (transient) ---------------- */
.alert {
  display: flex; gap: var(--space-3); align-items: start;
  padding: var(--space-4); border: 1px solid var(--color-border);
  border-left-width: 4px; border-radius: var(--radius-md);
  background: var(--color-surface);
}
.alert__title { font-weight: var(--weight-medium); }
.alert__body  { color: var(--color-text-muted); font-size: var(--text-sm); }
.alert--info    { border-left-color: var(--color-brand);   background: color-mix(in srgb, var(--color-brand) 8%, var(--color-surface)); }
.alert--success { border-left-color: var(--color-success); background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface)); }
.alert--warn    { border-left-color: var(--color-warn);    background: color-mix(in srgb, var(--color-warn) 8%, var(--color-surface)); }
.alert--danger  { border-left-color: var(--color-danger);  background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface)); }

.toast-region {
  position: fixed; bottom: var(--space-6); right: var(--space-6); z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--space-3); width: min(22rem, calc(100vw - var(--space-8)));
}
.toast {
  display: flex; gap: var(--space-3); align-items: start;
  padding: var(--space-4); background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  animation: toast-in var(--transition-base);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(var(--space-2)); } }

/* ---- Site footer — .site-footer --------------------------- */
.site-footer { border-top: 1px solid var(--color-border); background: var(--color-surface); }
.site-footer__top {
  display: grid; gap: var(--space-12);
  grid-template-columns: 1.5fr repeat(3, 1fr);
  padding-block: var(--space-16);
}
.site-footer__brand { display: flex; flex-direction: column; gap: var(--space-3); max-width: 22rem; }
.site-footer__brandname { font-weight: var(--weight-bold); color: var(--color-text); }
.site-footer__tagline { color: var(--color-text-muted); font-size: var(--text-sm); }
.site-footer__col { display: flex; flex-direction: column; gap: var(--space-3); }
.site-footer__heading {
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted);
}
.site-footer__col a { color: var(--color-text-muted); font-size: var(--text-sm); }
.site-footer__col a:hover { color: var(--color-text); }
.site-footer__bottom {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  flex-wrap: wrap; padding-block: var(--space-6);
  border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-sm);
}
.site-footer__social { display: flex; gap: var(--space-3); }
.site-footer__social a { color: var(--color-text-muted); }
.site-footer__social a:hover { color: var(--color-brand); }
@media (max-width: 768px) {
  .site-footer__top { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .site-footer__brand { grid-column: 1 / -1; }
}

/* ---- 10. Badge (semantic; supersedes plain .pill) --------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-medium);
  border-radius: var(--radius-full); background: var(--color-surface-2);
  color: var(--color-text-muted); border: 1px solid var(--color-border);
}
.badge--brand   { background: color-mix(in srgb, var(--color-brand) 15%, transparent);   color: var(--color-link);   border-color: transparent; }
.badge--success { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); border-color: transparent; }
.badge--warn    { background: color-mix(in srgb, var(--color-warn) 15%, transparent);    color: var(--color-warn);    border-color: transparent; }
.badge--danger  { background: color-mix(in srgb, var(--color-danger) 15%, transparent);  color: var(--color-danger);  border-color: transparent; }
.badge--dot::before { content: ""; width: 0.5em; height: 0.5em; border-radius: var(--radius-full); background: currentColor; }

/* ============================================================
   PHASE 1 — Integrations (Irish SMB). See specs/integrations.md
   and specs/personas.md. Three components ship together:
   .enquiry (lead form) · .pay (Stripe deposit) · .consent (banner)
   ============================================================ */

/* ---- Choice control (checkbox / radio row) ----------------
   Used for the consent + marketing opt-ins. The control is a row,
   not a column, so the label sits beside the box. Consent boxes
   are NEVER pre-checked — that's enforced in markup, not CSS. */
.choice { display: flex; gap: var(--space-3); align-items: flex-start; cursor: pointer; }
.choice input[type="checkbox"], .choice input[type="radio"] {
  flex: 0 0 auto; width: 1.15em; height: 1.15em; margin-top: 0.15em;
  accent-color: var(--color-brand); cursor: pointer;
}
.choice__text { font-size: var(--text-sm); color: var(--color-text); }
.choice__text a { color: var(--color-brand); text-decoration: underline; }
.choice__hint { display: block; color: var(--color-text-muted); font-size: var(--text-xs); margin-top: var(--space-1); }
.choice:has(input:focus-visible) .choice__text {
  outline: 2px solid var(--color-brand); outline-offset: 3px; border-radius: var(--radius-sm);
}

/* ---- Enquiry form — .enquiry ------------------------------
   A token-styled lead form. Works with zero JS (native validation +
   a normal POST); ui.js only adds inline errors + a success state.
   The honeypot field is visually hidden but reachable by bots. */
.enquiry { display: grid; gap: var(--space-4); max-width: 34rem; }
.enquiry__row { display: grid; gap: var(--space-4); }
@media (min-width: 560px) { .enquiry__row--2 { grid-template-columns: 1fr 1fr; } }
.enquiry .field { max-width: none; }
/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.enquiry__pot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.enquiry__consent { display: grid; gap: var(--space-3); padding: var(--space-4);
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.enquiry__status { font-size: var(--text-sm); }
.enquiry[data-state="sent"] .enquiry__form { display: none; }
.enquiry__sent { display: none; }
.enquiry[data-state="sent"] .enquiry__sent { display: flex; }

/* ---- Consent banner — .consent ---------------------------
   GDPR/ePrivacy gate. No third-party script with cookies loads
   until the visitor accepts. Hidden by default; ui.js reveals it
   when no prior choice is stored, and re-hides on a decision. */
.consent {
  position: fixed; inset: auto var(--space-4) var(--space-4) var(--space-4);
  z-index: var(--z-overlay); margin-inline: auto; max-width: 40rem;
  display: none; gap: var(--space-4); align-items: center; flex-wrap: wrap;
  padding: var(--space-6); background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.consent[data-open] { display: flex; }
.consent__text { flex: 1 1 16rem; font-size: var(--text-sm); color: var(--color-text-muted); }
.consent__text strong { color: var(--color-text); }
.consent__text a { color: var(--color-brand); text-decoration: underline; }
.consent__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }
/* A consent-gated embed shows its façade until consent is granted. */
.embed-gate__facade { display: grid; place-items: center; gap: var(--space-3); min-height: 16rem;
  padding: var(--space-6); text-align: center; background: var(--color-surface);
  border: 1px dashed var(--color-border); border-radius: var(--radius-lg); color: var(--color-text-muted); }
[data-consent-granted] .embed-gate__facade { display: none; }
.embed-gate__live { display: none; }
[data-consent-granted] .embed-gate__live { display: block; }
/* Demo stand-in shown in place of a real iframe on the reference pages. */
.embed-gate__placeholder { display: grid; place-items: center; min-height: 8rem; margin: 0;
  padding: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--color-text-muted);
  background: var(--color-surface); border: 1px dashed var(--color-border); border-radius: var(--radius-lg); }

/* ============================================================
   PHASE 2 — Scheduling + Maps & reviews (Irish SMB).
   ============================================================ */

/* ---- Scheduler — .scheduler -------------------------------
   A consent-gated booking embed. Reuses .embed-gate, adding a
   provider-branded façade so the page stays fast/cookie-free
   until the visitor chooses to load Acuity / Calendly / Cal.com. */
.scheduler { max-width: 44rem; }
.scheduler__facade { display: grid; gap: var(--space-4); justify-items: center; text-align: center;
  min-height: 18rem; padding: var(--space-8); background: var(--color-surface);
  border: 1px dashed var(--color-border); border-radius: var(--radius-lg); }
.scheduler__provider { display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--color-text-muted); }
.scheduler__provider .badge { text-transform: none; }

/* ---- Map block — .mapblock --------------------------------
   Consent-gated map with a static address + Eircode fallback that
   ALWAYS shows (works with no JS, no consent, no network to Google). */
.mapblock { display: grid; gap: var(--space-4); }
.mapblock__address { display: grid; gap: var(--space-1); font-size: var(--text-sm);
  padding: var(--space-4); background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.mapblock__address dt { color: var(--color-text-muted); font-size: var(--text-xs); }
.mapblock__eircode { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

/* ============================================================
   PHASE 3 — Point of sale (Square / SumUp deep links).
   The site CONNECTS to the trader's existing PoS; it never
   duplicates the checkout. Buttons are links, not forms.
   ============================================================ */
.pos { display: grid; gap: var(--space-4); max-width: 32rem; }
.pos__options { display: grid; gap: var(--space-3); }
@media (min-width: 520px) { .pos__options { grid-template-columns: 1fr 1fr; } }
.pos__option { display: flex; align-items: center; gap: var(--space-3); text-align: left;
  padding: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); color: var(--color-text); text-decoration: none;
  transition: border-color var(--transition-fast), transform var(--transition-fast); }
.pos__option:hover { border-color: var(--color-brand); transform: translateY(-1px); }
.pos__option:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.pos__icon { font-size: var(--text-2xl); color: var(--color-brand); flex: 0 0 auto; }
.pos__label { display: grid; gap: var(--space-1); }
.pos__name { font-weight: var(--weight-medium); }
.pos__sub { font-size: var(--text-xs); color: var(--color-text-muted); }
.pos__provider { font-size: var(--text-xs); color: var(--color-text-muted); }
