/* =========================================================
   BikeCheckEU — baseline style.css (clean + fixed)
   - removes duplicate blocks
   - fixes broken @media nesting
   - fixes case photos grid thumbnails (3/2/1 columns, fixed thumb height)
   ========================================================= */

:root{
  --bg:#f6f7f9;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(2,6,23,.06);

  --teal:#14b8a6;
  --teal-dark:#0f766e;

  --stolen:#ef4444;
  --sighting:#f59e0b;
  --found:#22c55e;

  --site-max: 1680px;
  --site-pad: 12px;

  --rail-w: 260px;
  --col-gap: 12px;

  --v-gap: 18px;
}

*{ box-sizing:border-box; }

html, body{ height:100%; }
html, body{ overflow-x:hidden; } /* safety net */

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);

  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* Allow grid/flex children to shrink (prevents tiny overflows) */
.page-shell > *{ min-width:0; }

/* ---------- Header ---------- */
.topbar{
  background:rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:9999;
  margin-bottom:18px;
}

.shell{
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 var(--site-pad);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 18px 0;
}

.brand{ display:flex; align-items:center; gap:10px; }
.brand-mark{
  width:12px;height:12px;border-radius:999px;background:var(--teal);
  box-shadow:0 0 0 6px rgba(20,184,166,.15);
}
.brand-name{ font-weight:800; letter-spacing:.2px; }

.nav{ display:flex; gap:14px; align-items:center; }
.nav-link{
  color:var(--text);
  text-decoration:none;
  font-weight:600;
  padding:8px 10px;
  border-radius:10px;
}
.nav-link.muted{ color:var(--muted); }
.nav-link:hover{ background: rgba(20,184,166,.08); }
.nav-link.active{
  background: rgba(20,184,166,.12);
  color: var(--teal-dark);
}

.nav-sep{
  width:1px;height:18px;background:var(--border);
  display:inline-block;margin:0 6px;
}

.lang-switch{ display:flex; gap:10px; align-items:center; }
.lang-link{ font-weight:900; color:var(--muted); }
.lang-link.active{
  color:var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- Layout: rail + content ---------- */
.page-shell{
  flex:1;

  display:grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  gap: var(--col-gap);
  align-items:start;

  width:100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 0 var(--site-pad);
}

.container-wide{
  width:100%;
  min-width:0;
  margin:0;
  padding:0;
  justify-self:stretch;

  /* baseline центр-колонки контента */
  max-width: 1380px;
}

.container-wide > * + *{ margin-top: var(--v-gap); }

/* Rail */
.side-rail{
  width: var(--rail-w);
  position:sticky;
  top: 75px; /* примерно высота topbar */
  align-self:start;
}

@media (max-width: 1280px){
  .page-shell{
    grid-template-columns: 1fr;
    padding:0;
  }
  .side-rail{ display:none; }
  .shell{ padding:0 12px; }
  .container-wide{ max-width:none; padding:0 12px; }
}

/* ---------- Cards / UI ---------- */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow: var(--shadow);
  padding:16px;
}
.card-soft{ background:rgba(255,255,255,.65); }

.label{ font-size:12px; color:var(--muted); font-weight:700; }
.row{ display:flex; gap:10px; align-items:center; }
.row-between{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }

.input, .select{
  width:100%;
  border:1px solid var(--border);
  border-radius:12px;
  padding:12px 12px;
  font-size:14px;
  outline:none;
  background:#fff;
}
.input:focus, .select:focus{
  border-color: rgba(20,184,166,.6);
  box-shadow:0 0 0 4px rgba(20,184,166,.12);
}

.hint{ margin-top:8px; color:var(--muted); font-size:12px; }
.muted{ color:var(--muted); }
.small{ font-size:12px; }

