/*
 * kit.css: the Site's design kit. Reset, semantic tokens, layout primitives, components, mechanics and the base's
 * animation. Its values come from theme.css's tokens (the role tokens among them, which the Site's site.css sets); the
 * Site's look is its site.css, the starter's pieces starter.css.
 * Motion lives only here, and only inside @media (prefers-reduced-motion: no-preference): content is
 * visible by default, and a reveal hides an element only where it will also show it again.
 */

/* vendor: a vendored library's stylesheet (Parvus, the lightbox component's); the kit's own layers override it. */
@layer reset, vendor, tokens, base, layout, components, sections, site, utilities, motion;

/* Page to page: a cross-document View Transition typed `page` (the motion layer scopes its fades to that type: the
   old page fades out before the new one fades in, so two pages' texts are never drawn on top of each other; under
   reduced motion the new page shows at once). Outside @layer on purpose: Chromium 156 aborts a typed one declared inside a layer on
   the new page („ViewTransition opt-in disabled”). */
@view-transition { navigation: auto; types: page; }

/* Registered, so it computes to pixels: the gallery component's gallery.js reads the justified gallery's row height
   from it (an @property stays outside every layer). */
@property --row { syntax: "<length>"; inherits: true; initial-value: 208px; }

/* ------------------------------------------------------------------ reset */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* In the Zendor dashboard's frame (early.js) the page scrolls without a scrollbar; on its own it keeps the browser's. */
  html.in-frame { scrollbar-width: none; }
  html.in-frame::-webkit-scrollbar { display: none; }
  body { min-block-size: 100svh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
  img, picture, svg, video, canvas { display: block; max-inline-size: 100%; }
  img { block-size: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  p, h1, h2, h3, h4, li, dd, blockquote { overflow-wrap: break-word; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
  table { border-collapse: collapse; }
  [hidden] { display: none !important; }
}

/* ----------------------------------------------------------------- tokens */
@layer tokens {
  :root {
    /* Type steps: shadcn/ui's sizes, which the registry's components read (the base's own type reads the role tokens,
       theme.css --type-*). The small steps are fixed; a heading's grows from 360 to 1440 px. */
    --step--2: 0.75rem;                                          /* 12 px: shadcn text-xs */
    --step--1: 0.875rem;                                         /* 14 px: text-sm (buttons, labels, small text) */
    --step-0: 1rem;                                              /* 16 px: body */
    --step-1: clamp(1.125rem, 1.083rem + 0.185vw, 1.25rem);      /* 18 → 20 px: a lead, h4 */
    --step-2: clamp(1.25rem, 1.167rem + 0.37vw, 1.5rem);         /* 20 → 24 px: h3 */
    --step-3: clamp(1.375rem, 1.271rem + 0.463vw, 1.6875rem);    /* 22 → 27 px: a quote, a card's head */
    --step-4: clamp(1.875rem, 1.667rem + 0.926vw, 2.5rem);       /* 30 → 40 px: h2, a section's head */
    --step-5: clamp(1.875rem, 1.5rem + 1.667vw, 3rem);           /* 30 → 48 px: h1 */
    --step-6: clamp(2.25rem, 1.75rem + 2.222vw, 3.75rem);        /* 36 → 60 px: a one-off display line */
    --step-7: clamp(2.5rem, 1.833rem + 2.963vw, 4.5rem);         /* 40 → 72 px: the home hero's headline */

    /* Fluid space */
    --space-3xs: clamp(0.25rem, 0.23rem + 0.1vw, 0.31rem);
    --space-2xs: clamp(0.5rem, 0.47rem + 0.15vw, 0.6rem);
    --space-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.9rem);
    --space-s: clamp(1rem, 0.93rem + 0.35vw, 1.2rem);
    --space-m: clamp(1.5rem, 1.4rem + 0.5vw, 1.8rem);
    --space-l: clamp(2rem, 1.85rem + 0.75vw, 2.4rem);
    --space-xl: clamp(3rem, 2.6rem + 1.9vw, 4.4rem);
    --space-2xl: clamp(4rem, 3.3rem + 3.4vw, 6.5rem);
    --space-3xl: clamp(5rem, 3.9rem + 5.4vw, 9rem);

    --gutter: clamp(1rem, 0.6rem + 2vw, 2.5rem);
    --wrapper: 82rem;
    --measure: 64ch;
    /* The header's height, which the page's first section and an anchor's scroll leave room for: the starter's floating
       pill (0.75rem above and below it) around shadcn's lg buttons (2.5rem), its inset and its 1px border:
       0.75rem + 0.375rem + 2.5rem + 0.375rem + 0.75rem + 2px. A Site with another header sets its own. */
    --nav-h: 4.875rem;
    /* A photo slot's shape until its photo says otherwise (a frame, the image placeholder, a gallery tile) */
    --photo-ratio: 4 / 3;
    /* The gallery component's justified row height (gallery.js reads it): a dial a Site sets on its gallery's id */
    --row: 13rem;

    /* Motion (.scratch/theme-and-plugin-upgrade/research/motion-tokens.md). JS reads them through motion.js. */
    /* Durations: a scale (UI ≤ 300 ms; on-screen moves 400–600 ms; one-shot entrances 800–900 ms) */
    --dur-fast: 150ms;    /* press/focus feedback, small colour changes, picker fade; every exit */
    --dur-base: 200ms;    /* hover colour/background/border, icon nudges, dropdown/picker drop-in */
    --dur-medium: 300ms;  /* page and menu cross-fades, icon rotations, accordion close */
    --dur-move: 400ms;    /* short on-screen moves and expansions: pill, gallery switch, accordion open, photo fade-in */
    --dur-move-l: 500ms;  /* large on-screen moves: lightbox page turn, menu links rising */
    --dur-morph: 600ms;   /* shared-element morph (card → post photo) */
    --dur-reveal: 800ms;  /* scroll entrances (#26) */
    --dur-intro: 900ms;   /* the hero's lead pieces, the shader's fade-in */
    --dur-count: 1400ms;  /* the count-up: numbers are read, not watched */
    --dur-exit: var(--dur-fast);
    --dur-page: var(--dur-medium);
    --intro-budget: 1200ms;   /* every hero animation has ended by this time after the intro starts */
    /* Easings (no ease-in) */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);      /* entering and leaving */
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);  /* anything moving across the screen: pill, gallery, lightbox, page fade */
    --ease-ui: ease;                                /* colour, background, border, shadow */
    --ease-back: cubic-bezier(0.34, 1.4, 0.64, 1);  /* a small overshoot, never in a track */
    /* Distances */
    --rise-s: 0.4rem;   /* panels and pickers dropping in, an answer settling, an exit dropping away */
    --rise-m: 1rem;     /* text following a morph (the post's title block) */
    --rise: 1.5rem;     /* scroll reveal, menu links, hero text items (#26) */
    /* Sequencing (read by JS too) */
    --stagger: 80ms; --stagger-max: 5;        /* step between items arriving together, and how many steps at most */
    --reveal-line: 25%;                       /* a reveal plays once its top is this far up from the screen's foot (#32) */
    --count-line: 20%;                        /* the count-up starts this far up */
    --intent-open: 90ms; --intent-close: 260ms;   /* a dropdown's hover intent */
    --reveal-failsafe: 3s;                    /* early.js: everything shows if site.js has not taken over by then */
    --intro-failsafe: 3s;                     /* early.js: the hero shows if hero.js has not started by then */
    /* Endless loops (still under reduced motion) */
    --loop-shimmer: 1.4s; --loop-pulse: 2.4s; --loop-ticker: 38s;
    --spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121,
      1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991,
      0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
  }

  @media (max-width: 40rem) { :root { --row: 7.5rem; } }

  /* Semantic colours per tone, each from the palette's roles and what theme.css derives from them (the brand file's
     colours, brand_tokens()). A section switches tone with a class; everything inside follows. The roles stay the same
     in both schemes: tone-light is the ground (the paper), tone-dark the band that contrasts with it, tone-brand the
     main colour as a ground; each tone's controls, error colour and „z” follow its own ground. */
  :root, .tone-light {
    --c-bg: var(--paper);
    --c-surface: var(--surface);
    --c-surface-2: var(--surface-2);
    --c-text: var(--text);
    --c-text-muted: var(--text-muted);
    --c-line: color-mix(in oklch, var(--text) 10%, transparent);
    --c-line-strong: color-mix(in oklch, var(--text) 45%, transparent);   /* a field's edge: ≥ 3:1 on the paper */
    --c-link: var(--brand);
    --c-mark: var(--brand);
    --c-on-mark: var(--on-brand);
    --c-accent: var(--accent);   /* the accent as a mark (text, a rule, a dot), at 4.5:1 on the tone's ground */
    --c-focus: var(--brand);
    /* the flips by the tone's own ground (theme.css, brand_tokens()): the error's red, the Zendor „z” mark (light
       grey) inverted to dark on a light ground, the browser's controls */
    --c-danger: var(--paper-danger);
    --logo-invert: var(--paper-logo-invert);
    color-scheme: var(--paper-scheme);
  }
  .tone-dark {
    --c-bg: var(--band);
    --c-surface: var(--band-surface);
    --c-surface-2: var(--band-surface-2);
    --c-text: var(--band-text);
    --c-text-muted: var(--band-text-muted);
    --c-line: color-mix(in oklch, var(--band-text) 12%, transparent);
    --c-line-strong: color-mix(in oklch, var(--band-text) 45%, transparent);
    --c-link: var(--brand-bright);
    --c-mark: var(--brand-bright);
    --c-on-mark: var(--band-on-mark);
    --c-accent: var(--band-accent);
    --c-focus: var(--brand-bright);
    --c-danger: var(--band-danger);
    --logo-invert: var(--band-logo-invert);
    color-scheme: var(--band-scheme);
  }
  /* The main colour as a ground: black in the neutral look */
  .tone-brand {
    --c-bg: var(--brand);
    --c-surface: var(--brand-surface);
    --c-surface-2: var(--brand-surface-2);
    --c-text: var(--on-brand);
    --c-text-muted: var(--on-brand-muted);
    --c-line: color-mix(in oklch, var(--on-brand) 14%, transparent);
    --c-line-strong: color-mix(in oklch, var(--on-brand) 45%, transparent);
    --c-link: var(--on-brand);
    --c-mark: var(--on-brand);
    --c-on-mark: var(--brand);
    --c-accent: var(--brand-accent);
    --c-focus: var(--on-brand);
    --c-danger: var(--brand-danger);
    --logo-invert: var(--brand-logo-invert);
    color-scheme: var(--brand-scheme);
  }
}

