/* =============================================================================
 * GTH Menu — TV kiosk client (spec section 6.2).
 *
 * Standalone CSS for the in-store TV browsers. Optimized for fixed
 * large-screen viewports (1080p / 4K), long-running display, and
 * minimal layout shifts during the once-per-minute crossfade refresh.
 *
 * No CSS variables from the admin theme are pulled in — the kiosk
 * page deliberately ships zero shared dependencies.
 * ========================================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

img {
  display: block;
  max-width: 100%;
}

#root {
  width: 100vw;
  height: 100vh;
  transition: opacity 300ms ease;
  /* Crossfade is the only thing that ever animates the root container,
   * so hint the compositor up-front. The transform: translateZ(0)
   * promotes it to its own GPU layer so the 1080p / 4K repaint stays
   * smooth on weaker TV chipsets. */
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 32px;
  color: #888;
}

/* -----------------------------------------------------------------------------
 * Screen → page-rotator → page (grid) → region (cell).
 * The screen paginates its items into the layout's slots and rotates pages
 * (only `.page.active` is visible; rotation crossfades between pages).
 * --------------------------------------------------------------------------- */

.screen { position: relative; width: 100%; height: 100%; }

.page-rotator { position: absolute; inset: 0; }

.page {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 0;
  opacity: 0;
  transition: opacity 600ms ease-in-out;
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.page.active { opacity: 1; }

/* One grid template per layout (16:9 landscape). */
.page-fullscreen { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.page-halves     { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.page-quadrants  { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.page-sixths     { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }

/* Secondary-language rotation: show one translation at a time when `.secrotate`. */
.translations-secondary.secrotate > .name-secondary { display: none; }
.translations-secondary.secrotate > .name-secondary.active { display: block; }

/* Region wrapper — every region keeps a 2px black gutter so adjacent
 * cards don't visually bleed into each other.
 *
 * `container-type: inline-size` enables the cqw/cqh font scaling
 * inside .meal-card so the same markup looks balanced in a quadrant
 * (960×540) and in a fullscreen layout (1920×1080).
 */
.region {
  position: relative;
  overflow: hidden;
  background: #111;
  border: 2px solid #000;
  container-type: size;
}

/* -----------------------------------------------------------------------------
 * Meal card.
 * --------------------------------------------------------------------------- */

.meal-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: #1a1a1a;
}

.meal-card .image {
  position: absolute;
  inset: 0;
  background-color: #000;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* The .info strip floats over the bottom of the meal photo. The
 * gradient is intentionally short (~ 45 % max-height) so the meal
 * image dominates the card; previous iterations bled to ~78 % and
 * crowded out the food photography. The headline block sits at the
 * top of the strip, the prices+chips footer anchors to the bottom. */
.meal-card .info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 48%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 1.2cqh;
  overflow: hidden;
  padding: 2.5cqh 3cqw 2cqh;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.45) 30%,
    rgba(0, 0, 0, 0.9) 100%
  );
}

.meal-card .headline {
  display: flex;
  flex-direction: column;
  gap: 0.4cqh;
}

/* The primary name is deliberately only slightly larger than the
 * secondary translation — what mainly sets it apart is weight (700 vs
 * 500) and a white color (vs grey). That keeps it restrained even for
 * extremely long names (it clamps to 3 lines instead of overrunning
 * half the screen). */
.meal-card .name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: clamp(20px, 3.2cqw, 40px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Secondary translations: stacked underneath the primary headline.
 * Static (no carousel) so foreign visitors can scan the room and
 * find their language at a glance — most diners are Czech, so a
 * blink-blink rotation would just annoy 90 % of the audience for the
 * sake of the 10 % minority. Font ~60 % of the primary clamp; lines
 * use line-clamp:1 so a multi-language meal stays compact in a
 * quadrant region. */
.meal-card .translations-secondary {
  display: flex;
  flex-direction: column;
  gap: 0.2cqh;
}

.meal-card .name-secondary {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: clamp(16px, 2.6cqw, 34px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.005em;
  color: #c8c8c8;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Price tag — anchored to the top-right corner of the meal card so
 * the price is the first thing a customer's eye lands on (real-world
 * price-tag analogy). Sits above the .info gradient on its own
 * stacking context and uses a translucent dark surface so it stays
 * legible on every food photo. Employee price stacks underneath the
 * regular one, separated by a thin divider. */
.meal-card .price-tag {
  position: absolute;
  top: clamp(10px, 1.6cqh, 28px);
  right: clamp(10px, 1.6cqw, 28px);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(2px, 0.4cqh, 6px);
  padding: clamp(8px, 1.2cqh, 18px) clamp(12px, 1.8cqw, 26px);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: clamp(8px, 1.2cqw, 16px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  text-align: right;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.meal-card .price-tag .price-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: clamp(2px, 0.4cqw, 6px);
  white-space: nowrap;
  line-height: 1;
}

.meal-card .price-tag .price-line-regular .value {
  font-size: clamp(26px, 4.4cqw, 56px);
  font-weight: 800;
  color: #fff;
}

.meal-card .price-tag .price-line-regular .currency {
  font-size: clamp(14px, 2cqw, 26px);
  font-weight: 600;
  color: #ddd;
}

.meal-card .price-tag .price-line-employee {
  margin-top: clamp(3px, 0.5cqh, 7px);
  padding-top: clamp(3px, 0.5cqh, 7px);
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  gap: clamp(3px, 0.5cqw, 8px);
}

.meal-card .price-tag .price-line-employee .label {
  font-size: clamp(10px, 1.3cqw, 16px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #d6b62b;
}

.meal-card .price-tag .price-line-employee .value {
  font-size: clamp(18px, 3cqw, 38px);
  font-weight: 800;
  color: #f9d949;
}

.meal-card .price-tag .price-line-employee .currency {
  font-size: clamp(11px, 1.5cqw, 20px);
  font-weight: 600;
  color: #c8a824;
}

/* Nutrition row — portion size, energy and macro pills sit directly
 * underneath the meal name. Macros (B / S / T) are wrapped in
 * subtle outlined pills so the labels are scannable without
 * dominating the card. The whole row wraps onto a second line on
 * narrow regions instead of overflowing. */
.meal-card .nutrition {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(4px, 0.8cqh, 10px) clamp(8px, 1.4cqw, 20px);
}

.meal-card .nutrition .weight,
.meal-card .nutrition .energy {
  font-size: clamp(14px, 2cqw, 26px);
  font-weight: 600;
  color: #e6e6e6;
  letter-spacing: 0.01em;
}

.meal-card .nutrition .energy {
  color: #cfcfcf;
}

.meal-card .nutrition .nutrient {
  display: inline-flex;
  align-items: baseline;
  gap: clamp(3px, 0.4cqw, 6px);
  padding: clamp(2px, 0.35cqh, 5px) clamp(7px, 1cqw, 13px);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.meal-card .nutrition .nutrient .lbl {
  font-size: clamp(11px, 1.5cqw, 18px);
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #f9d949;
}

.meal-card .nutrition .nutrient .val {
  font-size: clamp(12px, 1.7cqw, 22px);
  font-weight: 600;
  color: #fff;
}

/* Footer strip — chips only (pictograms + allergens). Aligned to
 * the left so it shares the same vertical baseline as the meal
 * name and the nutrition row; prices live in the top-right corner
 * price tag instead. */
.meal-card .footer {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 1.5cqw;
  flex-wrap: wrap;
}

.meal-card .footer-chips {
  display: flex;
  align-items: center;
  gap: 0.8cqw;
  flex-wrap: wrap;
  justify-content: flex-start;
}

/* Pictograms + allergens share the same compact chip footprint
 * (no oversized padding pretending to be a background). Pictograms
 * are graphic icons rendered at 75 % of the chip box; allergens are
 * text codes ("1", "1a", "8h") layered on the meal photo with a
 * soft drop shadow for legibility. The two groups are separated by
 * a thin vertical divider so the eye can tell them apart at a
 * glance. */
.meal-card .pictograms,
.meal-card .allergens {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.6cqw, 10px);
  flex-wrap: wrap;
  justify-content: flex-start;
}

.meal-card .footer-chips .pictograms + .allergens {
  position: relative;
  padding-left: clamp(8px, 1cqw, 16px);
  margin-left: clamp(2px, 0.4cqw, 6px);
}

.meal-card .footer-chips .pictograms + .allergens::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
}

.meal-card .pictogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(26px, 3.4cqw, 48px);
  height: clamp(26px, 3.4cqw, 48px);
  padding: 0;
  background: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.meal-card .pictogram img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Allergens render as compact pill chips. Subtle dark background +
 * thin border keeps them readable on busy food photography without
 * shouting like a status badge would. */
.meal-card .allergen {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(22px, 2.6cqw, 36px);
  height: clamp(22px, 2.6cqw, 36px);
  padding: 0 clamp(4px, 0.6cqw, 8px);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-size: clamp(12px, 1.6cqw, 20px);
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

@container (inline-size < 700px) {
  .meal-card .translations-secondary {
    gap: 0.1cqh;
  }
  .meal-card .name-secondary {
    font-size: clamp(13px, 3cqw, 22px);
  }
  .meal-card .footer {
    gap: 0.8cqw;
  }
  .meal-card .nutrition {
    gap: 0.5cqh 1cqw;
  }
  .meal-card .nutrition .nutrient {
    padding: 2px 7px;
  }
}

/* Display-status overlays — applied to .meal-card root via JS. */

.meal-card.status-sold_out {
  opacity: 0.55;
}

.meal-card.status-sold_out .image::after,
.meal-card.status-sold_out .image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 50, 50, 0.0) 0,
    rgba(255, 50, 50, 0.0) 60px,
    rgba(255, 50, 50, 0.55) 60px,
    rgba(255, 50, 50, 0.55) 90px
  );
  pointer-events: none;
}

.meal-card.status-sold_out .info::before {
  content: "VYPRODÁNO";
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  padding: 12px 28px;
  background: #d11919;
  color: #fff;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* "POSLEDNÍ KUSY" lives in the top-LEFT corner because the new
 * price tag occupies the top-right. Mirroring the rotation keeps
 * the ribbon visually anchored to the corner just like before. */
.meal-card.status-last_pieces::after {
  content: "POSLEDNÍ KUSY";
  position: absolute;
  top: 32px;
  left: -64px;
  width: 280px;
  padding: 10px 0;
  background: #f5b800;
  color: #1a1a1a;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: center;
  transform: rotate(-45deg);
  transform-origin: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.meal-card.status-hidden,
.region.region-hidden {
  display: none;
}

.meal-empty {
  width: 100%;
  height: 100%;
  background: #000;
}

/* -----------------------------------------------------------------------------
 * Presentation card (image carousel).
 * --------------------------------------------------------------------------- */

.presentation-card {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

.presentation-card .slide {
  position: absolute;
  inset: 0;
  background-color: #000;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0;
  transition: opacity 600ms ease-in-out;
  /* Each carousel slide cross-fades on a separate GPU layer so the
   * background-image swap doesn't trigger a full-frame repaint of
   * the underlying region (notable on 4K wall TVs). */
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.presentation-card .slide.active {
  opacity: 1;
}

.presentation-empty {
  width: 100%;
  height: 100%;
  background: #000;
}

/* -----------------------------------------------------------------------------
 * Clock card.
 * --------------------------------------------------------------------------- */

.clock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1c1c1c 0%, #0a0a0a 100%);
}

.clock-card .time {
  font-size: clamp(64px, 18cqw, 240px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.clock-card .date {
  margin-top: 24px;
  font-size: clamp(20px, 3.5cqw, 48px);
  font-weight: 400;
  color: #aaa;
  text-transform: lowercase;
}

.clock-card .seconds {
  color: #666;
}

/* -----------------------------------------------------------------------------
 * Empty / error region.
 * --------------------------------------------------------------------------- */

.empty-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

/* -----------------------------------------------------------------------------
 * Offline indicator (top-level fixed; shown when fetch fails).
 * --------------------------------------------------------------------------- */

.offline-indicator {
  position: fixed;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(220, 38, 38, 0.85);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  pointer-events: none;
  animation: offline-pulse 2s ease-in-out infinite;
}

.offline-indicator[hidden] {
  display: none;
}

.offline-indicator .offline-icon {
  font-size: 20px;
}

@keyframes offline-pulse {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 0.55; }
}

/* -----------------------------------------------------------------------------
 * Crossfade transition.
 * --------------------------------------------------------------------------- */

#root.is-fading {
  opacity: 0;
}

/* All typography uses container queries (cqw/cqh) so it scales
 * proportionally to the region size — a quadrant region (~960×540
 * inside a 1080p TV) renders smaller text than a fullscreen region
 * (1920×1080), and a 4K wall TV (3840×2160) gets the upper clamp()
 * cap automatically. No extra media queries needed. */
