/* ==========================================================================
   DataLens / КИНОТЕХНИКА — design tokens
   Signature: the anamorphic flare streak — a horizontal blue-cyan glow line,
   the one recognizable optical artifact of anamorphic cinema lenses. It marks
   focus, active state, and the single load-in animation. Everywhere else,
   the UI stays quiet: black canvas, hairline dividers, engraved-metal type.
   ========================================================================== */

@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500;
  src: url('../assets/fonts/oswald-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 500;
  src: url('../assets/fonts/oswald-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 600;
  src: url('../assets/fonts/oswald-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 600;
  src: url('../assets/fonts/oswald-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 700;
  src: url('../assets/fonts/oswald-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Oswald';
  font-style: normal;
  font-weight: 700;
  src: url('../assets/fonts/oswald-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('../assets/fonts/inter-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('../assets/fonts/inter-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../assets/fonts/inter-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../assets/fonts/inter-cyrillic-500-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('../assets/fonts/inter-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('../assets/fonts/inter-cyrillic-600-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  src: url('../assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  src: url('../assets/fonts/jetbrains-mono-cyrillic-400-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  src: url('../assets/fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  src: url('../assets/fonts/jetbrains-mono-cyrillic-700-normal.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  --bg: #0b0b0d;
  --surface: #17181b;
  --surface-raised: #1e1f23;
  --border: #292a2e;
  --border-soft: #202124;
  --text: #f3f2ed;
  --text-muted: #8d8f96;
  --text-faint: #55565c;
  --accent-fix: #4fc3f7;
  --accent-fix-dim: #2c5568;
  --accent-zoom: #ff9f45;
  --accent-zoom-dim: #6b4a2a;
  --danger: #ff6b6b;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: var(--accent-fix-dim); color: var(--text); }

button, input { font-family: inherit; }

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-fix);
}

a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* ---------- App shell ---------- */

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

header.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding-top: calc(10px + var(--safe-top));
  border-bottom: 1px solid var(--border-soft);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 12px;
  max-width: 1080px;
  margin: 0 auto;
}

.logo-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: block;
}

.brand-block {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  margin-right: auto;
}

.brand-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.count-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* flare streak: signature element, load-in sweep + focus/active marker */
.flare-streak {
  height: 2px;
  width: calc(100% - 32px);
  max-width: 1080px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-fix) 20%,
    #d9f4ff 50%,
    var(--accent-fix) 80%,
    transparent 100%
  );
  background-size: 220% 100%;
  background-position: 100% 0;
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .flare-streak.sweep {
    animation: flare-sweep 1.1s ease-out;
  }
}

@keyframes flare-sweep {
  0% { background-position: 160% 0; opacity: 0; }
  15% { opacity: 1; }
  100% { background-position: -60% 0; opacity: 0.85; }
}

/* ---------- Search ---------- */

.search-row {
  padding: 0 16px 10px;
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color 0.15s ease;
}

.search-field:focus-within {
  border-color: var(--accent-fix);
}

.search-field svg.icon-search {
  flex-shrink: 0;
  margin-left: 12px;
  color: var(--text-muted);
}

.search-field input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 11px 8px;
  font-size: 15px;
  min-width: 0;
}

.search-field input::placeholder { color: var(--text-faint); }
.search-field input:focus { outline: none; }

.clear-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  cursor: pointer;
  display: none;
  align-items: center;
}
.clear-btn.visible { display: flex; }
.clear-btn:hover { color: var(--text); }

/* ---------- Filters ---------- */

.filters {
  padding: 2px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 1080px;
  margin: 0 auto;
}

.filter-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 13px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.chip:hover { color: var(--text); }

.chip.active {
  color: var(--bg);
  background: var(--accent-fix);
  border-color: var(--accent-fix);
  font-weight: 700;
}

.chip.active.zoom-tone {
  background: var(--accent-zoom);
  border-color: var(--accent-zoom);
}

.select-wrap {
  position: relative;
  flex: 1;
}

select.manufacturer-select {
  width: 100%;
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  padding: 9px 32px 9px 12px;
  border-radius: var(--radius-s);
  cursor: pointer;
}

.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---------- Result list ---------- */

.result-meta {
  padding: 0 16px 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  max-width: 1080px;
  margin: 0 auto;
}

main.list-main {
  flex: 1;
  padding: 4px 16px calc(24px + var(--safe-bottom));
  max-width: 1112px;
  margin: 0 auto;
  width: 100%;
}

.lens-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .lens-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  .lens-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.lens-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 13px 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.12s ease, transform 0.08s ease;
  width: 100%;
}

.lens-card:active { transform: scale(0.99); }
.lens-card:hover { border-color: #3a3b40; }

.lens-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.lens-manufacturer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.lens-name {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
  margin-top: 1px;
}

.tag {
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.tag.fix { color: var(--accent-fix); border-color: var(--accent-fix-dim); background: rgba(79,195,247,0.08); }
.tag.zoom { color: var(--accent-zoom); border-color: var(--accent-zoom-dim); background: rgba(255,159,69,0.08); }

.lens-specs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--text);
}

.spec-inline b { color: var(--text-muted); font-weight: 400; margin-right: 3px; }

.lens-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-faint);
}

