/* Events page: the belt opener, the city map, the filters, the calendar
   cards and the page's sections. Club pages load it for their cards. */

/* Belt opener ----------------------------------------------------------
   The home page's dark room (bag.css): the belt hangs in a pool of light
   under a cone from the ceiling, with a fine grain so the dark reads as a
   room. The default is the page without the 3D belt (no JavaScript, no
   WebGL, reduced motion, a short screen): a still picture of the belt's
   map plate (transparent around it), the first beat with the calendar
   link, the other beats as plain sections, then the city map as a normal
   section. With .is-3d.is-live (set before first paint in the layout) the
   opener is a pinned stage over the 3D belt, the room drawn on its
   backdrop, and the map waits over its end for the plate to land on it. */

.seq, .is-live .seq-backdrop {
  --room:
    conic-gradient(from 180deg at 64% -8%, rgba(255,255,255,0) 166deg, rgba(255,255,255,0.07) 180deg, rgba(255,255,255,0) 194deg),
    radial-gradient(48% 46% at 64% 40%, rgba(255,255,255,0.17), rgba(255,255,255,0) 72%),
    radial-gradient(120% 90% at 64% 0%, #232325 0%, #111112 46%, var(--night) 78%);
}
.seq { position: relative; isolation: isolate; color: var(--canvas); background: var(--room); }
.seq::after, .is-live .seq-backdrop::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.seq-stage { position: relative; padding: var(--s8) 0 var(--s7); }
.seq-backdrop, .snap-stop, .seq-next { display: none; }

.seq-copy {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "still" "intro" "actions" "cities" "info" "sports";
}
.seq-fallback { grid-area: still; margin-bottom: var(--s6); }
.seq-fallback img { width: 100%; max-width: 760px; margin: 0 auto; }
.beat[data-beat="0"] { grid-area: intro; }
.beat[data-beat="1"] { grid-area: cities; margin-top: var(--s8); }
.beat[data-beat="2"] { grid-area: info; margin-top: var(--s6); }
.beat[data-beat="3"] { grid-area: sports; margin-top: var(--s6); }
.seq-actions { grid-area: actions; }
.beat:not([data-beat="0"]) {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--s3) var(--s7); padding-top: var(--s6);
  box-shadow: inset 0 1px 0 var(--night-line);
}
.beat:not([data-beat="0"]) p { margin-top: 0; max-width: 44ch; }
@media (min-width: 1100px) {
  .seq-copy {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--s7);
    grid-template-areas: "intro still" "actions still" "cities cities" "info info" "sports sports";
  }
  .seq-fallback { align-self: center; margin: 0; }
  .seq-fallback img { max-width: none; }
  .beat[data-beat="0"] { align-self: end; }
}

.beat h1 { font-size: clamp(3.5rem, 17vw, 6rem); }
/* The English and Russian titles are longer words: smaller, so they stay
   on one line in the copy column. */
:lang(en) .beat h1 { font-size: clamp(2.75rem, 14vw, 5.25rem); }
:lang(ru) .beat h1 { font-size: clamp(2.25rem, 11vw, 4.25rem); }
.beat h2 { font-size: clamp(36px, 4vw, 60px); }
.beat p {
  margin-top: var(--s4); max-width: 34ch;
  font-size: clamp(16px, 1.6vw, 20px); line-height: 1.4; color: var(--on-night-2);
  text-wrap: pretty;
}
.seq-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s6); }

/* Live: a tall section with a pinned stage. The canvas fills the
   backdrop under the stage, so the copy stays in front of the belt.
   Height: 8.6 stages of belt travel, 0.8 of the map fading in over it
   (FADE in belt.js), and the one stage the map overlaps. */
.is-live { --stage-h: calc(100svh - var(--header-h)); scroll-padding-top: var(--header-h); }
.is-live .seq { height: calc(var(--stage-h) * 10.4); background: var(--night); }
.is-live .seq::after { display: none; }
.is-live .seq-backdrop {
  display: block; position: sticky; top: var(--header-h); height: var(--stage-h);
  isolation: isolate; background: var(--room);
}
.belt-canvas { display: block; width: 100%; height: 100%; opacity: 0; }
.is-live .seq-stage {
  --dock: clamp(24px, 9svh, 88px); --actions-h: 48px;
  position: sticky; top: var(--header-h); z-index: 1;
  height: var(--stage-h); margin-top: calc(-1 * var(--stage-h)); padding: 0; overflow: hidden;
}
.is-live .seq-copy { display: block; position: absolute; inset: 0; }
.is-live .seq-fallback { display: none; }
.is-live .beat {
  display: block; position: absolute; left: var(--gutter);
  bottom: calc(var(--dock) + var(--actions-h) + var(--s6));
  width: min(36%, 470px); margin: 0; padding: 0; box-shadow: none;
  opacity: 0; pointer-events: none;
}
.is-live .beat p { margin-top: var(--s4); max-width: 34ch; }
.is-live .beat[data-beat="0"] { opacity: 1; }
.is-live .seq-actions { position: absolute; left: var(--gutter); bottom: var(--dock); margin: 0; }
/* Next, the outlined pill beside the red calendar link: the step it is
   on beside its name. The calendar link keeps the pill's usual size here,
   so the two sit on one row on phones. */
