/* ============================================================
   coffee.horse — сайт-визитка
   Монохромный цифровой глитч: чистый чёрный, белый гротеск,
   сканлайны, логотип поверх кадра с конём.
   Mobile-first: сначала телефон, потом остальное.
   ============================================================ */

:root {
  /* Два цвета плюс прозрачности — как в референсе */
  --ink: #000;
  --paper: #fff;

  /* Прозрачности подобраны так, чтобы текст проходил по контрасту */
  --dim: rgba(255, 255, 255, 0.62);
  --dimmer: rgba(255, 255, 255, 0.5);
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(255, 255, 255, 0.3);

  --pad: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.22, 0.7, 0.16, 1);

  --font-display: "Inter", "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 84px;
  background: var(--ink);
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

img { max-width: 100%; }

/* ---------- Доступность ---------- */

.skip { position: absolute; left: -9999px; top: 0; }

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

/* ---------- Слои эффектов ---------- */

.fx {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.fx-scan {
  opacity: 0.4;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.055) 0 1px,
    rgba(255, 255, 255, 0) 1px 3px
  );
}

.fx-noise {
  opacity: 0.18;
  mix-blend-mode: screen;
  background-image: var(--noise);
  background-size: 180px 180px;
}

.fx-bars i {
  position: absolute;
  left: 0;
  width: 100%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: sweep 11s linear infinite;
}

.fx-bars i:nth-child(1) { top: 17%; height: 1px; animation-duration: 9s;   animation-delay: 0s; }
.fx-bars i:nth-child(2) { top: 34%; height: 2px; animation-duration: 13s;  animation-delay: 2.4s; }
.fx-bars i:nth-child(3) { top: 53%; height: 1px; animation-duration: 8.5s; animation-delay: 5.1s; }
.fx-bars i:nth-child(4) { top: 71%; height: 3px; animation-duration: 15s;  animation-delay: 1.2s; }
.fx-bars i:nth-child(5) { top: 88%; height: 1px; animation-duration: 10s;  animation-delay: 6.6s; }

@keyframes sweep {
  0%   { transform: translateX(-100%); opacity: 0; }
  3%   { opacity: 0.5; }
  14%  { transform: translateX(100%); opacity: 0; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* ---------- Шапка ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) var(--pad) 12px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.5s var(--ease), background 0.5s var(--ease);
}

.topbar.is-scrolled {
  background: rgba(0, 0, 0, 0.78);
  border-bottom-color: var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mark,
.clock {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
}

.mark { font-weight: 500; }
.clock { color: var(--dim); font-variant-numeric: tabular-nums; }

.mark-dot { color: var(--dim); }

/* ---------- Главный экран ---------- */

/* Экран держит кадр по центру, вокруг — чёрное поле, как в референсе */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: calc(72px + env(safe-area-inset-top)) var(--pad) 72px;
  overflow: hidden;
}

.hero-frame {
  position: relative;
  width: 100%;
  max-width: 1480px;
  aspect-ratio: 4 / 3;
  max-height: calc(100svh - 160px);
  overflow: hidden;
  background: var(--ink);
}

/* Тонкая рамка кадра */
.hero-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.hero-frame picture { display: block; width: 100%; height: 100%; }

.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 66% 46%;
  filter: grayscale(1) contrast(1.04) brightness(0.9);
}

@media (prefers-reduced-motion: no-preference) {
  .hero-img { animation: settle 1.6s var(--ease) both; }

  @keyframes settle {
    from { transform: scale(1.035); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

/* Низкие экраны — телефон в горизонтали, окна небольшой высоты.
   Кадру не хватало высоты, и последняя строка подзаголовка ложилась
   на его рамку: уменьшаем вертикальные поля и даём кадру больше места. */
@media (max-height: 560px) {
  .hero {
    padding-top: calc(54px + env(safe-area-inset-top));
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }

  .hero-frame { max-height: calc(100svh - 92px); }

  .hero-inner { gap: 6px; }

  /* На низких экранах кадр занимает почти всю высоту, и стрелка «вниз»
     ложилась прямо на его рамку. Убираем её здесь: содержимое и так
     видно целиком, а подсказка не должна портить кадр. Специфичность
     повышена, чтобы перебить базовое правило ниже по файлу. */
  .hero .cue { display: none; }
}

/* Телефон в вертикали: кадр заметно выше.
   В пропорции 4/3 кадр занимал лишь треть экрана и конь читался как тёмное пятно;
   в 4/5 он занимает почти половину, и конь виден целиком — с головой и корпусом. */
@media (max-width: 719px) and (orientation: portrait) {
  .hero-frame { aspect-ratio: 4 / 5; }

  /* 68% по горизонтали — конь с головой целиком в кадре;
     при меньшем значении голова упиралась в правый край */
  .hero-img { object-position: 68% 50%; }
}

/* Затемнение под текстом: гарантирует контраст поверх глитча */
.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    /* плотное ядро ровно под логотипом */
    radial-gradient(72% 62% at 50% 52%, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.5) 62%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.18) 30%, rgba(0, 0, 0, 0.32) 70%, rgba(0, 0, 0, 0.7) 100%);
}

.hero-inner {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(6px, 1.6vw, 16px);
  padding: clamp(14px, 3vw, 34px);
  text-align: center;
}

/* Логотип: 800 вместо 900 и чуть свободнее трекинг —
   чуть строже и спокойнее, но тот же гротеск и тот же масштаб */
.wordmark {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: min(12.6vw, 9.5rem);
  font-weight: 800;
  line-height: 0.94;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.9);
}

/* Если браузер умеет контейнерные единицы — логотип меряется по кадру,
   а не по окну, и точно ложится в его ширину */
