/* Components use only var(--...) tokens from tokens.css. */

/* ---- Stage ---------------------------------------------------------------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--page-max);
  flex: 1 0 auto;
  margin: 0 auto;
  padding: var(--stage-pad-top) var(--page-pad-x) var(--stage-pad-bottom);
}
.page--menu .stage { padding-top: var(--stage-pad-top-menu); }

.heading {
  max-width: var(--heading-max-w);
  font-size: var(--fs-heading);
  font-weight: var(--fw-light);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-normal);
  text-align: center;
  color: var(--c-brand);
  min-height: calc(2 * var(--lh-heading) * 1em);
}

/* ---- Menu ----------------------------------------------------------------- */
.menu { margin-top: var(--gap-heading-menu); }
.menu__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--tile-row-gap) var(--tile-gap);
  width: calc(3 * var(--tile-w) + 2 * var(--tile-gap) + 2px);
  max-width: 100%;
}
.tile {
  display: block;
  width: var(--tile-w);
  overflow: hidden;
  border: var(--frame-border) solid var(--c-white);
  border-radius: var(--tile-radius);
  background: var(--c-white);
  box-shadow: var(--tile-glow), var(--tile-shadow);
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out);
}
.tile__photo {
  width: 100%;
  aspect-ratio: var(--tile-photo-ratio);
  object-fit: cover;
}
.tile__label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--tile-strip-h);
  padding: 0 var(--space-xs);
  font-family: var(--font-tile);
  font-size: var(--tile-label-fs);
  font-weight: var(--fw-tile);
  line-height: var(--tile-label-lh);
  letter-spacing: var(--tile-label-ls);
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--c-brand);
  background: linear-gradient(100deg, var(--c-tile-strip-from) 0%, var(--c-tile-strip-mid) 50%, var(--c-tile-strip-to) 100%);
}
@media (hover: hover) {
  .tile:hover { transform: translateY(var(--lift)); }
}
.tile:active { transform: scale(var(--press-scale)); }

/* ---- Photo frame ---------------------------------------------------------- */
.frame {
  position: relative;
  flex: none;
  width: var(--frame-w);
  aspect-ratio: var(--frame-ratio);
  margin-top: var(--gap-heading-frame);
  overflow: hidden;
  border-radius: var(--frame-radius);
  background: linear-gradient(160deg, var(--c-frame-empty-from) 0%, var(--c-frame-empty-mid) 38%, var(--c-bg-mid) 62%, var(--c-frame-empty-to) 100%);
  transition: box-shadow var(--t-panel) var(--ease-out);
  isolation: isolate;                       /* WebKit: own stacking context, so the reel's layer cannot bleed out */
}
/* WebKit does not always clip transformed / filtered children with overflow:hidden + border-radius.
   The mask forces a real rounded clip. It sits on this inner wrapper, not on .frame itself: a mask on
   .frame would also cut off the frame's outer box-shadow glow (mask clips to the border box). */
.frame__clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
}
.frame.has-photo {
  border: var(--frame-border) solid var(--c-white);
  box-shadow: var(--frame-glow), var(--frame-shadow);
}

/* Reel: the frame is a fixed window, the photos are stacked vertically in a strip behind it.
   Every slide is exactly as tall as the window, so translateY(-100%) moves the strip by one photo. */
.reel {
  position: absolute;
  inset: 0;
  transform: translate3d(0, 0, 0);
}
.frame.is-spinning .reel { will-change: transform, filter; }
.reel__slide {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}
.reel__slide--blank { background: transparent; }

/* ---- CTA button ----------------------------------------------------------- */
.cta {
  display: grid;
  place-items: center;
  width: var(--btn-w);
  min-height: var(--btn-h);
  margin-top: var(--gap-frame-cta);
  padding: 0 var(--space-md);
  border: 0;
  border-radius: var(--btn-radius);
  background: var(--c-white);
  box-shadow: var(--btn-shadow);
  font-family: var(--font-sans);
  font-size: var(--fs-cta);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-normal);
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--c-brand);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) linear;
}
.cta:active:not(:disabled) { transform: scale(var(--press-scale)); }
.cta:disabled { opacity: 0.65; cursor: default; }
/* The button is disabled for exactly the duration of a spin: give it its own compositing layer then, so
   WebKit does not repaint it (and its box-shadow) together with the moving reel. */
.cta:disabled { transform: translateZ(0); }