.btn{
  border:1px solid transparent;
  padding:11px 14px;
  border-radius:12px;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
a.btn{ line-height:1; }

.btn-primary{ background:var(--teal); color:#062a27; }
.btn-primary:hover{ background:var(--teal-dark); color:#eafffb; }

.btn-secondary{ background:#fff; border-color:var(--border); color:var(--text); }
.btn-secondary:hover{ border-color: rgba(20,184,166,.45); }

.btn-ghost{ background:transparent; border-color:transparent; color:var(--muted); }
.btn-ghost:hover{ color:var(--text); }

.divider{ height:1px; background:var(--border); margin:14px 0; }

/* ---------- Sponsors ---------- */
.sponsors-card{ padding:0; display:flex; flex-direction:column; overflow:hidden; }
.sponsors-head{ padding:16px 16px 10px; }
.sponsors-title{ font-weight:900; }

.sponsor-slots{
  display:grid;
  gap:12px;
  padding: 12px 16px 16px;
  overflow:auto;
}
.sponsor-slot{
  border:1px dashed rgba(0,0,0,.18);
  border-radius:14px;
  background:rgba(255,255,255,.65);
  padding:14px;
  min-height:120px;
  display:flex;
  align-items:center;
}

/* ---------- Grid helpers ---------- */
.grid2{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
@media (max-width: 980px){ .grid2{ grid-template-columns:1fr; } }

.grid3{ display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
@media (max-width: 980px){ .grid3{ grid-template-columns:1fr; } }

/* ---------- Badges ---------- */
.badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid var(--border);
}
.badge-stolen{ border-color: rgba(239,68,68,.35); }
.badge-sighting{ border-color: rgba(245,158,11,.35); }
.badge-found{ border-color: rgba(34,197,94,.35); }

/* ---------- Chips ---------- */
.chips{ display:flex; gap:10px; flex-wrap:wrap; }
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:2px solid var(--border);
  background:#fff;
  font-weight:800;
  font-size:12px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease;
}
.chip:hover{ transform: translateY(-1px); }
.chip input{ accent-color: var(--teal); }

.chip-stolen, .chip-sighting, .chip-found{ background:#fff; color:var(--text); }

.chip-stolen:has(input:checked){
  background: rgba(239,68,68,.14);
  border-color: rgba(239,68,68,.55);
  color: #7f1d1d;
}
.chip-sighting:has(input:checked){
  background: rgba(245,158,11,.16);
  border-color: rgba(245,158,11,.55);
  color: #78350f;
}
.chip-found:has(input:checked){
  background: rgba(34,197,94,.14);
  border-color: rgba(34,197,94,.55);
  color: #14532d;
}

/* ---------- Cases list (generic) ---------- */
.case-row{
  text-decoration:none;
  color:inherit;
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:12px 12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.case-row:hover{
  border-color: rgba(20,184,166,.45);
  box-shadow: 0 6px 18px rgba(2,6,23,.08);
  transform: translateY(-1px);
}

.case-left{ min-width:0; }
.case-title{
  font-weight:900;
  margin-top:6px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.muted.small{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.chev{ color:var(--muted); font-size:18px; }

/* =========================================================
   HOME layout v2: map + cases same height
   ========================================================= */
.top-grid-v2{
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:16px;
  align-items:stretch;
}
@media (max-width: 980px){
  .top-grid-v2{ grid-template-columns:1fr; }
}

/* Map card */
.map-card{
  padding:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
}

/* Toolbar */
.map-toolbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.82);
  flex-wrap: wrap;
}

.toolbar-left{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-end;
  min-width:0;
  flex: 1 1 520px;
}
.toolbar-group{ display:flex; flex-direction:column; gap:6px; }
.toolbar-right{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex: 0 0 auto;
}
@media (max-width: 980px){
  .toolbar-right{ width:100%; justify-content:flex-end; }
}

/* Smaller controls in toolbar */
.select-sm{ padding:9px 10px; font-size:13px; border-radius:12px; }
.btn-sm{ padding:9px 12px; border-radius:12px; font-size:13px; }
.chips-sm .chip{ padding:7px 9px; font-size:12px; }
.chips-sm .chip input{ transform: translateY(1px); }

/* Map header (Live map + legend) */
.map-header.compact{
  padding:12px 14px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.82);
}

.map-title{ font-weight:1000; }
.map-subtitle{ font-size:12px; color:var(--muted); }

/* Legend pills */
.legend{ display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.legend-item{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  font-size:12px;
  color:var(--muted);
  padding:6px 10px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
}

.dot{
  width:10px;
  height:10px;
  border-radius:999px;
  display:inline-block;
  flex: 0 0 10px;
}
.dot-stolen{ background:var(--stolen); }
.dot-sighting{ background:var(--sighting); }
.dot-found{ background:var(--found); }

.legend-item:has(.dot-stolen){ border-color: rgba(239,68,68,.35); }
.legend-item:has(.dot-sighting){ border-color: rgba(245,158,11,.35); }
.legend-item:has(.dot-found){ border-color: rgba(34,197,94,.35); }

/* Map size */
.map{
  height:52vh;
  min-height:380px;
  width:100%;
}
.map-v2{
  height:48vh;
  min-height:320px;
  width:100%;
  flex:1;
}
#map{
  height:100%;
  min-height:320px;
}

/* Map footer / privacy note */
.map-footer,
.privacy-note{
  padding: 10px 14px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.78);
}

/* Cases card */
.cases-card{
  display:flex;
  flex-direction:column;
  min-height:0;
  background:rgba(255,255,255,.92);
}
.cases-header{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.82);
}
.cases-title{ font-weight:1000; }

.case-list-v2{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:12px 12px 14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
@media (max-width: 980px){
  .case-list-v2{ padding:12px; }
}

/* Leaflet stacking safety */
.map-card, .map-wrap, .map, #map{
  z-index:1;
  position:relative;
}
.leaflet-pane, .leaflet-top, .leaflet-bottom{ z-index:100; }

/* ---------- Report map ---------- */
.report-map{
  height: 320px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}
@media (max-width: 980px){ .report-map{ height:280px; } }

/* =========================================================
   /cases page (full list)
   ========================================================= */
.cases-filters{ margin:0; }
.cases-filter-grid{
  display:grid;
  grid-template-columns: 2fr 1fr 1fr 2fr auto;
  gap:12px;
  align-items:end;
}
@media (max-width: 980px){
  .cases-filter-grid{ grid-template-columns:1fr; }
}
.cases-filter-actions{ display:flex; justify-content:flex-end; }
.cases-list-full{ display:flex; flex-direction:column; gap:10px; }

.pager{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
@media (max-width: 980px){
  .pager{ flex-wrap:wrap; }
}

/* ---------- Footer ---------- */
.site-footer{
  margin-top: 28px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.6);
}

.footer-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 18px;
  padding: 18px 0;
  align-items:start;
}
@media (max-width: 980px){
  .footer-grid{ grid-template-columns:1fr; }
}

.footer-brand{ padding:18px 0; }
.footer-brand-row{ gap:10px; }

.footer-title{
  font-weight: 900;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text);
}
.footer-col{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding: 18px 0;
}
.footer-link{
  color: var(--muted);
  text-decoration:none;
  font-weight: 700;
  font-size: 13px;
}
.footer-link:hover{ color: var(--text); }

.footer-lang{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top: 8px;
}
.footer-lang-link.active{
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footer-bottom{
  border-top: 1px solid var(--border);
  padding: 12px 0 18px;
  display:flex;
  gap:12px;
  justify-content:space-between;
  flex-wrap:wrap;
}

.kicker{
  width:34px;
  height:34px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:950;
  background: rgba(20,184,166,.10);
  border:1px solid rgba(20,184,166,.18);
  color: var(--teal-dark);
  flex: 0 0 34px;
}

.result-head{ font-weight: 1000; margin-bottom: 10px; }
.result-head.ok{ color: var(--teal-dark); }
.result-head.warn{ color: #b45309; }

/* =========================
   Case page (case.html)
   ========================= */
.card-wide{
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.card h2, .card h3{ margin: 0 0 10px; }
.card h3{ font-size: 18px; font-weight: 950; }

.kv{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  padding:8px 0;
  border-bottom:1px dashed rgba(100,116,139,.20);
}
.kv:last-child{ border-bottom:none; }

.kv > span{ min-width: 90px; }
.kv > b{
  font-weight: 900;
  text-align: right;
  word-break: break-word;
}

/* status pills (Email verified / Public / etc) */
.status-pill{
  display:inline-flex;
  align-items:center;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:900;
  border:1px solid var(--border);
  background:#fff;
  line-height: 1;
}
.status-verified{
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.35);
  color: #14532d;
}
.status-active{
  background: rgba(20,184,166,.12);
  border-color: rgba(20,184,166,.40);
  color: var(--teal-dark);
}
.status-needsreview{
  background: rgba(245,158,11,.14);
  border-color: rgba(245,158,11,.45);
  color: #78350f;
}
.status-removed{
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.40);
  color: #7f1d1d;
}
.status-unverified{
  background: rgba(100,116,139,.08);
  border-color: rgba(100,116,139,.22);
  color: var(--muted);
}

@media (max-width: 980px){
  .kv{ flex-direction: column; align-items:flex-start; }
  .kv > b{ text-align:left; }
}

/* ===== Lightbox ===== */
.lightbox{
  position:fixed;
  inset:0;
  background: rgba(2,6,23,.72);
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
  z-index: 10000;
}
.lightbox.open{ display:flex; }

.lightbox-panel{
  position:relative;
  max-width: min(1100px, 96vw);
  max-height: min(86vh, 900px);
}
.lightbox-img{
  max-width: 1000px;
  max-height: 86vh;
  width:auto;
  height:auto;
  display:block;
  border-radius:18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  background:#fff;
}

/* кнопки */
.lb-btn{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  border:0;
  background: rgba(255,255,255,.92);
  color: var(--text);
  width:44px;
  height:44px;
  border-radius:999px;
  font-size:22px;
  font-weight:900;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.lb-prev{ left:-56px; }
.lb-next{ right:-56px; }
.lb-close{
  position:absolute;
  top:-56px;
  right:0;
  transform:none;
}
@media (max-width: 980px){
  .lb-prev{ left:8px; }
  .lb-next{ right:8px; }
  .lb-close{ top:8px; right:8px; }
  .lb-btn{ width:46px; height:46px; }
}

/* =========================================================
   Case photos gallery — FINAL (SINGLE SOURCE OF TRUTH)
   ========================================================= */
#casePhotos.photos-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:12px;
}

@media (max-width: 1100px){
  #casePhotos.photos-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px){
  #casePhotos.photos-grid{ grid-template-columns: 1fr; }
}

#casePhotos .photo-item{
  display:block;
  width:100%;
  border-radius:18px;
  overflow:hidden;
  background:#fff;
  box-shadow: 0 6px 18px rgba(2,6,23,.06);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  cursor: zoom-in;
  text-decoration:none;
  color:inherit;
}
#casePhotos .photo-item:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(2,6,23,.12);
  border-color: rgba(20,184,166,.45);
}

