/* ============================================================
   CKB-WEB-MOBILE-RESPONSIVE-R1-R1
   Tablet Continuity & Mobile Gallery Readability Reclosure
   Parent: CKB-WEB-MOBILE-RESPONSIVE-R1

   Gallery behavior authority:
   - Phone <= 640px: manual swipe + snap + per-card position dots; no autoplay.
   - Tablet 641-1240px: slow kinetic autoplay (30px/s) + direct touch drag + pause.
   - Desktop > 1240px: protected 42px/s kinetic baseline.
   Width controls layout; the 860px legacy breakpoint no longer decides motion.
   ============================================================ */

/* Pagination is a phone-only affordance; it is built into each original card
   so the visible card communicates both total count and current position. */
.poster-pagination {
  display: none;
}

/* ------------------------------------------------------------
   Tablet continuity: MENU remains compact, but Gallery is a deliberate
   tablet mode rather than a half-mobile / half-desktop accident.
   ------------------------------------------------------------ */
@media (min-width: 641px) and (max-width: 1240px) {
  /* There is enough room on tablets to keep language access visible. */
  .language-switch {
    display: inline-flex !important;
    margin-left: 18px !important;
  }
  .mobile-root-meta { display: none !important; }

  .brand-lockup-full,
  .brand-lockup-full-dark {
    width: clamp(228px, 31vw, 268px) !important;
    max-height: 58px !important;
  }
  .brand-lockup-full { display: block !important; }
  .brand-lockup-seal-only { display: none !important; }
  .site-header-shell.is-curtain .brand-lockup-full { display: none !important; }
  .site-header-shell.is-curtain .brand-lockup-full-dark { display: block !important; }
  .site-header-shell.is-curtain .brand-lockup-seal-only { display: none !important; }

  /* Tablet Gallery: slower automatic movement, direct horizontal drag,
     protected 16:9 cards and the same soft entry/exit treatment. */
  .hero { padding-top: 52px !important; }
  .gallery-heading {
    width: min(var(--content-width), calc(100vw - 40px)) !important;
    margin-bottom: 16px !important;
  }
  .gallery-heading .gallery-toggle {
    display: inline-flex !important;
    align-items: center;
  }
  .gallery-swipe-hint { display: none !important; }
  .gallery-viewport {
    width: min(var(--content-width), calc(100vw - 40px)) !important;
    height: clamp(430px, 50vw, 520px) !important;
    margin: 0 auto !important;
    padding: 0 !important;
    overflow: hidden !important;
    scroll-snap-type: none !important;
    touch-action: pan-y !important;
    cursor: grab;
  }
  .gallery-viewport:active { cursor: grabbing; }
  .gallery-viewport::before,
  .gallery-viewport::after { display: block !important; }
  .gallery-track {
    height: 100% !important;
    width: max-content !important;
    display: flex !important;
    align-items: center !important;
    gap: clamp(30px, 5vw, 54px) !important;
    padding: 0 !important;
    will-change: transform;
    user-select: none;
  }
  .poster-link {
    flex: 0 0 clamp(430px, 66vw, 650px) !important;
    width: clamp(430px, 66vw, 650px) !important;
    max-width: none !important;
    scroll-snap-align: none !important;
  }
  .poster-link[data-clone="true"] { display: flex !important; }
  .poster-copy { padding-top: 14px !important; }
  .poster-date { font-size: 13px !important; }
  .poster-title { font-size: clamp(21px, 2.7vw, 24px) !important; line-height: 1.14 !important; }
  .poster-meta { font-size: 11.5px !important; line-height: 1.35 !important; letter-spacing: .065em !important; }

  /* Tablet programme rows should remain readable instead of collapsing
     into the very fine desktop metadata treatment. */
  .event-type,
  .event-meta,
  .event-row time small {
    font-size: 11.5px !important;
    letter-spacing: .085em !important;
  }
}

/* The inherited <=860 rules are intentionally more phone-like. Re-open the
   full tablet Gallery mechanics and header spacing inside 641-860. */