/* ---- Inspiration panel ---------------------------------------------------- */
.panel {
  position: relative;
  align-self: flex-start;
  width: var(--panel-w);
  margin-top: var(--gap-cta-panel);
  margin-left: calc(-1 * var(--page-pad-x));
  padding: var(--panel-pad-t) var(--panel-pad-r) var(--panel-pad-b) var(--panel-pad-l);
  border-radius: 0 var(--panel-radius) var(--panel-radius) 0;
  background: linear-gradient(135deg, var(--c-panel-from), var(--c-panel-to));
  box-shadow: var(--panel-shadow);
  color: var(--c-panel-text);
  animation: panel-in var(--t-panel) var(--ease-out) both;
}
.panel[hidden] { display: none; }
/* During a re-spin (js/inspirace.js adds .panel--spinning instead of [hidden]) hide with visibility+opacity
   only, so the panel KEEPS its layout space - the frame and CTA above it must not shift while a new result
   is being picked, and the auto-scroll position must not jump either. */
.panel.panel--spinning {
  visibility: hidden;
  opacity: 0;
  animation: none;
}
.panel.panel--spinning::before { display: none; }
.panel::before {
  content: "";
  position: absolute;
  top: calc(var(--panel-pad-t) / 2);
  left: 50%;
  width: var(--divider-w);
  height: var(--divider-h);
  transform: translateX(-50%);
  background: var(--c-divider);
}
.panel__title {
  margin: 0;
  font-size: var(--fs-panel-title);
  font-weight: var(--fw-medium);
  line-height: var(--lh-panel-title);
  text-transform: uppercase;
  text-wrap: balance;
}
.panel__text {
  margin: 0.6em 0 0;
  font-size: var(--fs-panel-text);
  font-weight: var(--fw-regular);
  line-height: var(--lh-panel-text);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(var(--panel-shift)); }
  to { opacity: 1; transform: none; }
}

/* ---- "Změnit kategorii" link ---------------------------------------------- */
.back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  margin-top: auto;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--fs-link);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-normal);
  color: var(--c-brand);
  text-decoration: none;
}
.back__icon { width: 1.5em; height: 1.2em; }
.stage > .cta + .back { margin-top: var(--gap-cta-link); }
.stage > .panel + .back { margin-top: var(--gap-cta-link); }

/* ---- Footer + OneTrust "Cookie settings" button ---------------------------- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--footer-pad-y) var(--page-pad-x);
}
/* The button ID and class are required by OneTrust and are kept as supplied. OneTrust injects its own default
   button style (#ot-sdk-btn.ot-sdk-show-settings), so the extra .site-footer class gives this rule the higher
   specificity. Only look is set here; the click handler is attached by the OneTrust script. */
.site-footer #ot-sdk-btn.ot-sdk-show-settings {
  min-height: var(--touch-min);
  padding: 0 var(--space-md);
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--fs-footer);
  font-weight: var(--fw-regular);
  line-height: 1.2;
  text-decoration: underline;
  color: var(--c-brand);
  cursor: pointer;
}
.site-footer #ot-sdk-btn.ot-sdk-show-settings:hover { background: transparent; color: var(--c-brand); }

/* ---- Mobile-only gate -------------------------------------------------------
   js/device-gate.js runs in <head> before the body is parsed and puts html.is-mobile or html.is-desktop on <html>.
   Fail closed: everything except the gate stays hidden unless the check said "mobile" (so no flash of the real page
   on desktop, and nothing shows if the script did not run). The gate itself is only drawn for html.is-desktop;
   the <noscript> copy (.device-gate--static) covers visitors without JavaScript. */
.device-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--gate-z);
  align-items: center;
  justify-content: center;
  padding: var(--gate-pad);
  background: var(--gate-bg);
  color: var(--gate-fg);
  text-align: center;
}
html.is-desktop .device-gate,
.device-gate--static { display: flex; }
.device-gate__text {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--gate-fs);
  font-weight: var(--fw-regular);
  line-height: var(--gate-lh);
}
html:not(.is-mobile) { background: var(--gate-bg); }
html:not(.is-mobile) body { background: var(--gate-bg); background-image: none; }
html:not(.is-mobile) body > :not(.device-gate):not(noscript) { display: none !important; }

/* ---- Slots (TODO, intentionally empty) ------------------------------------ */
.legal-slot:empty { display: none; }

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  .tile, .cta, .frame { transition: none; }
  .frame.is-spinning .reel { will-change: auto; }
  .tile:hover, .tile:active, .cta:active:not(:disabled) { transform: none; }
}