@supports (container-type: inline-size) {
  .hero-frame { container-type: inline-size; }
  .wordmark { font-size: 14.4cqw; }
}

/* Двоение — «распечатка со сдвигом» */
.wordmark::before,
.wordmark::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  color: var(--paper);
  pointer-events: none;
}

.wordmark::before {
  opacity: 0.4;
  transform: translate(-0.018em, 0.014em);
  clip-path: inset(0 0 54% 0);
}

.wordmark::after {
  opacity: 0.34;
  transform: translate(0.018em, -0.014em);
  clip-path: inset(56% 0 0 0);
}

.stamp {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 2.4vw, 0.9rem);
  letter-spacing: 0.34em;
  text-transform: lowercase;
  color: var(--paper);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.95);
}

.tagline {
  margin: 0;
  max-width: 40ch;
  font-size: clamp(0.82rem, 3vw, 1.02rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.76);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.95);
  text-wrap: pretty;
}

/* Стрелка «листайте вниз» */
.cue {
  position: absolute;
  z-index: 4;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.35s var(--ease);
}

.cue:hover, .cue:focus-visible { color: var(--paper); }

@media (prefers-reduced-motion: no-preference) {
  .cue span { animation: bob 2.6s var(--ease) infinite; }

  @keyframes bob {
    0%, 100% { transform: translateY(0); opacity: 1; }
    55%      { transform: translateY(6px); opacity: 0.35; }
  }
}

/* ---------- Бегущая строка ---------- */

.ticker {
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0;
}

.ticker-track {
  display: flex;
  width: max-content;
}

.ticker-track span {
  padding-right: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.26em;
  text-transform: lowercase;
  color: var(--dim);
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .ticker-track { animation: marquee 34s linear infinite; }

  @keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
  }
}

/* ---------- Секции: общая полоса ---------- */

.about,
.roadmap,
.contact {
  padding: clamp(56px, 12vw, 120px) var(--pad);
}

.about > *,
.roadmap > *,
.contact > * {
  max-width: 1180px;
  margin-inline: auto;
}

.kicker {
  margin: 0 0 clamp(24px, 5vw, 42px);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: lowercase;
}

.marker { color: var(--dimmer); margin-right: 0.6em; }

/* ---------- О бренде ---------- */

.about {
  display: grid;
  gap: clamp(32px, 6vw, 56px);
}

.lead {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(0.98rem, 3.4vw, 1.2rem);
  line-height: 1.62;
  text-wrap: pretty;
}

.lead + .lead { margin-top: clamp(14px, 3vw, 22px); }

.lead-dim {
  color: var(--dim);
  font-size: clamp(0.9rem, 3.1vw, 1.04rem);
}

.about-figure { margin: 0; }

.about-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  filter: grayscale(1) contrast(1.06) brightness(0.92);
}

.about-figure figcaption {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--dimmer);
}

/* ---------- Что дальше ---------- */

.roadmap { border-top: 1px solid var(--line); }

.roadmap .kicker { max-width: 1180px; }

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px clamp(16px, 4vw, 30px);
  padding: clamp(20px, 4.6vw, 30px) 0;
  border-top: 1px solid var(--line);
}

.rows li:last-child { border-bottom: 1px solid var(--line); }

.row-num {
  grid-row: 1 / span 2;
  padding-top: 0.42em;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--dimmer);
}

.rows h3 {
  margin: 0;
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.rows p {
  margin: 0;
  max-width: 42ch;
  color: var(--dim);
  font-size: clamp(0.86rem, 3.1vw, 0.96rem);
  line-height: 1.65;
}

/* ---------- Контакты ---------- */

.contact { border-top: 1px solid var(--line); }

.contact-lead {
  margin: 0 0 clamp(22px, 4vw, 32px);
  max-width: 44ch;
  font-size: clamp(0.94rem, 3.2vw, 1.06rem);
  color: var(--dim);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin: 0 0 clamp(22px, 4vw, 32px);
  padding: 0;
  list-style: none;
}

.links a {
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: border-color 0.3s var(--ease);
}

.links a:hover { border-bottom-color: var(--paper); }

/* Кнопка с почтой: крупная мишень, видно, что нажимается */
.mail {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 2vw, 16px);
  max-width: 100%;
  padding: clamp(13px, 2.6vw, 18px) clamp(16px, 3vw, 24px);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 3vw, 1rem);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.mail:hover, .mail:focus-visible,
.mail.is-copied { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.mail-label { overflow-wrap: anywhere; }

.mail-hint {
  flex: none;
  padding-left: clamp(10px, 2vw, 16px);
  border-left: 1px solid currentColor;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.62;
}

/* ---------- Подвал ---------- */

.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: clamp(36px, 8vw, 64px) var(--pad) calc(40px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  text-align: center;
}

.foot-note {
  margin: 0;
  max-width: 40ch;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--dim);
}

.foot-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--dimmer);
}

/* ---------- Уведомление ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 120;
  max-width: calc(100vw - 36px);
  padding: 11px 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 150%);
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Появление блоков ---------- */

.js [data-reveal] { opacity: 0; transform: translateY(14px); }

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

/* ---------- Планшет и десктоп ---------- */

@media (min-width: 720px) {
  .hero-frame { aspect-ratio: 16 / 10; }

  .hero-img { object-position: 58% 44%; }

  .foot {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

@media (min-width: 900px) {
  .about {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    align-items: start;
  }

  .about-text { order: 1; }
  .about-figure { order: 2; }
}

/* ---------- Уважение к настройкам системы ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html { scroll-behavior: auto; }

  .fx-bars { display: none; }

  .js [data-reveal] { opacity: 1; transform: none; }
}