.is-live .seq-next:not([hidden]) { display: inline-flex; }
.seq-next-step { font-weight: 400; font-variant-numeric: tabular-nums; opacity: 0.6; }
.seq-actions .btn-find { min-height: 48px; font-size: 16px; }

/* Phones and portrait screens: belt in the upper part, copy docked below. */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .is-live .seq-stage { --dock: clamp(16px, 4svh, 40px); }
  .is-live .seq-backdrop, .seq {
    --room:
      conic-gradient(from 180deg at 50% -8%, rgba(255,255,255,0) 164deg, rgba(255,255,255,0.07) 180deg, rgba(255,255,255,0) 196deg),
      radial-gradient(70% 36% at 50% 30%, rgba(255,255,255,0.17), rgba(255,255,255,0) 72%),
      radial-gradient(140% 80% at 50% 0%, #232325 0%, #111112 46%, var(--night) 78%);
  }
  .is-live .beat { width: auto; right: var(--gutter); top: auto; bottom: calc(var(--dock) + var(--actions-h) + var(--s5)); }
  .beat h1 { font-size: clamp(3.25rem, 16vw, 5rem); }
  .is-live .beat p { margin-top: var(--s3); }
}
/* Short phone stages drop the lede so the belt keeps its room. belt.js
   sets --actions-h to the actions' real height, which also covers the
   two actions wrapping onto two rows. */
@media (max-width: 760px) and (max-height: 700px) {
  .is-live .beat p { display: none; }
}

/* Scroll stops: the page comes to rest on each stage of the belt instead
   of flying past several. Each marker sits where a beat rests (u times
   the 8.6 stages of belt travel); the last one is the landed map. From
   the last copy the next stop is the map; belt.js paces the belt laying
   flat on the way. Snapping is off from the map down (.snap-off) and
   until the belt has started (.is-ready), so the sections below scroll
   freely.
   Touch screens get belt.js's glide instead. */
@media not all and (pointer: coarse) {
  .is-live.is-ready:not(.snap-off) { scroll-snap-type: y mandatory; }
}
.is-live .snap-stop {
  display: block; position: absolute; left: 0; width: 1px; height: 1px;
  top: calc(var(--u) * 8.6 * var(--stage-h));
  scroll-snap-align: start; scroll-snap-stop: always; pointer-events: none;
}
.is-live .snap-stop.is-last { top: calc(9.4 * var(--stage-h)); }

/* City map ---------------------------------------------------------------
   The home page's city map (site.js), with Lithuania's outline, and its
   city rows beside it (styles.css), here counting events. Live, its
   section overlaps the end of the belt sequence: it waits there, hidden,
   while the belt runs; as the plate lands (FADE in belt.js) it sticks
   under the header and fades in over the plate, filling the stage; then
   it scrolls on as normal. The spacer is the room it sticks through. */

