/* Рыба — справочник видов. Тёмная тема проекта: плотно, спокойно.
   Базовые переменные и топбар берутся из style.css; здесь только раздел. */

body.fish-detail-open { overflow: hidden; }

/* ─────────────────────────── шапка ─────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-1);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .12s, background-color .12s, color .12s;
}
.back-link:hover { border-color: #3a4b50; background: var(--bg-2); color: var(--text); }

.fish-summary {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
}
.fish-summary b { color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ─────────────────────────── каркас ─────────────────────────── */

.fish-main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px 18px 56px;
}

.fish-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-1);
}

.fish-toolbar .field { min-width: 168px; }
.fish-toolbar .fish-search { flex: 1 1 260px; }

.fish-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.fish-check input { width: 14px; height: 14px; margin: 0; accent-color: #4d8563; cursor: pointer; }
.fish-check:hover { color: var(--text-dim); }

.fish-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* ─────────────────────────── сетка видов ─────────────────────────── */

.fish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.fish-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #131a1c, #101516);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .12s, background-color .15s;
}
.fish-tile:hover { border-color: #3a4b50; transform: translateY(-1px); }
.fish-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fish-tile.is-empty { opacity: .78; }
.fish-tile.is-empty:hover { opacity: 1; }

.tile-thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2.15 / 1;
  padding: 2px 7px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, #1b2427 0%, #0b0f10 70%);
  border-bottom: 1px solid var(--line-soft);
}
.tile-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .45));
  transition: transform .2s ease;
}
.fish-tile:hover .tile-thumb img { transform: scale(1.03); }

.tile-ph {
  display: block;
  width: 54%;
  max-height: 72%;
  color: #3c4f52;
}
.tile-ph svg { display: block; width: 100%; height: auto; }

.tile-kind {
  position: absolute;
  top: 6px;
  left: 7px;
  padding: 1px 5px;
  border: 1px solid #4a3f22;
  border-radius: 4px;
  background: rgba(12, 15, 16, .78);
  color: #cbb06a;
  font-size: 9px;
  letter-spacing: .4px;
  text-transform: uppercase;
}

.tile-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 9px 11px 10px;
}

.tile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.tile-name {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .1px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
}

.posts-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 26px;
  padding: 2px 6px;
  border: 1px solid #33543f;
  border-radius: 999px;
  background: #182720;
  color: #b9e3c8;
  font: 600 10.5px/1.35 var(--mono);
  font-variant-numeric: tabular-nums;
}
.posts-pill.is-zero {
  border-color: var(--line);
  background: var(--bg-2);
  color: var(--muted-2);
}

.tile-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.35;
}
.tile-row .lbl {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.tile-row .val {
  min-width: 0;
  overflow: hidden;
  color: var(--text-dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tile-row .val.is-muted { color: var(--muted-2); font-style: italic; }

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px dashed var(--line-soft);
  color: var(--muted-2);
  font-size: 10.5px;
}
.tile-foot .weight { color: var(--coords); font: 500 10.5px/1.3 var(--mono); }
.tile-foot .weight.is-empty { color: var(--muted-2); font-family: var(--sans); }

/* ─────────────────────────── пусто / загрузка ─────────────────────────── */

.fish-empty {
  padding: 46px 20px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}
.fish-empty h2 { margin-bottom: 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.fish-empty p { margin-bottom: 15px; font-size: 12.5px; line-height: 1.55; }

.fish-main .loading-line { margin: 22px 0 8px; }
.fish-main .notice { margin: 0 0 12px; }

/* ─────────────────────────── деталь ─────────────────────────── */

.fish-detail {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 26px 22px;
  overflow-y: auto;
}

.fish-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 8, .82);
  backdrop-filter: blur(3px);
}

.fish-detail-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1080px;
  margin: auto;
  border: 1px solid #2b3a3d;
  border-radius: 12px;
  background: var(--bg-1);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
}