@media (min-width: 641px) and (max-width: 860px) {
  :root { --header-h: 82px; }
  .site-header {
    width: calc(100vw - 40px) !important;
    height: var(--header-h);
  }
  .header-right { gap: 0 !important; }
  .mobile-menu-trigger { margin-left: 10px; }

  .gallery-track { transform: translate3d(0,0,0) !important; }
  .upcoming { width: calc(100vw - 40px) !important; padding-top: 66px !important; }
}

/* 861-1240 keeps a horizontal editorial programme row, but with stronger
   touch-distance readability than the desktop compression. */
@media (min-width: 861px) and (max-width: 1240px) {
  .upcoming { padding-top: 74px !important; }
  .event-row {
    min-height: 94px !important;
    grid-template-columns: 88px 104px minmax(0,1fr) 108px 28px !important;
    gap: 18px !important;
    padding-block: 18px !important;
  }
  .event-row time span { font-size: 30px !important; }
  .event-row h3 { font-size: clamp(21px, 2.15vw, 25px) !important; line-height: 1.12 !important; }
  .event-meta { line-height: 1.45 !important; }
}

/* ------------------------------------------------------------
   Phone authority <=640px: still, swipe-first, easy to read.
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  .brand-lockup-full,
  .brand-lockup-full-dark {
    width: clamp(190px, 60vw, 238px) !important;
    max-height: 52px !important;
  }
  .language-switch { display: none !important; }

  .hero { padding-top: 32px !important; }
  .gallery-heading { margin-bottom: 12px !important; }
  .gallery-heading .gallery-toggle { display: none !important; }
  .gallery-swipe-hint {
    display: inline !important;
    font-size: 10.5px !important;
    letter-spacing: .075em !important;
    opacity: .72;
  }
  .gallery-viewport {
    width: 100% !important;
    height: auto !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-inline: 7vw !important;
    padding: 0 7vw 10px !important;
    touch-action: pan-x pan-y !important;
    cursor: auto;
  }
  .gallery-viewport::before,
  .gallery-viewport::after { display: none !important; }
  .gallery-track {
    height: auto !important;
    gap: 18px !important;
    align-items: flex-start !important;
    transform: none !important;
    user-select: auto;
  }
  .poster-link {
    flex: 0 0 84vw !important;
    width: 84vw !important;
    max-width: 620px !important;
    scroll-snap-align: center !important;
    scroll-snap-stop: always;
  }
  .poster-link[data-clone="true"] { display: none !important; }

  /* 16:9 is the canonical featured-visual frame. Current prototype assets
     remain uncropped if their source ratio is not yet the final 16:9 export. */
  .poster-mount { aspect-ratio: 16 / 9 !important; }

  .poster-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 18px;
    padding-top: 10px;
  }
  .poster-pagination-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid rgba(11,11,11,.34);
    background: transparent;
  }
  .poster-pagination-dot.is-active {
    width: 7px;
    height: 7px;
    border-color: var(--ink);
    background: var(--ink);
  }

  .poster-copy { padding-top: 8px !important; gap: 5px !important; }
  .poster-date { font-size: 12.5px !important; line-height: 1.25 !important; }
  .poster-title { font-size: 21px !important; line-height: 1.16 !important; }
  .poster-meta {
    font-size: 12px !important;
    line-height: 1.4 !important;
    letter-spacing: .045em !important;
  }

  /* Reduce the long dead gap between the Gallery and the next task. */
  .upcoming { padding-top: 50px !important; }

  .event-type,
  .event-meta,
  .event-row time small {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
    letter-spacing: .075em !important;
  }
}

@media (max-width: 340px) {
  .brand-lockup-full,
  .brand-lockup-full-dark { width: 188px !important; }
  .poster-meta { font-size: 11.5px !important; }
}

/* Reduced motion remains an explicit override on every viewport size. */
@media (prefers-reduced-motion: reduce) {
  .gallery-viewport {
    overflow-x: auto !important;
    scroll-snap-type: x proximity !important;
    cursor: auto !important;
  }
  .gallery-track { transform: none !important; }
  .poster-link[data-clone="true"] { display: none !important; }
}