/* ------------------------------------------------------------------- base */
@layer base {
  /* Our own :hover / :active states only: no grey-blue box flashing on a tap (Android, iOS) */
  a, button, label, summary, select { -webkit-tap-highlight-color: transparent; }
  html {
    scroll-behavior: auto;
    scroll-padding-block-start: calc(var(--nav-h) + 2rem);
    background: var(--c-bg);
  }
  body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: minmax(0, 1fr);
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-text);
    font-size: var(--type-body-size);
    font-weight: var(--type-body-weight);
    letter-spacing: var(--type-body-tracking);
    line-height: var(--type-body-leading);
    font-stretch: var(--text-stretch);
    font-kerning: normal;
    font-optical-sizing: auto;
    /* One variable file draws every weight from 300 to 900; a weight past it (or past an own face's cut) is never a made-up bold */
    font-synthesis-weight: none;
    font-variant-numeric: lining-nums;
  }
  .tone-light, .tone-dark, .tone-brand { background-color: var(--c-bg); color: var(--c-text); }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: var(--heading-weight);
    font-stretch: var(--heading-stretch);
    line-height: var(--heading-leading);
    letter-spacing: var(--heading-tracking);
    text-wrap: balance;
  }
  /* The headings' roles (theme.css --type-*, the Site's site.css brand block) */
  h1 { font-size: var(--type-h1-size); font-weight: var(--type-h1-weight); letter-spacing: var(--type-h1-tracking); line-height: var(--type-h1-leading); }
  h2 { font-size: var(--type-h2-size); font-weight: var(--type-h2-weight); letter-spacing: var(--type-h2-tracking); line-height: var(--type-h2-leading); }
  h3 { font-size: var(--type-h3-size); font-weight: var(--type-h3-weight); letter-spacing: var(--type-h3-tracking); line-height: var(--type-h3-leading); }
  h4 { font-size: var(--step-1); line-height: calc(var(--heading-leading) + 0.2); letter-spacing: calc(var(--heading-tracking) * 0.6); }
  p, li, dd { text-wrap: pretty; }
  p { max-inline-size: var(--measure); }
  :lang(hu) { hyphens: manual; }

  a { color: var(--c-link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
  a:hover { text-decoration-thickness: 0.14em; }
  strong { font-weight: 600; }
  /* A headline's *accent* word (th()): the muted grey, upright */
  :is(h1, h2, h3) em { font-style: normal; color: var(--c-text-muted); }
  code, kbd, samp { font-family: var(--font-code); font-size: 0.92em; }
  ::selection { background: var(--brand); color: var(--on-brand); }

  :focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
  :focus:not(:focus-visible) { outline: none; }

  .skip-link {
    position: absolute; inset-inline-start: var(--gutter); inset-block-start: -10rem; z-index: 100;
    padding: 0.7rem 1rem; background: var(--brand); color: var(--on-brand); font-weight: 600;
  }
  .skip-link:focus { inset-block-start: 1rem; }
  .visually-hidden {
    position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}

/* ----------------------------------------------------------------- layout */
@layer layout {
  .wrapper { inline-size: min(100% - 2 * var(--gutter), var(--wrapper)); margin-inline: auto; }
  .container { inline-size: min(100% - 2 * var(--gutter), var(--wrapper)); margin-inline: auto; }
  .narrow { max-inline-size: 42rem; }
  .stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--space-s)); }
  .stack > * { margin: 0; }
  .cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--space-xs)); }
  .cluster.spread { justify-content: space-between; }
  .grid {
    display: grid; gap: var(--grid-gap, var(--space-s));
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--grid-min, 16rem)), 1fr));
  }
  .switcher { display: flex; flex-wrap: wrap; gap: var(--space-l); }
  .switcher > * { flex-grow: 1; flex-basis: calc((var(--switch-at, 48rem) - 100%) * 999); }
  /* One even padding above and below every section, whatever is next to it; two sections of one tone in a row are
     parted by that padding alone, never a line */
  .section { padding-block: var(--section-space); position: relative; }
  main { display: block; }
  main:focus { outline: none; }
}

