/* Hit The Roofs! — страница браузерной игры.
   Оформление взято у самой игры (~/Dev/rooftops/src/style.css): тёплая дымка
   #ece5d8 вместо фона, чернила #161616, шрифты игры — Geologica для крупного,
   Golos Text для текста, IBM Plex Mono для мелких меток, Pangolin только там,
   где пишет сам кот (мысли и надписи на стенах). Кнопка — кнопка старта игры
   (#go: красный маяк #ff3b1f, белый Geologica 700, скругление 8 px).
   Клавиши нарисованы как в подсказках игры (kbd на #fffdf8). Карточки — её
   «матовая бумага». Прокрутку страница не перехватывает: петли играют на месте,
   мысли кот выдаёт по нажатию. */

:root {
  --bg: #ece5d8;
  --paper: #f7f3ec;
  --ink: #161616;
  --ink-2: #6d6b66;
  --line: rgba(43, 38, 34, .12);
  --beacon: #ff3b1f;
  --spray: #b9603f;
  --key: #fffdf8;
  --key-ink: #2b2622;
  --r: clamp(14px, 1.4vw, 20px);
  --pad: clamp(16px, 3vw, 40px);
  --max: 1440px;
  --gap: clamp(12px, 1.2vw, 18px);
  --display: "Geologica", "Arial Black", system-ui, sans-serif;
  --text: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hand: "Pangolin", "Comic Sans MS", cursive;
  --ease: cubic-bezier(.2, .7, .15, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: #f0d28a; }

.wrap { max-width: var(--max); margin: 0 auto; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  height: 64px; padding: 0 var(--pad);
  transition: background .3s, box-shadow .3s;
}
.bar.is-solid {
  background: rgba(236, 229, 216, .86);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.bar__logo { font: 700 19px/1 var(--display); text-decoration: none; white-space: nowrap; }
.bar__nav { display: flex; gap: 22px; margin-right: auto; }
.bar__nav a { font-size: 15px; text-decoration: none; color: var(--ink-2); transition: color .2s; }
.bar__nav a:hover, .bar__nav a.is-on { color: var(--ink); }
.bar__back {
  margin-left: auto; white-space: nowrap; text-decoration: none;
  font: 600 14px/1 var(--text); padding: 11px 16px; border-radius: 999px;
  background: rgba(255, 253, 248, .7); box-shadow: inset 0 0 0 1px var(--line);
}
.bar__back:hover { background: var(--key); }
@media (max-width: 1000px) { .bar__nav { display: none; } }

/* ── Общие ─────────────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(40px, 5.4vw, 80px); line-height: 1.02; letter-spacing: -.02em; }
h2 { font-size: clamp(30px, 3.4vw, 50px); line-height: 1.06; letter-spacing: -.015em; }
h3 { font-size: 19px; line-height: 1.2; letter-spacing: -.005em; }
.lead { font-size: clamp(17px, 1.35vw, 20px); line-height: 1.5; margin: 18px 0 0; max-width: 46ch; text-wrap: pretty; }

.btn {
  display: inline-block; text-decoration: none;
  font: 700 16px/1 var(--display); color: #fff; background: var(--beacon);
  padding: 15px 26px; border-radius: 8px;
  transition: transform .2s var(--ease), filter .2s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn--ghost { color: var(--ink); background: transparent; box-shadow: inset 0 0 0 1.5px rgba(43, 38, 34, .3); }

.sec { padding: clamp(72px, 8vw, 128px) var(--pad) 0; }
.head { margin-bottom: clamp(28px, 3vw, 44px); }

/* появление: только снизу вверх и только прозрачность */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rv.is-in { opacity: 1; transform: none; }
.rv[data-delay="1"] { transition-delay: .08s; }
.rv[data-delay="2"] { transition-delay: .16s; }
.rv[data-delay="3"] { transition-delay: .24s; }

/* ── Шапка страницы ───────────────────────────────────────────────────── */
.hero { padding: calc(64px + clamp(24px, 4vw, 56px)) var(--pad) 0; }
.hero__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(28px, 4vw, 64px); align-items: center; }
.hero__copy h1 { max-width: 13ch; }
.hero__copy .lead { max-width: 40ch; }
.hero__copy .btn { margin-top: 30px; }
.hero__film {
  margin: 0; height: min(76vh, 760px); min-height: 460px; aspect-ratio: 9 / 16;
  border-radius: var(--r); overflow: hidden; background: #c9b3a6;
}
.hero__film video { width: 100%; height: 100%; object-fit: cover; }

/* ── Бенто ─────────────────────────────────────────────────────────────── */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.tile { margin: 0; min-width: 0; }
.t-wide { grid-column: span 8; }
.t-half { grid-column: span 6; }
.t-third { grid-column: span 4; }
.t-quarter { grid-column: span 3; }
.card { grid-column: span 4; align-self: stretch; }

.media { position: relative; border-radius: var(--r); overflow: hidden; background: #d9cfc0; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.media--still { aspect-ratio: 16 / 9; }
.media--loop { aspect-ratio: 4 / 5; }
.t-quarter .media--loop { aspect-ratio: 3 / 4; }

figcaption { padding: 12px 2px 0; }
figcaption h3 + p { margin-top: 4px; }
figcaption p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink-2); max-width: 42ch; }

.card {
  background: var(--paper); border-radius: var(--r); padding: clamp(18px, 1.8vw, 26px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 6px 22px rgba(43, 38, 34, .06);
  display: flex; flex-direction: column;
}
.card h3 { margin-bottom: 12px; }
.card p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }

/* список городов: просто текст, как в меню выбора города, но крупно — он и есть содержание карточки */
.card p.cities { font: 500 clamp(16px, 1.3vw, 21px)/1.5 var(--display); color: var(--ink); letter-spacing: -.005em; }

/* клавиши — как подсказки игры */
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 42px; border-radius: 9px;
  background: var(--key); color: var(--key-ink); font: 600 15px/1 var(--mono);
  box-shadow: 0 3px 0 rgba(43, 38, 34, .2), 0 4px 12px rgba(43, 38, 34, .08);
}
kbd.space { width: 196px; }
.keys { display: flex; flex-direction: column; justify-content: space-between; gap: 22px; flex: 1 1 auto; }
.keys__part p { margin-top: 10px; }
.keys__phone { padding-top: 16px; border-top: 1px solid var(--line); }
.keys__phone p { margin-top: 0; }
.kb { display: flex; align-items: flex-end; gap: 14px; }
.kb__set { display: inline-grid; justify-items: center; gap: 6px; }
.kb__set > span { display: flex; gap: 6px; }
.kb__or { font-size: 14px; color: var(--ink-2); padding-bottom: 12px; }