#casePhotos .photo-thumb{
  width:100%;
  height:180px;           /* key: prevents “giant” images */
  padding:4px;
  background:#fff;
}

#casePhotos .photo-thumb img{
  width:100%;
  height:100%;
  max-width:none;
  object-fit:cover;
  display:block;
  border-radius:12px;
}

/* =========================================================
   Hero / pills (as in your file)
   ========================================================= */
.hero-serial { padding: 18px; }

.hero-title{
  font-size: 46px;
  line-height: 1.05;
  margin: 0;
}

.hero-actions{ margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.hero-actions-row{ display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:9px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  text-decoration:none;
  font-weight:850;
  background:#fff;
  color:var(--text);
  transition: transform .08s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.pill:hover{
  border-color: rgba(20,184,166,.45);
  box-shadow: 0 6px 18px rgba(2,6,23,.08);
  transform: translateY(-1px);
}
.pill-stolen{ border-color: rgba(239,68,68,.35); }
.pill-sighting{ border-color: rgba(245,158,11,.35); }
.pill-found{ border-color: rgba(34,197,94,.35); }

/* Hero v2 layout */
.hero-serial{
  padding: 22px;
  position:relative;
  overflow:hidden;
  border-color: rgba(20,184,166,.22);
  background:
    radial-gradient(900px 420px at 15% 15%, rgba(20,184,166,.10), transparent 60%),
    radial-gradient(700px 380px at 90% 10%, rgba(2,132,199,.07), transparent 55%),
    var(--card);
}
.hero-serial:before{
  content:"";
  position:absolute;
  inset:-2px;
  border-radius:20px;
  background: linear-gradient(135deg, rgba(20,184,166,.22), rgba(2,132,199,.10), rgba(255,255,255,0));
  pointer-events:none;
  filter: blur(10px);
  opacity:.7;
}
.hero-serial > *{ position:relative; }

.hero-serial-grid{
  display: grid;
  grid-template-columns: 1.6fr .9fr;
  gap: 16px;
  align-items: stretch;
}

.hero-subtitle{ margin: 10px 0 16px; max-width: 70ch; }

.hero-input-row{ display:flex; gap: 10px; align-items: center; width:100%; min-width:0; }
.hero-input{
  padding: 14px 14px;
  font-size: 16px;
  border-radius: 14px;
  width:100%;
  max-width:100%;
  min-width:0;
}
.hero-btn{
  padding: 13px 16px;
  border-radius: 14px;
  white-space: nowrap;
}

.hero-result{
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
  box-shadow: 0 8px 22px rgba(2,6,23,.06);
}

.hero-side-card{
  border: 1px solid rgba(15,118,110,.16);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 30px rgba(2,6,23,.05);
  padding: 14px;
  height:100%;
  display:flex;
  flex-direction:column;
}
.hero-side-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight: 950;
  margin-bottom: 10px;
}
.hero-side-title:before{
  content:"";
  width:10px;height:10px;border-radius:999px;
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(20,184,166,.12);
}
.hero-side-row{ display:flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hero-side-card .hero-side-bottom{ margin-top:auto; }

.stats-number{
  font-size: 48px;
  font-weight: 1000;
  letter-spacing: -1px;
  margin: 8px 0 10px;
  color: var(--teal-dark);
  text-shadow: 0 1px 0 rgba(0,0,0,.04);
}

/* How cards accents */
.how .card{ position:relative; overflow:hidden; }
.how .card:before{
  content:"";
  position:absolute;
  left:0; top:0; right:0;
  height:4px;
  background: rgba(20,184,166,.20);
}
.how .card:nth-child(1):before{ background: rgba(20,184,166,.25); }
.how .card:nth-child(2):before{ background: rgba(245,158,11,.22); }
.how .card:nth-child(3):before{ background: rgba(2,132,199,.18); }

.trust-row .card-soft{
  background:
    radial-gradient(420px 200px at 10% 0%, rgba(20,184,166,.10), transparent 55%),
    #ffffff;
  border: 1px solid rgba(20,184,166,.18);
}
.trust-row h3{
  display:flex;
  align-items:center;
  gap:10px;
}
.trust-row h3:before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(20,184,166,.12);
}

/* =========================
   Mobile navigation (drawer)
   ========================= */
.nav-burger{
  display:none;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  font-size:18px;
  font-weight:900;
  cursor:pointer;
}

.no-scroll{ overflow:hidden; }

.nav-drawer{
  position:fixed;
  inset:0;
  background: rgba(2,6,23,.55);
  z-index: 11000;
  display:flex;
  justify-content:flex-end;
}
.nav-drawer.open{ display:flex; }
.nav-drawer[hidden]{ display:none; }

.nav-drawer-links{
  width:min(92vw, 360px);
  height:100%;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-left:1px solid var(--border);
  box-shadow: 0 18px 60px rgba(2,6,23,.25);
  padding:14px;
  overflow:auto;
}
.nav-drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:#fff;
}
.nav-close{
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  font-size:16px;
  font-weight:900;
  cursor:pointer;
}
.nav-drawer-link{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 12px;
  border-radius:14px;
  text-decoration:none;
  font-weight:900;
  color: var(--text);
  border:1px solid rgba(0,0,0,0);
}
.nav-drawer-link:hover{
  background: rgba(20,184,166,.08);
  border-color: rgba(20,184,166,.18);
}
.nav-drawer-link.danger{ border-color: rgba(239,68,68,.22); }
.nav-drawer-link.warn{ border-color: rgba(245,158,11,.22); }
.nav-drawer-link.ok{ border-color: rgba(34,197,94,.22); }