.city-section { padding-bottom: var(--s4); }
.events-map { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s6); align-items: start; }
.events-map .city-map { height: clamp(360px, 40vw, 560px); }
.events-map-aside .city-rows + .btn { margin-top: var(--s5); }
@media (max-width: 900px) {
  .events-map { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .events-map .city-map { height: 320px; }
  .events-map .city-rows .city-name { font-size: 36px; }
}
.city-section h2:focus-visible, #upcoming-title:focus-visible { outline-offset: 6px; }
.is-live .map-hold { margin-top: calc(-1.8 * var(--stage-h)); }
.is-live .map-hold::after { content: ""; display: block; height: calc(0.8 * var(--stage-h)); }
.is-live .city-section {
  position: sticky; top: var(--header-h); z-index: 2;
  display: flex; flex-direction: column; min-height: var(--stage-h);
  padding: var(--s6) 0 var(--s5);
  background: var(--canvas);
  opacity: var(--reveal, 0); visibility: hidden; pointer-events: none;
}
.is-live .city-section.is-shown { visibility: visible; }
.is-live .city-section.is-landed { pointer-events: auto; }
.is-live .city-section .wrap { display: flex; flex: 1; flex-direction: column; }
.is-live .city-section .events-map { flex: 1; align-items: stretch; }
@media (max-width: 900px) {
  .is-live .city-section .events-map { grid-template-rows: minmax(240px, 1fr) auto; }
}
.is-live .city-section .city-map { height: auto; min-height: 240px; }

/* The city pins arrive one after another once the plate has landed. */
.city-section .pin { transform: translate(-50%, -50%) scale(var(--pin-scale, 1)); }
.is-live .city-section .pin {
  --pin-scale: 0.6; opacity: 0;
  transition: opacity 320ms var(--ease-out), transform 520ms var(--ease-out),
    background-color 160ms var(--ease-out), color 160ms var(--ease-out);
  transition-delay: calc(var(--i) * 45ms), calc(var(--i) * 45ms), 0s, 0s;
}
.is-live .city-section.is-landed .pin { --pin-scale: 1; opacity: 1; }

/* Filters ----------------------------------------------------------------
   The club search's pill (styles.css) with one segment per filter the
   events offer (--fields, one to five). Too narrow for one bar, the bar
   lets go of its pill and each segment becomes a pill of its own, with
   the bar's hairline ring, the button a pill beside them: everything
   pressed stays a full pill (DESIGN.md, Shapes). The chips need
   JavaScript, like the club search's. */

.event-search {
  grid-template-columns: repeat(var(--fields), minmax(0, 1fr)) auto;
  max-width: calc(var(--fields) * 240px + 160px); margin-bottom: var(--s5);
}
/* A picked filter reads in ink, apart from the "all" ones. */
.event-search select:has(option:checked:not([value=""])) { color: var(--ink); font-weight: 600; }
.event-results { margin-bottom: var(--s5); }
.no-js .event-results .chip { display: none; }
@media (max-width: 1000px) {
  .search.event-search {
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 40%), 1fr)); gap: var(--s2);
    min-height: 0; padding: 0;
    background: none; box-shadow: none; border-radius: 0;
  }
  /* Room for the label beside the pill's round end. */
  .event-search .search-field { --field-x: var(--s5); background: var(--canvas); box-shadow: 0 0 0 1px var(--hairline-soft); }
  .event-search .search-field:hover, .event-search .search-field:has(select:focus-visible) { background: var(--cloud); }
  .event-search .search-field:has(select:open) { background: var(--cloud); }
  .event-search .search-field + .search-field::before { display: none; }
  .event-search .search-orb { align-self: stretch; width: 100%; height: auto; min-height: 52px; margin: 0; }
  .event-search .search-orb span { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
}

/* Calendar ---------------------------------------------------------------
   Entry cards in the club card's pattern: a six-row subgrid (plate, name,
   date and place, type, sports and level, who can take part, links), so
   cards in a row line up. The plate carries the date; a status tag shows
   only when plans change. */

.comps { padding-top: var(--s8); }
.comp-list { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px var(--s4); }
.comp { position: relative; display: grid; grid-row: span 6; grid-template-rows: subgrid; }
.comp[hidden] { display: none; }
.comp .plate { margin-bottom: var(--s3); }
.comp .plate-word { font-size: min(15cqi, 72px); }
.comp h3 { font-size: 20px; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.comp-meta { font-size: 15px; color: var(--mute); font-variant-numeric: tabular-nums; }
.comp-note { font-size: 15px; color: var(--charcoal); }
.comp-who { font-size: 15px; color: var(--mute); }
.comp-weights { font-variant-numeric: tabular-nums; }
.comp-links {
  display: flex; flex-wrap: wrap; align-self: end; gap: 0 var(--s4);
  margin: var(--s2) 0 var(--s6); font-size: 15px; font-weight: 500;
}
.comp-links a { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.comp-links .icon { font-size: 13px; }

.empty-actions { display: flex; flex-wrap: wrap; gap: var(--s3); }
.comp-news { padding: var(--s8) 0 var(--s4); }
.comps + .cta-band, .comp-news + .cta-band { margin-top: var(--s7); }

@media (max-width: 900px) {
  .comp-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .comp-list { grid-template-columns: 1fr; }
  .comp .plate-word { font-size: min(13cqi, 64px); }
}