.type-badge {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------- Empty / loading states ---------- */

.empty-state, .loading-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .iris,
.loading-state .iris {
  margin: 0 auto 18px;
  width: 56px;
  height: 56px;
  opacity: 0.6;
}

.loading-state .iris {
  animation: iris-spin 1.6s linear infinite;
}

@keyframes iris-spin {
  to { transform: rotate(360deg); }
}

.empty-state h3 {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.empty-state p { margin: 0; font-size: 13.5px; }

.load-more-sentinel {
  height: 1px;
}

.load-more-btn {
  display: block;
  margin: 6px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
}
.load-more-btn:hover { color: var(--text); border-color: var(--accent-fix); }

/* ---------- Detail sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5,5,6,0.7);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  max-height: 86vh;
  transform: translateY(100%);
  transition: transform 0.22s cubic-bezier(.32,.72,.34,1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}
.sheet.open { transform: translateY(0); }

@media (min-width: 640px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 50%;
    transform: translate(-50%, 46%) scale(0.97);
    width: 560px;
    max-height: 80vh;
    border-radius: 18px;
    opacity: 0;
  }
  .sheet.open {
    transform: translate(-50%, 50%) scale(1);
    opacity: 1;
  }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 3px;
  margin: 10px auto 4px;
  flex-shrink: 0;
}
@media (min-width: 640px) { .sheet-handle { display: none; } }

.sheet-header {
  padding: 8px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-close:hover { color: var(--text); }

.sheet-manufacturer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sheet-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 24px;
  margin: 2px 0 8px;
  padding-right: 34px;
}

.sheet-tags { display: flex; gap: 6px; }

.sheet-body {
  overflow-y: auto;
  padding: 16px 20px 24px;
}

.spec-plate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
}

.spec-cell {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
}
.spec-cell:nth-child(2n) { border-right: none; }

.spec-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.spec-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--text);
}
.spec-value.empty { color: var(--text-faint); }

.sheet-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Install banner ---------- */

.install-banner {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  z-index: 50;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  transform: translateY(140%);
  transition: transform 0.25s ease;
}
.install-banner.visible { transform: translateY(0); }

.install-banner .txt { flex: 1; font-size: 12.5px; color: var(--text-muted); }
.install-banner .txt b { color: var(--text); display: block; font-family: 'Oswald', sans-serif; font-size: 13.5px; letter-spacing: 0.02em; margin-bottom: 1px; }

.install-btn {
  background: var(--accent-fix);
  color: #06131a;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  padding: 9px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}

.install-dismiss {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.offline-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  text-align: center;
  padding: 7px;
  display: none;
}
.offline-banner.visible { display: block; }