/* ------------------------------------------------------------- components */
@layer components {
  /* Eyebrow: a small muted label over a title, in sentence case (a tick before it with the ornaments) */
  .eyebrow {
    display: inline-flex; align-items: center; gap: 0.65em;
    font-family: var(--font-label); font-weight: var(--type-label-weight); letter-spacing: var(--type-label-tracking);
    line-height: var(--type-label-leading); color: var(--c-text-muted);
  }
  .eyebrow::before {
    content: ""; inline-size: 1.6em; block-size: 0.7em; flex: none;
    border-inline: var(--border-w) solid currentColor;
    background: linear-gradient(currentColor, currentColor) center / 100% var(--border-w) no-repeat;
  }
  .lead { font-size: var(--type-lead-size); font-weight: var(--type-lead-weight); letter-spacing: var(--type-lead-tracking);
    line-height: var(--type-lead-leading); color: var(--c-text-muted); max-inline-size: 46ch; }
  /* The display role: a hero's one large line */
  .display { font-size: var(--type-display-size); font-weight: var(--type-display-weight); letter-spacing: var(--type-display-tracking);
    line-height: var(--type-display-leading); }
  .muted { color: var(--c-text-muted); }
  .pre-line { white-space: pre-line; }

  /* Buttons: shadcn's sizes (the default 2.25rem high, .button-lg 2.5rem: the main action and the header's), 14 px
     type in both, a pill by the capsule (--radius-control) */
  .button {
    --b-bg: var(--c-mark); --b-fg: var(--c-on-mark); --b-line: var(--c-mark);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-block-size: 2.25rem; padding: 0.375rem 1rem;
    border: var(--border-w) solid var(--b-line); border-radius: var(--radius-control);
    background: var(--b-bg); color: var(--b-fg);
    font-family: var(--font-text); font-weight: 600; font-size: var(--step--1);
    line-height: 1.25rem; text-decoration: none; letter-spacing: 0; cursor: pointer;
    transition: background-color var(--dur-base), color var(--dur-base), border-color var(--dur-base), translate var(--dur-base) var(--ease-out);
  }
  .button:hover { --b-bg: color-mix(in oklch, var(--c-mark) 84%, var(--c-bg)); }
  .button:active { translate: 0 1px; }
  .button .icon { inline-size: 1rem; block-size: 1rem; flex: none; }
  /* The main action: the accent's one job (theme.css --action) */
  .button-accent { --b-bg: var(--action); --b-fg: var(--on-action); --b-line: var(--action); }
  .button-accent:hover { --b-bg: var(--action-hover); }
  /* On a dark ground the contact action turns to the ground's mark (white) */
  :is(.tone-dark, .tone-brand) .button-accent { --b-bg: var(--c-mark); --b-fg: var(--c-on-mark); --b-line: var(--c-mark); }
  :is(.tone-dark, .tone-brand) .button-accent:hover { --b-bg: color-mix(in oklch, var(--c-mark) 86%, var(--c-on-mark)); }
  .button-secondary, .button-ghost { --b-bg: transparent; --b-fg: var(--c-text); --b-line: var(--c-line-strong); }
  .button-secondary:hover, .button-ghost:hover { --b-bg: color-mix(in oklch, var(--c-text) 8%, transparent); }
  .button-lg { min-block-size: 2.5rem; padding-inline: 1.5rem; }
  .button-arrow .icon { transition: translate var(--dur-base) var(--ease-out); }
  .button-arrow:hover .icon { translate: 0.25em 0; }

  /* Icons from the inline sprite */
  .icon { inline-size: 1.25em; block-size: 1.25em; fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round; flex: none; }

  /* Status chip: „Most nyitva · 16:00-ig” */
  .status {
    display: inline-flex; align-items: center; gap: 0.55em; padding: 0.4em 0.9em 0.4em 0.75em;
    border: var(--border-w) solid var(--c-line); border-radius: var(--radius-badge);
    background: color-mix(in oklch, var(--c-bg) 70%, transparent);
    font-family: var(--font-label); font-size: var(--step--1); line-height: 1.2; white-space: nowrap;
  }
  .status::before {
    content: ""; inline-size: 0.6em; block-size: 0.6em; border-radius: 50%;
    background: var(--on-ink-faint); box-shadow: 0 0 0 0.22em var(--status-closed-glow);
  }
  .status.is-open::before { background: var(--status-open); box-shadow: 0 0 0 0.22em var(--status-open-glow); }

  /* Chips: materials and finishes */
  .chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); padding: 0; list-style: none; }
  .chip {
    display: inline-flex; align-items: center; gap: 0.4em; padding: 0.35em 0.85em;
    border: var(--border-w) solid var(--c-line-strong); border-radius: var(--radius-badge);
    font-size: var(--step--1); font-weight: 600; line-height: 1.3;
  }

  /* The header is the Site's (its markup header.php, its look starter.css or site.css); its mechanics are kit's: the
     phone menu ([data-menu], src/kit/nav.php menu_attrs()) keeps the page under it still while open, and an
     accordion's panel ([data-accordion-panel]) is hidden while closed once phone-menu.js runs (.is-collapsible). */
  html:has([data-menu]:popover-open) { overflow: hidden; }
  :where([data-accordion].is-collapsible:not([data-open]) [data-accordion-panel]) { display: none; }

  /* The Zendor „z” mark (templates/partials/logo.php) in the tone: inverted to dark on a light ground */
  .logo-mark { filter: invert(var(--logo-invert)); }
  /* Round flags */
  .flag { inline-size: 1.5rem; block-size: 1.5rem; flex: none; border-radius: 50%; box-shadow: var(--shadow-flag); }

  /* Section heads */
  .section-head { display: grid; gap: var(--space-s); margin-block-end: var(--section-gap); }
  .section-head.split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); align-items: end; column-gap: var(--space-xl); }
  .section-head h2 { max-inline-size: 20ch; }
  .section-head p { color: var(--c-text-muted); font-size: var(--type-lead-size); font-weight: var(--type-lead-weight);
    letter-spacing: var(--type-lead-tracking); line-height: var(--type-lead-leading); }

  /* Photo frame: fixed ratio, focal point, a caption tag in the corner */
  .frame { position: relative; overflow: hidden; background: var(--c-surface-2); aspect-ratio: var(--ratio, var(--photo-ratio));
    border-radius: var(--radius-media); }
  .frame img { inline-size: 100%; block-size: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); }
  /* A photo still loading (site.js): its blurred stand-in fills the frame; motion adds a sweep */
  .frame.is-loading { background-image: var(--stand-in); background-size: cover; background-position: var(--focus, 50% 50%); }
  .frame figcaption, .frame .tag {
    position: absolute; inset-inline-start: 0; inset-block-end: 0; z-index: 2; border-start-end-radius: var(--radius-field);
    padding: 0.45em 0.8em; background: var(--ink); color: var(--on-ink-1);
    font-family: var(--font-label); font-size: var(--step--2);
  }

  /* The image placeholder, képhely (picture() of a photo the Site has not got yet): a grey frame with an icon and „Kép helye”,
     filling its slot (a figure.frame) or, on its own, the slot's ratio */
  .image-placeholder {
    display: grid; place-content: center; justify-items: center; gap: 0.5rem; inline-size: 100%; aspect-ratio: var(--ratio, var(--photo-ratio));
    border: 1px solid var(--c-line); border-radius: var(--radius-media); background: var(--c-surface-2); color: var(--c-text-muted);
    font-family: var(--font-label); font-size: var(--step--1); line-height: 1.2; text-align: center;
  }
  .image-placeholder .icon { inline-size: 1.75rem; block-size: 1.75rem; stroke-width: 1.5; }
  .frame > .image-placeholder { position: absolute; inset: 0; block-size: 100%; aspect-ratio: auto; }
  .tone-dark .image-placeholder, .tone-brand .image-placeholder { background: var(--c-surface); }

  /* Cards: one family. A box is .card (the surface and a line), .card-quiet (a light tint, for a dark ground or a
     list of rows) or .card-feature (the section's ground and no line: the one that stands out). A component tunes
     it with --card-bg, --card-line and --card-pad, never with its own background or border. */
  .card, .card-quiet, .card-feature {
    background: var(--card-bg); border: var(--border-w) solid var(--card-line); border-radius: var(--radius-card);
    padding: var(--card-pad);
  }
  :where(.card) { --card-bg: var(--c-surface); --card-line: var(--c-line); --card-pad: var(--inset-card); }
  :where(.card-quiet) { --card-bg: color-mix(in oklch, var(--c-text) 4%, transparent); --card-line: var(--c-line); --card-pad: var(--inset-card); }
  :where(.card-feature) { --card-bg: var(--c-bg); --card-line: transparent; --card-pad: var(--space-l); }


  /* Forms: shadcn's field. 2.25rem high; its type 16 px on a phone (iOS zooms into a smaller one) and 14 px from
     48rem; the label 14 px over it. A control outside a .field (the admin's filters) takes the shape with .input. */
  .field { display: grid; gap: var(--space-2xs); align-content: start; }
  .field > label, .field > .label, fieldset > legend {
    font-family: var(--font-label); font-weight: var(--type-label-weight); font-size: var(--type-label-size);
    letter-spacing: var(--type-label-tracking); line-height: var(--type-label-leading);
  }
  .field .optional { font-weight: 400; color: var(--c-text-muted); }
  /* A selector list, not :is(): each keeps its own weight, so the textarea's and the select's rules below still win */
  .field input:not([type="radio"], [type="checkbox"]), .field textarea, .field select, .input {
    inline-size: 100%; min-block-size: 2.25rem; padding: 0.25rem 0.75rem;
    border: var(--border-w) solid var(--c-line-strong); border-radius: var(--radius-field);
    background: var(--c-bg); color: var(--c-text); font-size: 1rem; line-height: 1.5rem;
    box-shadow: var(--shadow-field);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  }
  @media (min-width: 48rem) {
    .field input:not([type="radio"], [type="checkbox"]), .field textarea, .field select, .input { font-size: var(--step--1); line-height: 1.25rem; }
  }
  .field textarea { min-block-size: 4rem; padding-block: 0.5rem; field-sizing: content; max-block-size: 20rem; resize: vertical; }
  :is(.field select, select.input) { appearance: none; padding-inline-end: 2.25rem;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 55%, calc(100% - 0.8rem) 55%; background-size: 0.3rem 0.3rem; background-repeat: no-repeat; }
  /* Customizable select (Chromium 135+): the list is a panel in the Site's type (a card's corner), its options
     concentric in its rim (--radius-card-rim); elsewhere the native list opens */
  @supports (appearance: base-select) {
    .field select, .field select::picker(select) { appearance: base-select; }
    .field select { display: flex; align-items: center; cursor: pointer; }
    .field select::picker-icon { display: none; }   /* the chevron above stays */
    .field select::picker(select) {
      margin-block: 0.35rem; padding: var(--inset-rim); max-block-size: min(18rem, 45dvh); overflow-y: auto;
      border: var(--border-w) solid var(--c-line-strong); border-radius: var(--radius-card);
      background: var(--c-surface); color: var(--c-text);
      box-shadow: var(--shadow-card);
    }
    .field option {
      display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.5rem; border-radius: var(--radius-card-rim);
      font-size: inherit; cursor: pointer;
    }
    .field option:hover, .field option:focus-visible { background: color-mix(in oklch, var(--brand) 10%, transparent); outline: none; }
    .field option:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
    .field option:checked { font-weight: 600; color: var(--c-text); }
    .field option::checkmark { order: 1; margin-inline-start: auto; content: "✓"; }
  }
  :is(.field input, .field textarea, .field select, .input):focus-visible {
    outline: none; border-color: var(--c-focus); box-shadow: 0 0 0 2px var(--c-focus);
  }
  .field [aria-invalid="true"] { border-color: var(--c-danger) !important; }
  .field-hint { color: var(--c-text-muted); font-size: var(--step--1); }
  .field-error { color: var(--c-danger); font-size: var(--step--1); }
  /* The contact form's mechanics: the honeypot field out of sight, the sending note only while htmx sends */
  .hp { position: absolute; inset-inline-start: -100vw; inline-size: 1px; block-size: 1px; overflow: hidden; }
  .htmx-indicator { opacity: 0; transition: opacity var(--dur-base) var(--dur-fast); }
  .htmx-request .htmx-indicator { opacity: 1; }
  .htmx-request button[type="submit"] { opacity: 0.6; pointer-events: none; }
  fieldset { border: 0; padding: 0; min-inline-size: 0; display: grid; gap: 0.6rem; }
  fieldset > legend { padding: 0 0 0.5rem; }   /* a rendered legend ignores its bottom margin */
  .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0.6rem; }
  .choice {
    display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.7rem 0.85rem; cursor: pointer;
    border: var(--border-w) solid var(--c-line-strong); border-radius: var(--radius-field); background: var(--c-surface);
    transition: border-color var(--dur-fast), background-color var(--dur-fast);
  }
  .choice input { margin-block-start: 0.15rem; accent-color: var(--brand); inline-size: 1rem; block-size: 1rem; flex: none; }
  .choice:has(input:checked) { border-color: var(--brand); background: color-mix(in oklch, var(--brand) 8%, var(--c-surface)); }
  .choice:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
  .choice strong { display: block; }
  .choice span { color: var(--c-text-muted); font-size: var(--step--1); }

  /* Notices */
  .notice { padding: 0.75rem 1rem; border: var(--border-w) solid var(--c-line); border-inline-start: 4px solid var(--brand);
    border-radius: var(--radius-field); background: var(--c-surface); }
  .notice-success { border-color: var(--success-line); }
  .notice-error { border-color: var(--c-danger); }

  /* Tables (opening hours, admin) */
  .table-wrap { overflow-x: auto; }
  .table { inline-size: 100%; font-size: var(--step--1); }
  .table th, .table td { padding: 0.7rem 0.8rem; border-block-end: 1px solid var(--c-line); text-align: start; vertical-align: top; }
  .table thead th { font-family: var(--font-label); font-size: var(--step--1); font-weight: 600; color: var(--c-text-muted); }

  /* Opening hours */
  .hours { inline-size: 100%; font-size: var(--step-0); line-height: 1.3; }
  .hours th, .hours td { padding: 0.55rem 0; border-block-end: 1px solid var(--c-line); text-align: start; font-weight: 400; }
  .hours th { font-family: var(--font-label); font-size: var(--step--1); color: var(--c-text-muted); }
  .hours td { text-align: end; font-variant-numeric: tabular-nums; }
  /* today: an accent mark before the day, not only bold */
  .hours tr.is-today th, .hours tr.is-today td { color: var(--c-text); font-weight: 600; }
  .hours tr.is-today th::before { content: ""; display: inline-block; inline-size: 0.5em; block-size: 0.5em; margin-inline-end: 0.5em; border-radius: 50%; background: currentColor; vertical-align: 0.1em; }

}

