/* Пиксельный CoFo Redmadrobot лежит в fonts/ и грузится с сайта, поэтому выглядит одинаково на всех устройствах.
   CoFo Sans пока не подключён: основной текст идёт запасным Onest. Чтобы подключить, положи файл в fonts/ и убери «/*» и «*\/» вокруг строки ниже. */
@font-face { font-family: "CoFo Redmadrobot Web"; src: url(fonts/CoFoRedmadrobot-Regular.otf) format("opentype"); font-display: block; }
/*
@font-face { font-family: "CoFo Sans"; src: url(fonts/CoFoSansRegular.woff) format("woff"); font-display: swap; }
*/

:root {
  --red: #FF0000;
  --ink: #1A1A1A;
  --grey-5: #F7F7F7;
  --grey-10: #E0E0E0;
  --grey-50: #828282;
  --green: #D0DBD7;
  --mint: #8DC4AF; /* было #BDDDD1 — сделали темнее, чтобы белый текст читался */
  --navy: #14213D;
  --pixel: "CoFo Redmadrobot Web", "Pixelify Sans", "Courier New", monospace;
  --sans: "CoFo Sans", "Onest", Arial, sans-serif;
  --gap: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { background: #FFFFFF; color: var(--ink); font-family: var(--sans); font-size: 18px; line-height: 1.3; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ol, ul { list-style: none; }
.wrap { max-width: 1440px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 18px; line-height: 1.3; padding: 16px 28px; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-primary { background: var(--red); color: #FFFFFF; }
.btn-dark { background: var(--ink); color: #FFFFFF; padding: 12px 20px; }

/* ---------- Шапка ---------- */
.header { display: flex; align-items: center; justify-content: space-between; padding-top: 32px; padding-bottom: 32px; }
.logo { display: block; color: var(--ink); line-height: 0; }
.logo svg { width: 219px; height: auto; }
.nav { display: flex; align-items: center; gap: 32px; }
.nav-link { text-decoration: none; font-size: 18px; }
.nav-link:hover { color: var(--red); }

/* ---------- Первый экран ---------- */
.hero { display: grid; grid-template-columns: 460px minmax(0, 852px); justify-content: space-between; gap: 48px; padding-top: 24px; padding-bottom: 96px; }
.hero-text { display: flex; flex-direction: column; gap: 29px; }
.hero-copy { display: flex; flex-direction: column; gap: 29px; }
.hero-title { font-family: var(--pixel); font-weight: 400; color: var(--red); font-size: 72px; line-height: 1; letter-spacing: -0.01em; }
.lead { font-size: 24px; line-height: 1.3; max-width: 440px; }
.decor { position: relative; width: 460px; max-width: 100%; aspect-ratio: 460 / 238; flex: none; }
.decor .dl { position: absolute; inset: 0; display: none; }
.decor .dl-base { display: block; }
.decor .d { position: absolute; line-height: 0; }
.decor svg { width: 100%; height: auto; }
/* раскладки ёлки и снежинок — в app.js (DECOR), как в Figma */

/* ---------- Сетка окошек ---------- */
/* Колонки: 6 на десктопе и ноутбуке, 4 на планшете, 2 на телефоне.
   Раскладка каждой плитки — в app.js (TILES: d — 6 колонок, t — 4, m — 2). */
.grid-wrap { container-type: inline-size; align-self: start; min-width: 0; }
.grid {
  --cols: 6; --gap: 6px; --row: 1;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  grid-auto-rows: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * var(--row));
  gap: var(--gap);
}
.tile {
  grid-column: var(--dc) / span var(--dw);
  grid-row: var(--dr) / span var(--dh);
  container-type: size;
  position: relative; overflow: hidden; text-align: left;
  background: var(--bg); color: var(--fg);
  box-shadow: inset 0 0 0 1px var(--border, transparent);
  transition: opacity .15s ease-out;
}
.tile:hover { opacity: .8; }
.tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.tile.is-locked { cursor: default; }

.head { position: absolute; left: 10px; top: 10px; display: flex; align-items: flex-start; }
.num { font-family: var(--pixel); font-size: 44px; line-height: .72; letter-spacing: -0.01em; }
.mon { font-family: var(--sans); font-size: 18px; line-height: 1; letter-spacing: -0.01em; margin-left: 2px; margin-top: -4px; }
.t-title { position: absolute; left: 10px; right: 10px; top: 48px; max-width: 180px; font-size: 14px; line-height: 1.2; letter-spacing: -0.01em; }
@container (min-height: 200px) {
  .num { font-size: 70px; }
  .t-title { top: 66px; font-size: 18px; line-height: 1.3; }
}

/* Плашки статуса: обводка у всех одинаковая (1px), меняется интенсивность.
   открыто — приглушённая, сегодня — белая заливка, скоро — полная. */
.badge { position: absolute; left: 10px; bottom: 10px; font-size: 14px; line-height: 1.2; letter-spacing: -0.01em; padding: 4px 8px; border: 1px solid; }
.tone-dark  { --b-base: 255, 255, 255; }
.tone-light { --b-base: 79, 79, 79; }
.badge-open  { border-color: rgba(var(--b-base), .35); color: rgba(var(--b-base), .55); }
.badge-soon  { border-color: rgb(var(--b-base)); color: rgb(var(--b-base)); }
.badge-today { background: #FFFFFF; border-color: #FFFFFF; color: #4F4F4F; }

.t-icon { position: absolute; right: 10px; bottom: 10px; width: var(--iw); height: var(--ih); line-height: 0; }
.t-icon svg { width: 100%; height: 100%; }
/* если есть плашка, иллюстрация не заезжает на неё: в узких плитках уменьшается, в высоких — поднимается над плашкой */
.has-badge .t-icon { max-width: calc(100% - 104px); }
@container (min-height: 200px) and (max-width: 200px) {
  .has-badge .t-icon { max-width: none; bottom: 47px; }
}

/* ---------- Как это работает ---------- */
.how { background: var(--grey-5); padding: 80px 0; }
.how-title { font-size: 40px; font-weight: 400; line-height: 1.1; margin-bottom: 48px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.step { display: flex; flex-direction: column; gap: 16px; }
.step-num { font-family: var(--pixel); color: var(--red); font-size: 44px; line-height: 1; }
.step p { font-size: 24px; line-height: 1.3; }
.random-link { color: inherit; text-decoration: underline; text-underline-offset: 4px; }
.random-link:hover { color: var(--red); }

/* ---------- Подвал ---------- */
.footer { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-top: 32px; padding-bottom: 32px; font-size: 14px; color: var(--grey-50); }
.footer a { color: inherit; text-underline-offset: 3px; }
.footer a:hover { color: var(--red); }

/* ---------- Карточка окошка ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(26, 26, 26, 0); display: flex; align-items: center; justify-content: center; padding: 24px; transition: background .2s; }
.modal[hidden] { display: none; }
.modal.is-open { background: rgba(26, 26, 26, .6); }
.card { position: relative; width: 640px; max-width: 100%; max-height: calc(100vh - 48px); overflow-y: auto; background: #FFFFFF; padding: 40px; display: flex; flex-direction: column; align-items: flex-start; gap: 24px; opacity: 0; transform: translateY(16px); transition: opacity .2s, transform .2s; }
.modal.is-open .card { opacity: 1; transform: none; }
.c-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }
.c-num { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.c-n { font-family: var(--pixel); color: var(--red); font-size: 72px; line-height: 1; }
.c-date { font-size: 14px; color: var(--grey-50); }
.c-close { font-size: 24px; line-height: 1; padding: 4px; }
.c-close:hover { color: var(--red); }
.c-icon { width: 100px; line-height: 0; }
.c-icon svg { width: 100%; height: auto; }
.c-title { font-size: 40px; font-weight: 400; line-height: 1.1; }
.c-tag { background: var(--green); font-size: 14px; padding: 4px 10px; }
.c-text { font-size: 24px; line-height: 1.3; }
.c-text a, .c-how a { color: var(--red); word-break: break-all; }
.c-text a.random-link, .c-how a.random-link { color: inherit; word-break: normal; }
.promo { font: inherit; color: var(--red); background: none; border: 0; padding: 0; cursor: copy; }
.promo:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-text a.random-link:hover, .c-how a.random-link:hover { color: var(--red); }
.c-how { width: 100%; }
.c-how h3 { font-size: 18px; font-weight: 400; color: var(--grey-50); margin-bottom: 12px; }
.c-how ol { display: flex; flex-direction: column; gap: 12px; }
.c-how li { display: flex; gap: 12px; font-size: 18px; line-height: 1.3; }
.step-n { color: var(--red); flex: none; }
.c-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.c-all { font-size: 18px; text-decoration: underline; text-underline-offset: 4px; }
.c-all:hover { color: var(--red); }

/* ---------- Подсказка ---------- */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: var(--ink); color: #FFFFFF; font-size: 16px; padding: 12px 20px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100vw - 32px); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Ноутбук и планшет (1024): текст сверху, сетка на всю ширину ---------- */
@media (max-width: 1359px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-bottom: 80px; }
  .hero-text { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; }
  .how { padding: 64px 0; }
  .how-title { font-size: 36px; }
  .steps { gap: 24px; }
  .step p { font-size: 20px; }
}

/* ---------- Планшет (768): сетка в 4 колонки ---------- */
@media (max-width: 899px) {
  .grid { --cols: 4; }
  .tile { grid-column: var(--tc) / span var(--tw); grid-row: var(--tr) / span var(--th); }
  .hero { padding-bottom: 64px; }
  .hero-text { flex-direction: column; align-items: stretch; gap: 29px; }
  .decor { width: 100%; aspect-ratio: 688 / 238; }
  .decor .dl-base { display: none; }
  .decor .dl-wide { display: block; }
  .steps { grid-template-columns: 1fr; gap: 32px; }
  .footer { flex-direction: column; }
}

/* ---------- Телефон (390): сетка в 2 колонки ---------- */
@media (max-width: 599px) {
  .t-icon { width: var(--imw, var(--iw)); height: var(--imh, var(--ih)); }
  .decor { aspect-ratio: 358 / 167; }
  .decor .dl-wide { display: none; }
  .decor .dl-mob { display: block; }
  .grid { --cols: 2; --row: .85; }
  .tile { grid-column: var(--mc) / span var(--mw); grid-row: var(--mr) / span var(--mh); }
}

@media (max-width: 767px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .header { padding-top: 16px; padding-bottom: 16px; }
  .logo svg { width: 136px; }
  .nav-link { display: none; }
  .btn-dark { font-size: 14px; padding: 10px 14px; }
  .hero { gap: 32px; padding-top: 8px; padding-bottom: 48px; }
  .hero-text, .hero-copy { gap: 20px; }
  .hero-title { font-size: 60px; }
  .lead { font-size: 18px; }
  .how { padding: 48px 0; }
  .how-title { font-size: 32px; margin-bottom: 32px; }
  .steps { gap: 24px; }
  .step { gap: 8px; }
  .step p { font-size: 18px; }
  .footer { padding-top: 24px; padding-bottom: 24px; }

  /* карточка — шторка снизу */
  .modal { align-items: flex-end; padding: 0; }
  .card { width: 100%; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); padding: 24px 16px 40px; gap: 16px; transform: translateY(100%); }
  .c-num { flex-direction: column; gap: 4px; }
  .c-icon { width: 72px; }
  .c-title { font-size: 28px; }
  .c-text { font-size: 18px; }
  .c-how li { font-size: 16px; }
  .c-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .c-btn { width: 100%; }
  .c-all { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