.nav-drawer-divider{ height:1px; background: var(--border); margin: 12px 0; }

.nav-drawer-lang-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:8px;
}
.nav-drawer-link.lang{
  padding:9px 10px;
  border:1px solid var(--border);
  background:#fff;
}
.nav-drawer-link.lang.active{
  border-color: rgba(20,184,166,.45);
  background: rgba(20,184,166,.10);
  color: var(--teal-dark);
}

/* =========================================================
   Mobile-only UX improvements
   ========================================================= */
@media (max-width: 980px){
  /* header */
  .nav{ display:none; }
  .nav-burger{ display:inline-flex; align-items:center; justify-content:center; }
  .topbar-inner{ padding: 12px 0; }
  .brand-name{ font-size: 16px; }
  :root{ --site-pad: 12px; }

  /* case page actions */
  .row-between{ flex-direction: column; align-items: stretch; }
  .row-between > div:last-child{ justify-content: flex-start !important; width:100%; }
  .row-between > div:last-child .btn{ width:100%; justify-content:center; }

  /* case title */
  .card-wide h2{ font-size: 22px; line-height: 1.2; }

  /* report page */
  .report-page .row{ flex-direction: column; align-items: stretch; }
  #locateBtn{ width:100%; }
  .report-page .row[style*="justify-content:flex-end"]{ justify-content: stretch !important; }
  .report-page .row[style*="justify-content:flex-end"] .btn{ width:100%; justify-content:center; }
  .report-map{ height: 320px; }

  /* hero */
  .hero-title{ font-size: 30px; line-height: 1.1; }
  .hero-serial{ padding:16px; }
  .hero-serial-grid{ grid-template-columns: 1fr; }
  .hero-input-row{ flex-direction: column; align-items: stretch; }
  .hero-btn{ width:100%; }
  .hero-side-row .btn{ width:100%; justify-content:center; }
  .hero-side-bottom .pill{ width:100%; justify-content:center; }
  .stats-number{ font-size:36px; }
}