/* The sections layer (declared above) holds an installed component's own stylesheet: above the components, under the
   Site's site.css, so a Site restyles a section without !important. */

/* ----------------------------------------------------------------- utilities */
@layer utilities {
  .flow > * + * { margin-block-start: var(--flow, 1em); }
  .text-center { text-align: center; }
  .nowrap { white-space: nowrap; }
  /* Long rows on a phone: services, testimonials and the reel are rows to swipe (a utility, so a section's own grid gives way), each card most of the screen wide
     with the next one peeking in */
  @media (max-width: 40rem) {
    .swipe-row {
      display: flex; gap: var(--space-s); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
      margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
      scrollbar-width: none; columns: auto;
    }
    .swipe-row > * { flex: 0 0 85%; scroll-snap-align: start; margin-block-end: 0; }
    /* a rail that overflows is a tab stop (rail.js; a keyboard scrolls it): its focus ring inside, as it runs from edge to edge */
    .swipe-row:focus-visible { outline-offset: -3px; }
  }
  /* Ornaments: the trades niche's signature (a tick before the eyebrow, outlined numerals, texture; the ticker is left
     out by its section) is on with html[data-ornaments] (content/site.php brand 'ornaments'); the base theme has none. */
  :root:not([data-ornaments]) {
    .eyebrow::before { display: none; }
  }
  /* One size everywhere: a section head's or a copy block's paragraph rules can't reach it */
  .eyebrow { font-size: var(--type-label-size); }
}

