/* ============================== TOKENS ============================== */
:root {
  --black: #0b0b0c;
  --white: #ffffff;
  --red: #e5332b;
  --muted: rgba(255, 255, 255, .62);
  --hairline: rgba(255, 255, 255, .12);

  --font: 'Gilroy', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 22px;
  --gutter: clamp(20px, 5vw, 56px);
  --gap: clamp(14px, 2.2vw, 22px);
  --tile-pad: clamp(20px, 3vw, 34px);

  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

/* ============================== BASE ================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--black);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--white); outline-offset: 4px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.page {
  max-width: 1180px;
  margin-inline: auto;
  padding: calc(clamp(24px, 4vw, 48px) + env(safe-area-inset-top, 0px))
           var(--gutter)
           calc(clamp(28px, 4vw, 48px) + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: clamp(36px, 6vw, 72px);
}

/* ============================== HEADER ============================== */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 48px);
}

/* Лого з орбітою напису. Орбіта — SVG textPath, довжина задана textLength
   (заповнює коло без замірів у JS); обертання — rAF у main.js (лише rotate). */
.mark {
  position: relative;
  flex: 0 0 auto;
  width: clamp(112px, 28vw, 176px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.mark__logo {
  width: 41%;
  height: auto;
  position: relative;
  z-index: 1;
  /* лого візуально тяжіє вправо (M U S ! C) — зсув ліворуч вирівнює оптичний центр */
  transform: translateX(-10%);
}

.mark__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  will-change: transform;
}

.mark__ring text {
  font-family: var(--font);
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: .01em;
  fill: rgba(255, 255, 255, .86);
}

.head__title {
  text-align: right;
  min-width: 0;
}

.head__name {
  margin: 0;
  font-size: clamp(24px, 6.6vw, 52px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--red);
  white-space: nowrap;
}

.head__sub {
  margin: .28em 0 0;
  font-size: clamp(16px, 4.4vw, 26px);
  font-weight: 800;
  line-height: 1.2;
  color: var(--white);
}

/* ============================== TILES =============================== */
.events {
  display: grid;
  gap: var(--gap);
}

.tile {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  aspect-ratio: 714 / 283;
  padding: var(--tile-pad);
  border-radius: var(--radius);
  overflow: hidden;
  background: #1a1a1c;
  color: var(--white);
  transform: translateZ(0);
  transition: box-shadow .5s var(--ease-out);
}

.tile:hover { box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8); }
.tile:focus-visible { outline-offset: 6px; }

.tile__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
  transform: scale(1.001) translate3d(var(--px, 0), var(--py, 0), 0);
  transition: transform .9s var(--ease-out);
}

.tile:hover .tile__img { transform: scale(1.045) translate3d(var(--px, 0), var(--py, 0), 0); }

/* лівий скрім — щоб дата/назва читалися, коли прийдуть справжні фото */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, rgba(0, 0, 0, .28) 0%, rgba(0, 0, 0, .10) 45%, rgba(0, 0, 0, 0) 70%);
  pointer-events: none;
}

.tile__meta {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.tile__date {
  font-size: clamp(24px, 5.2vw, 34px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.tile__place {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(14px, 3.2vw, 17px);
  font-weight: 500;
  color: rgba(255, 255, 255, .9);
}

.tile__pin { width: 15px; height: 15px; flex: none; }

.tile__name {
  grid-row: 3;
  align-self: end;
  font-size: clamp(38px, 11vw, 64px);
  font-weight: 500;
  line-height: .96;
  letter-spacing: -0.02em;
  margin-top: clamp(18px, 4vw, 28px);
  transition: transform .6s var(--ease-out);
}

.tile:hover .tile__name { transform: translateX(6px); }

.tile__go {
  position: absolute;
  right: var(--tile-pad);
  bottom: var(--tile-pad);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--white);
  color: var(--black);
  transition: transform .5s var(--ease-out), background-color .3s ease;
}

.tile__go svg { width: 20px; height: 20px; transition: transform .5s var(--ease-out); }

.tile:hover .tile__go { transform: scale(1.08); }
.tile:hover .tile__go svg { transform: translate(2px, -2px); }

/* ============================== FOOTER ============================== */
.foot {
  display: grid;
  gap: clamp(28px, 4vw, 40px);
}

.foot__row {
  display: flex;
  align-items: center;
  gap: clamp(22px, 4vw, 40px);
  flex-wrap: wrap;
}

.foot__icons { display: flex; gap: 14px; flex: none; }

.foot__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--white);
  transition: transform .4s var(--ease-out), background-color .3s ease;
}

.foot__icon svg { width: 44px; height: 44px; }

.foot__icon:hover { transform: translateY(-3px); }

.foot__text {
  margin: 0;
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.3;
  font-weight: 500;
  text-wrap: balance;
}

.foot__text a {
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .28);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color .25s ease;
}
.foot__text a:hover { text-decoration-color: var(--white); }

/* ============================== ENTRANCE ============================ */
.head, .tile, .foot {
  animation: rise .8s var(--ease-out) both;
}
.tile { animation-delay: calc(120ms + var(--i, 0) * 90ms); }
.foot { animation-delay: 480ms; }

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ============================== FOOTER, MOBILE (<900px) ============= */
@media (max-width: 899px) {
  .foot__row { flex-wrap: nowrap; gap: 14px; }
  .foot__icons { gap: 10px; }
  .foot__icon { width: 40px; height: 40px; border-radius: 10px; }
  .foot__icon svg { width: 34px; height: 34px; }
  .foot__text { min-width: 0; font-size: clamp(14px, 4vw, 18px); line-height: 1.32; }
}

/* ============================== NARROW (≤359px) ===================== */
@media (max-width: 359px) {
  .head { flex-direction: column; align-items: flex-start; gap: 18px; }
  .head__title { text-align: left; }
  .head__name { white-space: normal; text-wrap: balance; }
  .foot__row { flex-wrap: wrap; gap: 18px; }
}

/* ============================== DESKTOP BENTO ======================= */
@media (min-width: 900px) {
  .page { gap: clamp(48px, 6vw, 80px); }

  .head {
    justify-content: flex-start;
    gap: clamp(28px, 4vw, 56px);
  }
  .head__title { text-align: left; }

  .events {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
  }

  .tile { aspect-ratio: 2 / 1; --tile-pad: clamp(26px, 2.6vw, 36px); }

  .tile--kyiv {
    grid-column: 1;
    grid-row: 1 / 3;
    aspect-ratio: auto;
  }
  .tile--kyiv .tile__img { object-position: 62% center; }
  .tile--kyiv::before {
    background: linear-gradient(180deg, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .34) 100%);
  }
  .tile--kyiv .tile__name { font-size: clamp(64px, 6.6vw, 92px); }

  .tile--poltava   { grid-column: 2; grid-row: 1; }
  .tile--vinnytsia { grid-column: 2; grid-row: 2; }

  .tile__name { font-size: clamp(48px, 5vw, 68px); }
  .tile__date { font-size: clamp(28px, 2.6vw, 36px); }
  .tile__place { font-size: 17px; }
  .tile__go { width: 52px; height: 52px; }
  .tile__go svg { width: 22px; height: 22px; }

  .foot__row { justify-content: flex-start; }
}

/* ============================== MOTION OFF ========================== */
@media (prefers-reduced-motion: reduce) {
  .head, .tile, .foot { animation: none; }
  .tile__img, .tile__name, .tile__go, .tile__go svg, .foot__icon { transition: none; }
  .tile:hover .tile__img { transform: none; }
}
