/* Shared base for every direction: a tiny reset, a few utilities, and the bare structure the shared
   components need to work unstyled. No colours, no fonts, no spacing scale: each direction brings its own.
   Link it BEFORE the direction's own stylesheet. Everything here is low specificity, so a direction overrides it. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, textarea, select { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
:where(h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd) { margin: 0; }
:where(ul[class], ol[class]) { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* ---------- utilities ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Focus ring: currentColor by default; a direction sets --focus-ring to its own line colour. */
:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring, currentColor);
  outline-offset: 3px;
}
:where(a, button, input, textarea, select, summary, [tabindex]):focus:not(:focus-visible) { outline: none; }
.mps-book__legend:focus, .mps-book__title:focus { outline: none; } /* focus moved here by script, not a control */

/* Nothing may stay hidden or half-faded for people who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- structure the shared components need (override freely) ---------- */

/* booking */
.mps-book__preview { white-space: pre-wrap; overflow-wrap: anywhere; }
.mps-book__input, .mps-book__textarea { width: 100%; }
.mps-book__field { display: block; }
.mps-book__label { display: block; }
.mps-book__month-head { display: flex; align-items: center; justify-content: space-between; }
.mps-book__weekdays, .mps-book__cells { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mps-book__weekday { text-align: center; }
.mps-book__day--out { pointer-events: none; }
/* The day strip scrolls sideways inside itself. width:0 + min-width:100% makes it add nothing to the intrinsic
   width of its ancestors, so a grid or flex parent cannot be stretched wider than the screen by 21 chips. */
.mps-book__days { display: flex; width: 0; min-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; }
.mps-book__days > .mps-book__day { flex: 0 0 auto; scroll-snap-align: start; }
.mps-book__send { display: block; text-align: center; text-decoration: none; }
.mps-book__send[aria-disabled="true"] { cursor: not-allowed; }

/* portfolio grid: --mps-work-cols, --mps-work-gap and --mps-work-ratio are the knobs */
.mps-work__grid {
  display: grid;
  grid-template-columns: repeat(var(--mps-work-cols, 2), minmax(0, 1fr));
  gap: var(--mps-work-gap, 8px);
}
@media (min-width: 768px) { .mps-work__grid { grid-template-columns: repeat(var(--mps-work-cols-md, 3), minmax(0, 1fr)); } }
@media (min-width: 1024px) { .mps-work__grid { grid-template-columns: repeat(var(--mps-work-cols-lg, 4), minmax(0, 1fr)); } }
.mps-work__open { display: block; width: 100%; padding: 0; border: 0; background: none; }
.mps-work__img { width: 100%; height: auto; aspect-ratio: var(--mps-work-ratio, auto); object-fit: cover; }

/* lightbox: a full-window layer. Colours, type and motion come from the direction. */
.mps-lightbox {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: hidden; overscroll-behavior: contain;
}
.mps-lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto auto; align-items: center; }
.mps-lightbox__close { grid-column: 3; grid-row: 1; justify-self: end; min-width: 44px; min-height: 44px; }
.mps-lightbox__prev { grid-column: 1; grid-row: 2; min-width: 44px; min-height: 44px; }
.mps-lightbox__next { grid-column: 3; grid-row: 2; min-width: 44px; min-height: 44px; }
.mps-lightbox__stage { grid-column: 2; grid-row: 2; min-height: 0; height: 100%; display: grid; place-items: center; }
.mps-lightbox__figure { display: grid; justify-items: center; gap: 8px; max-height: 100%; min-height: 0; }
.mps-lightbox__img { max-width: 100%; max-height: 80vh; max-height: 80dvh; width: auto; height: auto; object-fit: contain; }
.mps-lightbox__counter { grid-column: 2; grid-row: 3; text-align: center; }
.mps-lightbox__book { grid-column: 2; grid-row: 4; justify-self: center; }
html:has(.mps-lightbox[open]) { overflow: hidden; }