/* ===== Mobile drawer visibility (FIX) ===== */
.nav-drawer{
  display:none;              /* по умолчанию скрыто */
}

.nav-drawer.open{
  display:flex;              /* открывается только по классу open */
}

.nav-drawer[hidden]{
  display:none !important;   /* если hidden стоит — всегда скрыто */
}

/* =========================================================
   Mobile drawer (matches your HTML: .mobile-drawer/#mobileDrawer)
   Put at VERY END of style.css
   ========================================================= */

/* desktop: drawer hidden */
.mobile-drawer{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.55);
  display: none;                 /* ключ */
  justify-content: flex-end;
  z-index: 20000;
}

/* show only when open */
.mobile-drawer.open{
  display: flex;                 /* ключ */
}

.mobile-drawer-panel{
  width: min(92vw, 360px);
  height: 100%;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 40px rgba(0,0,0,.2);
  padding: 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
}

.drawer-close{
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.drawer-link{
  padding: 12px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 800;
  color: var(--text);
  border: 1px solid rgba(0,0,0,0);
}

.drawer-link:hover{
  background: rgba(20,184,166,.08);
  border-color: rgba(20,184,166,.18);
}

.drawer-link.danger{ border-color: rgba(239,68,68,.22); }
.drawer-link.warn{ border-color: rgba(245,158,11,.22); }
.drawer-link.ok{ border-color: rgba(34,197,94,.22); }

/* burger visibility */
.nav-burger{ display: none; }

@media (max-width: 980px){
  .nav{ display: none; }
  .nav-burger{
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* lock body scroll when drawer open */
.no-scroll{
  overflow: hidden;
}

/* =========================================
   Lightbox mobile fix
   ========================================= */

.lightbox{
  padding: 24px;
}

.lightbox-panel{
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.lightbox-img{
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;   /* важно — не cover */
  display:block;
}

/* Mobile specific */
@media (max-width: 980px){

  .lightbox{
    padding: 12px;   /* меньше отступов */
  }

  .lightbox-panel{
    max-height: 94vh;
  }

  .lightbox-img{
    max-height: 88vh;
  }

  /* кнопки не должны выходить за экран */
  .lb-prev{ left: 8px; }
  .lb-next{ right: 8px; }
  .lb-close{
    top: 8px;
    right: 8px;
  }
}

/* =========================
   Mobile right-edge clipping fix
   Put at VERY END of style.css
   ========================= */

@media (max-width: 980px){

  /* allow grid/flex children to shrink instead of overflowing */
  .container-wide,
  .card,
  .hero-serial,
  .hero-serial-grid,
  .hero-main,
  .hero-side,
  .hero-side-card,
  .hero-input-row,
  .row,
  .row-between{
    min-width: 0;
  }

  /* make form controls never overflow */
  input, select, textarea, button, a.btn{
    max-width: 100%;
  }

  /* IMPORTANT: inputs in flex rows */
  .hero-input{
    width: 100%;
    min-width: 0;
  }

  /* if any text block forces width */
  .hero-subtitle,
  .result-head,
  .muted,
  .small{
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* safety: if something still overflows, don't clip content inside hero */
  .hero-serial{
    overflow: visible; /* only on mobile */
  }
}