/* ------------------------------------------------------------------- motion */
@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    /* Smooth only for a jump inside the page (the link clicked keeps the focus). A page opened at a
       #fragment, from another page, lands on it at once instead of rolling down from the top. */
    html:focus-within { scroll-behavior: smooth; }

    /* Page to page (the @view-transition rule is at the top of this file; Chromium, Safari 18.2+,
       others just navigate): the old page fades out, then the new one fades in, the header standing still above them.
       One after the other, never a cross-fade: two pages' heads at the same place would be drawn on top of each other.
       Only for the `page` type, so a same-page transition (the lightbox opening and closing) leaves the page be. */
    html:active-view-transition-type(page) {
      &::view-transition-old(root) { animation: page-out var(--dur-fast) var(--ease-out) both; }
      &::view-transition-new(root) { animation: page-in var(--dur-page) var(--ease-out) var(--dur-fast) both; }
      /* (not while the phone menu is open: the menu fades out over everything instead) */
      body > header:not(:has([data-menu]:popover-open)) { view-transition-name: site-header; }
      &::view-transition-group(site-header) { z-index: 1; }
      /* The overlay would catch every click while it runs: the nav must answer at once */
      &::view-transition { pointer-events: none; }
    }

    /* The phone menu opens and closes as a View Transition typed `menu` (phone-menu.js): the page cross-fades into
       the menu over it (a header's own parts may rise in after it: starter.css) */
    html:active-view-transition-type(menu) {
      &::view-transition-old(root), &::view-transition-new(root) { animation-duration: var(--dur-medium); animation-timing-function: var(--ease-out); }
      &::view-transition { pointer-events: none; }
    }
    @keyframes page-out { to { opacity: 0; } }
    @keyframes page-in { from { opacity: 0; } }

    /* Reveals: an element plays its entrance once, when it first comes into view. site.js adds
       `reveals` to <html> and `is-in` to each element as it arrives (what is already on screen at
       load gets it at once, with no animation). Without site.js nothing is hidden.
       One entrance for text and photos alike: a short rise and a fade, opacity and translate only
       (composited, so scrolling never waits on it). No clip-path: it repaints every frame and cuts
       off the shadows around a photo. */
    .reveals :is([data-reveal], [data-reveal-group] > *):not(.is-in) { opacity: 0; }
    .reveals :is([data-reveal], [data-reveal-group] > *).is-in {
      animation: reveal var(--dur-reveal) var(--ease-out) var(--reveal-delay, 0ms) backwards;
    }
    .reveals [data-reveal-group="fade"] > .is-in { animation-name: reveal-fade; }
    /* No `to`: it ends on the element's own values, and nothing stays on it afterwards (its own transitions
       on border, shadow or background keep working) */
    @keyframes reveal { from { opacity: 0; translate: 0 var(--rise); } }
    @keyframes reveal-fade { from { opacity: 0; } }

    /* The select's list (customizable select) fades and drops in */
    .field select::picker(select) {
      transition: opacity var(--dur-fast), translate var(--dur-base) var(--ease-out), overlay var(--dur-base) allow-discrete, display var(--dur-base) allow-discrete; }
    .field select:not(:open)::picker(select) { opacity: 0; translate: 0 calc(-1 * var(--rise-s)); }
    @starting-style { .field select:open::picker(select) { opacity: 0; translate: 0 calc(-1 * var(--rise-s)); } }

    /* The home hero's opening (hero.js): its hidden start, only while early.js's .intro is on (never without
       JavaScript, never under reduced motion). The hero's animations then run on the compositor alone. */
    .intro :where([data-hero-line], [data-hero-in], [data-hero-photo]) { opacity: 0; }

    /* A lazy photo that arrives late fades in over its average colour (site.js marks it) */
    img.is-pending { opacity: 0; }
    /* The loading sweep: one soft band of light crossing the stand-in (translate only: composited) */
    .frame.is-loading::after {
      content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
      background: linear-gradient(100deg, transparent 30%, var(--veil-16) 50%, transparent 70%);
      translate: -100% 0; animation: shimmer var(--loop-shimmer) var(--ease-in-out) infinite;
    }
    @keyframes shimmer { to { translate: 100% 0; } }
    img.is-arrived { animation: img-in var(--dur-move) var(--ease-out); }
    @keyframes img-in { from { opacity: 0; } }


    /* opacity only: an endless box-shadow pulse repainted the page every frame */
    .status.is-open::before { animation: pulse var(--loop-pulse) var(--ease-in-out) infinite; }
    @keyframes pulse { 50% { opacity: 0.35; } }
  }

  /* Reduced motion: nothing moves. The new page shows at once; the phone menu is a short fade (--dur-fast), the user
     having asked for it; every hover nudge is off and a state (a chevron turned) changes at once; colour changes stay. */
  @media (prefers-reduced-motion: reduce) {
    html:active-view-transition-type(page) {
      &::view-transition-old(root), &::view-transition-new(root), &::view-transition-group(root) { animation: none; }
      &::view-transition { pointer-events: none; }
    }
    html:active-view-transition-type(menu) {
      &::view-transition-old(root), &::view-transition-new(root) { animation-duration: var(--dur-fast); }
      &::view-transition-group(root) { animation: none; }
      &::view-transition { pointer-events: none; }
    }
    .button:active, .button-arrow:hover .icon { translate: none; }
    .button { transition-property: background-color, color, border-color; }
    .button-arrow .icon { transition: none; }
  }
}