/* лозунги: буквы кота, Pangolin, цвет баллончика игры */
.slogans { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.slogans li { display: grid; gap: 3px; }
.slogan__city { font: 500 12px/1.2 var(--mono); color: var(--ink-2); letter-spacing: .03em; }
.slogan__text { font: 400 19px/1.08 var(--hand); color: var(--spray); }
.slogan__tr { font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }

/* ряд гирлянды: высоту задаёт кадр, петля и карточка растягиваются под него */
#garlands .bento { align-items: stretch; }
.t-row { display: flex; flex-direction: column; }
.t-row .media--fill { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
.media--fill video { position: absolute; inset: 0; }
.card--reach { grid-column: span 3; gap: 14px; }
.card--reach h3 { margin-bottom: 4px; }
.card--reach p:last-child { margin-top: auto; }
.reach { display: grid; gap: 2px; }
.reach b { font: 700 clamp(34px, 3.2vw, 52px)/1 var(--display); color: var(--ink); letter-spacing: -.02em; }

/* ── Мысли кота ───────────────────────────────────────────────────────── */
.think { margin: 0; }
.think__frame {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  border-radius: var(--r); overflow: hidden; background: #2a2c47; aspect-ratio: 16 / 9;
  -webkit-tap-highlight-color: transparent;
}
.think__frame img { width: 100%; height: 100%; object-fit: cover; }
.think__frame:focus-visible { outline: 3px solid var(--beacon); outline-offset: 3px; }
.think__words { position: absolute; inset: 0; pointer-events: none; }
.think__words .say { position: absolute; left: 0; top: 0; }
.think__words canvas { position: absolute; }

/* ── Фильм ─────────────────────────────────────────────────────────────── */
.film { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.film__frame { height: min(80vh, 820px); min-height: 480px; aspect-ratio: 9 / 16; border-radius: var(--r); overflow: hidden; background: #241f2b; }
.film__frame video { width: 100%; height: 100%; object-fit: contain; background: #241f2b; }
/* главы: кадры из самого фильма, по нажатию ролик переходит к плану */
.chapters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px var(--gap); }
.chap {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: baseline;
  width: 100%; padding: 0; background: none; border: 0; text-align: left; cursor: pointer;
  font-size: 15px; line-height: 1.3; transition: color .2s;
}
.chap__pic {
  grid-column: 1 / -1; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; margin-bottom: 6px;
  border-radius: 10px; background: #d9cfc0; transition: transform .25s var(--ease), box-shadow .25s;
}
.chap:hover .chap__pic, .chap.is-on .chap__pic { box-shadow: 0 0 0 3px var(--beacon); }
.chap__t { font: 500 12.5px/1 var(--mono); color: var(--ink-2); }
.chap:hover .chap__name, .chap.is-on .chap__name { color: var(--beacon); }
.chap:focus-visible { outline: 2px solid var(--beacon); outline-offset: 2px; border-radius: 4px; }

/* ── Конец ─────────────────────────────────────────────────────────────── */
.end { padding-bottom: clamp(72px, 8vw, 120px); }
.end h2 { max-width: 18ch; }
.end__links { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 0; }

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px var(--pad); border-top: 1px solid var(--line);
  font-size: 14px; color: var(--ink-2);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ── Ширины ────────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .t-wide { grid-column: span 12; }
  .card--cities, .card--keys, .card--slogans { grid-column: span 12; }
  .slogans { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
  .keys { display: grid; grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr); gap: 20px 40px; align-items: start; }
  .keys__phone { padding-top: 0; border-top: 0; padding-left: 28px; border-left: 1px solid var(--line); }
}
@media (max-width: 1100px) {
  .t-quarter { grid-column: span 6; }
  .t-quarter .media--loop { aspect-ratio: 4 / 5; }
  #garlands .t-half { grid-column: span 12; }
  #garlands .t-quarter, .card--reach { grid-column: span 6; }
  .t-row .media--fill { aspect-ratio: 4 / 3; flex: none; }
}
@media (max-width: 820px) {
  .hero__row { grid-template-columns: 1fr; }
  .hero__film { height: auto; min-height: 0; width: 100%; aspect-ratio: 4 / 5; }
  .t-third { grid-column: span 12; }
  .t-third .media--loop { aspect-ratio: 4 / 3; }
  .slogans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keys { display: flex; flex-direction: column; gap: 20px; }
  .keys__phone { padding: 16px 0 0; border-left: 0; border-top: 1px solid var(--line); max-width: none; }
  .film { grid-template-columns: 1fr; }
  .film__frame { height: auto; min-height: 0; width: min(100%, 460px); }
  .chapters { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--gap); border-top: 1px solid var(--line); }
  .chapters li { border-bottom: 1px solid var(--line); }
  .chap { grid-template-columns: 34px auto 1fr; gap: 0 8px; align-items: center; padding: 8px 0; font-size: 14px; }
  .chap__pic { grid-column: auto; grid-row: span 2; width: 34px; margin: 0; border-radius: 6px; }
  .chap__t { grid-column: 2 / -1; }
  .chap__name { grid-column: 2 / -1; }
  .t-quarter, .t-half, #garlands .t-quarter, .card--reach { grid-column: span 12; }
  .t-quarter .media--loop, .t-row .media--fill { aspect-ratio: 4 / 3; }
  .think__frame { aspect-ratio: 9 / 16; }
  .bar__back { padding: 10px 13px; font-size: 13px; }
  .bar { gap: 12px; }
  .end__links .btn { flex: 1 1 auto; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}
