/* loopyqoff — «одно стекло, несколько моделей»
   Палитра: бледная кромка закалённого стекла + жёлтая лента рулетки. */
:root {
  --bg: #e9f0ed;
  --surface: #f6faf8;
  --ink: #0f221d;
  --muted: #586b65;
  --line: #c6d4ce;
  --tape: #f2c230;
  --tape-ink: #2b2100;
  --glass: rgba(255, 255, 255, .55);
  --radius: 18px;
  --display: "Unbounded", system-ui, sans-serif;
  --body: "Onest", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1613;
    --surface: #13201c;
    --ink: #e4ede9;
    --muted: #8ea49c;
    --line: #26372f;
    --glass: rgba(255, 255, 255, .04);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 3px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ── шапка ───────────────────────────────── */
.top { padding: 18px 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; }
.mark {
  font: 600 18px/1 var(--display);
  letter-spacing: -.02em;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px;
}
.mark i {
  width: 14px; height: 24px; border: 2px solid currentColor; border-radius: 4px;
  position: relative; display: inline-block;
}
.mark i::after { content: ""; position: absolute; inset: 3px; border-radius: 1px; background: var(--tape); }
.mark b { font-weight: 600; color: var(--muted); }

main { flex: 1; }
.foot { padding: 32px 0 28px; color: var(--muted); font-size: 13px; }

/* ── главный экран ─────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 48px;
  align-items: center;
  padding: 40px 0 56px;
}
.hero h1 {
  font: 600 clamp(32px, 6vw, 60px)/1.02 var(--display);
  letter-spacing: -.035em;
  margin: 0 0 18px;
}
.hero h1 em { font-style: normal; text-decoration: underline; text-decoration-color: var(--tape); text-decoration-thickness: .16em; text-underline-offset: .1em; text-decoration-skip-ink: none; }
.hero p.lead { color: var(--muted); font-size: 18px; margin: 0 0 28px; max-width: 30em; }

/* строка поиска */
.search { position: relative; max-width: 560px; }
.search form {
  display: flex; align-items: center;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 6px 6px 22px;
  box-shadow: 6px 6px 0 var(--ink);
  transition: box-shadow .2s, transform .2s;
}
.search form:focus-within { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--tape), 8px 8px 0 2px var(--ink); }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font: 500 17px/1.2 var(--body); color: var(--ink);
  padding: 12px 0;
}
.search input::placeholder { color: var(--muted); opacity: .8; }
.search button {
  flex: none;
  border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg);
  border-radius: 999px;
  height: 48px; padding: 0 22px;
  font: 600 15px/1 var(--body);
  display: inline-flex; align-items: center; gap: 8px;
}
.search button svg { width: 18px; height: 18px; }
.count { margin: 16px 4px 0; color: var(--muted); font-size: 14px; }
.count b { font-family: var(--mono); font-weight: 500; color: var(--ink); }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 20;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 16px;
  overflow: hidden; box-shadow: 6px 6px 0 var(--ink);
}
.suggest:empty { display: none; }
.suggest a {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; text-decoration: none; border-top: 1px solid var(--line);
}
.suggest a:first-child { border-top: 0; }
.suggest a:hover, .suggest a:focus-visible { background: var(--glass); outline: none; }
.suggest .name { font-weight: 600; flex: 1; min-width: 0; }
.suggest .dims { font: 13px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.suggest .empty { padding: 16px; color: var(--muted); }

/* ── сигнатура: два контура экрана совпадают ── */
.fit { position: relative; aspect-ratio: 1 / 1.08; max-width: 380px; width: 100%; justify-self: center; }
.fit svg { width: 100%; height: 100%; overflow: visible; }
.fit .outline { fill: var(--glass); stroke: var(--ink); stroke-width: 2.5; }
.fit .a { animation: slideA 7s cubic-bezier(.65, 0, .25, 1) infinite; }
.fit .b { animation: slideB 7s cubic-bezier(.65, 0, .25, 1) infinite; stroke-dasharray: 7 6; }
.fit .tape { stroke: var(--tape); stroke-width: 10; stroke-linecap: butt; stroke-dasharray: 400; animation: tape 7s ease-in-out infinite; }
.fit .tick { stroke: var(--tape-ink); stroke-width: 1.5; animation: fadeTicks 7s ease-in-out infinite; }
.fit text { font: 500 13px var(--mono); fill: var(--ink); }
.fit .label { animation: fadeTicks 7s ease-in-out infinite; }
.fit .pair {
  position: absolute; left: 0; right: 0; bottom: -40px; text-align: center;
  font: 600 14px/1.3 var(--display); letter-spacing: -.01em;
}
.fit .pair span { color: var(--muted); font-family: var(--body); font-weight: 500; }
@keyframes slideA {
  0%, 8% { transform: translateX(-46px) rotate(-6deg); }
  38%, 86% { transform: none; }
  100% { transform: translateX(-46px) rotate(-6deg); }
}
@keyframes slideB {
  0%, 8% { transform: translateX(46px) rotate(5deg); opacity: .9; }
  38%, 86% { transform: none; opacity: 1; }
  100% { transform: translateX(46px) rotate(5deg); opacity: .9; }
}
@keyframes tape { 0%, 40% { stroke-dashoffset: 400; } 58%, 84% { stroke-dashoffset: 0; } 96%, 100% { stroke-dashoffset: 400; } }
@keyframes fadeTicks { 0%, 50% { opacity: 0; } 60%, 84% { opacity: 1; } 94%, 100% { opacity: 0; } }
.fit .a, .fit .b { transform-box: fill-box; transform-origin: center; }

/* ── недавно добавлены ─────────────────────── */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.section-head h2 { font: 600 22px/1.1 var(--display); letter-spacing: -.02em; margin: 0; }
.section-head span { color: var(--muted); font-size: 14px; }

.models {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.model {
  display: flex; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; height: 100%;
  transition: border-color .2s, transform .2s;
}
.model:hover { border-color: var(--ink); transform: translateY(-2px); }
.model .shape { flex: none; width: 40px; height: 64px; display: flex; align-items: center; justify-content: center; }
.model .shape i { display: block; border: 2px solid var(--ink); border-radius: 6px; background: var(--glass); transition: background .2s; }
.model:hover .shape i { background: var(--tape); }
.model .name { display: block; font-weight: 600; line-height: 1.25; }
.model .meta { display: block; font: 12.5px/1.4 var(--mono); color: var(--muted); margin-top: 4px; }

.reveal { opacity: 0; transform: translateY(14px); animation: rise .6s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ── страницы результата и модели ──────────── */
.page { padding: 24px 0 40px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 18px; }
.back:hover { color: var(--ink); }
.page h1 { font: 600 clamp(26px, 4.5vw, 40px)/1.1 var(--display); letter-spacing: -.03em; margin: 0 0 8px; }
.page .sub { color: var(--muted); margin: 0 0 28px; }
.page .search { margin-bottom: 32px; }

.device {
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start;
}
.screen-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; position: sticky; top: 16px;
}
.screen-card .big { display: flex; justify-content: center; padding: 8px 0 18px; }
.screen-card .big i { display: block; border: 2.5px solid var(--ink); border-radius: 14px; background: var(--glass); position: relative; }
.screen-card .big i::before, .screen-card .big i::after { position: absolute; font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.screen-card .big i::before { content: attr(data-w); left: 50%; bottom: -22px; transform: translateX(-50%); }
.screen-card .big i::after { content: attr(data-h); top: 50%; right: -12px; transform: translate(100%, -50%); }
.specs { margin: 18px 0 0; display: grid; gap: 10px; }
.specs div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-family: var(--mono); text-align: right; }

.fits h2 { font: 600 20px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.fits .sub { margin-bottom: 18px; }
.brand-group { margin-bottom: 22px; }
.brand-group h3 { font: 600 13px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.brand-group .models { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.brand-group.own h3::after { content: " · та же марка"; text-transform: none; letter-spacing: 0; }

.nothing { background: var(--surface); border: 1px dashed var(--muted); border-radius: var(--radius); padding: 28px; }
.nothing h2 { font: 600 20px/1.2 var(--display); margin: 0 0 8px; }
.nothing p { color: var(--muted); margin: 0 0 6px; }

/* ── телефоны ──────────────────────────────── */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 0; padding: 0 0 32px; }
  .fit { order: -1; max-width: 150px; margin: 0 auto 44px; justify-self: center; }
  .fit .pair { font-size: 12px; bottom: -32px; white-space: nowrap; left: -40px; right: -40px; }
  .hero h1 { font-size: clamp(28px, 8.4vw, 40px); margin-bottom: 12px; }
  .section-head span { display: none; }
  .hero p.lead { font-size: 16px; margin-bottom: 22px; }
  .device { grid-template-columns: 1fr; }
  .screen-card { position: static; order: 2; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .search form { padding-left: 16px; box-shadow: 4px 4px 0 var(--ink); }
  .search input { font-size: 16px; }
  .search button { padding: 0 16px; height: 44px; }
  .search button .txt { display: none; }
  /* списки моделей на телефоне — одной колонкой, листаются вниз */
  .home .models, .brand-group .models, .page .models { grid-template-columns: 1fr; gap: 10px; }
  .model { padding: 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .fit .a, .fit .b { transform: none; }
  .fit .tape { stroke-dashoffset: 0; }
  .fit .tick, .fit .label { opacity: 1; }
}