.fish-detail-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(12, 16, 17, .85);
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.fish-detail-close:hover { border-color: #46585d; background: var(--bg-3); color: var(--text); }

.fish-detail-body { padding: 18px 20px 20px; }

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.detail-art {
  display: grid;
  place-items: center;
  min-height: 190px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: radial-gradient(110% 100% at 50% 0%, #1c2528 0%, #0a0e0f 75%);
}
.detail-art img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .5));
}
.detail-art .tile-ph { width: 46%; color: #35474a; }

.detail-head { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.detail-title {
  padding-right: 34px;
  font-size: 24px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: .1px;
  overflow-wrap: anywhere;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }

.badge-fish {
  padding: 3px 8px;
  border: 1px solid #33543f;
  border-radius: 999px;
  background: #182720;
  color: #b9e3c8;
  font: 600 11px/1.35 var(--sans);
}
.badge-fish.is-zero { border-color: var(--line); background: var(--bg-2); color: var(--muted); }
.badge-kind {
  padding: 3px 8px;
  border: 1px solid #4a3f22;
  border-radius: 999px;
  background: #221d10;
  color: #cbb06a;
  font: 600 11px/1.35 var(--sans);
}

.detail-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.detail-note b { color: var(--text-dim); font-weight: 600; }

.detail-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}
.kpi {
  padding: 7px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--bg-2);
}
.kpi dt {
  margin-bottom: 2px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.kpi dd { color: var(--text-dim); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi dd .unit { color: var(--muted-2); font-size: 10.5px; font-weight: 500; }

.detail-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  padding-top: 16px;
}
.detail-section { min-width: 0; }
.detail-section.is-wide { grid-column: 1 / -1; }

.detail-section h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.detail-list { display: flex; flex-direction: column; gap: 5px; }

.stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.stat-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.stat-n {
  color: var(--muted);
  font: 500 10.5px/1.3 var(--mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-bar {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: -2px;
  overflow: hidden;
  border-radius: 2px;
  background: #1b2426;
}
.stat-bar span { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #3f6f57, #6fc394); }

.detail-empty { color: var(--muted-2); font-size: 11.5px; font-style: italic; }

.months {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;
  height: 86px;
  padding-top: 4px;
}
.month {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  max-width: 46px;
  height: 100%;
}
.month-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #6fc394, #2f5c41);
}
.month-n {
  color: var(--muted-2);
  font: 500 9px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.month-lbl {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.recent { width: 100%; border-collapse: collapse; }
.recent th {
  padding: 0 8px 5px 0;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .7px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.recent td {
  padding: 5px 8px 5px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.35;
  vertical-align: top;
}
.recent td.nowrap { white-space: nowrap; }
.recent td .dash { color: var(--muted-2); }
.recent .coord { color: var(--coords); font-family: var(--mono); font-size: 11px; }
.recent a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.recent a:hover { text-decoration: underline; }

.detail-loading { padding: 40px 10px; color: var(--muted-2); font-size: 12px; text-align: center; }
.detail-loading::after { content: "…"; animation: blink 1.2s steps(2) infinite; }

/* ─────────────────────────── адаптив ─────────────────────────── */

@media (max-width: 860px) {
  .detail-hero { grid-template-columns: minmax(0, 1fr); }
  .detail-art { min-height: 150px; }
  .detail-art img { max-height: 230px; }
  .detail-sections { grid-template-columns: minmax(0, 1fr); }
  .detail-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .fish-main { padding: 12px 10px 40px; }
  .fish-toolbar { padding: 10px 11px; gap: 8px 10px; }
  .fish-toolbar .field { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .fish-toolbar .fish-search { flex-basis: 100%; }
  .fish-check { flex: 1 1 100%; padding: 2px; }
  .fish-summary { display: none; }
  .fish-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 9px; }
  .tile-body { padding: 8px 9px 9px; gap: 6px; }
  .tile-name { font-size: 12.5px; }
  .tile-row { font-size: 10.5px; }
  .tile-foot { font-size: 9.5px; }
  .fish-bar .hint { display: none; }
  .back-link { padding: 5px 7px; }

  .fish-detail { padding: 8px; }
  .fish-detail-body { padding: 14px 12px 16px; }
  .detail-title { font-size: 19px; padding-right: 30px; }
  .detail-kpis { gap: 6px; }
  .kpi { padding: 6px 7px; }
  .kpi dd { font-size: 12px; }
  .recent th:nth-child(3), .recent td:nth-child(3) { display: none; }
}
