:root {
  --paper: #eef2f1;
  --card: #ffffff;
  --wash: #e3eae8;
  --ink: #0c1a20;
  --muted: #5a6e75;
  --line: #d3dedc;
  --sea: #0e6e77;
  --sea-ink: #0a545c;
  --alert: #a63428;
  --alert-wash: #f6e7e4;
  --shadow: 0 1px 2px rgba(12, 26, 32, .06), 0 8px 24px -16px rgba(12, 26, 32, .28);
  --radius: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #091216;
    --card: #101d22;
    --wash: #152730;
    --ink: #e2ecee;
    --muted: #8ea6ad;
    --line: #1f333a;
    --sea: #57b9c3;
    --sea-ink: #8ad3da;
    --alert: #e57866;
    --alert-wash: #2a1a18;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -18px rgba(0, 0, 0, .9);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #091216;
  --card: #101d22;
  --wash: #152730;
  --ink: #e2ecee;
  --muted: #8ea6ad;
  --line: #1f333a;
  --sea: #57b9c3;
  --sea-ink: #8ad3da;
  --alert: #e57866;
  --alert-wash: #2a1a18;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -18px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

img { max-width: 100%; display: block; }

a { color: var(--sea-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }

h1, h2, h3 {
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-weight: 500;
  text-wrap: balance;
  margin: 0;
  letter-spacing: -.01em;
}

.mono, .t-time, .stat-v, .coord {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: 16px; }

/* ---------- шапка ---------- */

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 500;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top-in {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-block: 10px;
  flex-wrap: wrap;
}

.brand { font-family: Newsreader, Georgia, serif; font-size: 19px; white-space: nowrap; }
.brand b { font-weight: 600; }
.brand span { color: var(--muted); font-size: 13px; font-family: "IBM Plex Sans", sans-serif; }

nav.tabs {
  display: flex;
  gap: 2px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
nav.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 "IBM Plex Sans", sans-serif;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--wash); }
.tab[aria-selected="true"] { color: var(--card); background: var(--sea); }

/* ---------- обложка дня ---------- */

.day-head { padding-block: 28px 20px; }
.eyebrow {
  font: 500 12px/1 "IBM Plex Sans", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sea-ink);
  margin-bottom: 10px;
}
.day-head h1 { font-size: clamp(27px, 4.4vw, 40px); line-height: 1.12; }
.day-head p.lede { margin: 12px 0 0; max-width: 62ch; color: var(--muted); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}
.stat { padding: 11px 16px; border-right: 1px solid var(--line); flex: 1 1 auto; min-width: 140px; }
.stat:last-child { border-right: 0; }
.stat-k { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-v { font-size: 15px; font-weight: 500; margin-top: 3px; }

/* ---------- карта ---------- */

.mapbox {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}
.mapbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button {
  appearance: none;
  border: 0;
  background: var(--card);
  color: var(--muted);
  font: 500 13px/1 "IBM Plex Sans", sans-serif;
  padding: 8px 12px;
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--sea); color: #fff; }

.btn-out {
  margin-left: auto;
  font: 500 13px/1 "IBM Plex Sans", sans-serif;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
}
.btn-out:hover { border-color: var(--sea); color: var(--sea-ink); }

.leaf { height: 440px; width: 100%; background: var(--wash); }
.gframe { height: 440px; width: 100%; border: 0; display: block; background: var(--wash); }
@media (max-width: 640px) { .leaf, .gframe { height: 320px; } }

.leaflet-container { font: inherit; background: var(--wash); }
.pin {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--sea);
  color: #fff;
  font: 600 13px/1 "IBM Plex Mono", monospace;
  box-shadow: 0 0 0 2px var(--card), 0 2px 6px rgba(0, 0, 0, .35);
}

/* ---------- секции ---------- */

section { padding-block: 30px; }
section > h2 {
  font-size: 23px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 18px;
}
section > h2 .h2-note { font: 400 13px/1 "IBM Plex Sans", sans-serif; color: var(--muted); float: right; padding-top: 12px; }

/* ---------- расписание ---------- */

.tl { display: grid; gap: 0; }
.t-row {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.t-row:last-child { border-bottom: 1px solid var(--line); }
.t-time { font-size: 14px; font-weight: 500; color: var(--sea-ink); padding-top: 2px; }
.t-label {
  display: inline-block;
  font: 500 11px/1 "IBM Plex Sans", sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.t-row.hard .t-time { color: var(--alert); }
.t-row.hard .t-label { color: var(--alert); }
.t-body p { margin: 0; }
.t-sub { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
.t-sub li { margin-bottom: 4px; }
.t-img-wrap {
  margin: 10px 0 8px;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  max-width: 440px;
  aspect-ratio: 16 / 10;
  background: var(--wash);
  border: 1px solid var(--line);
}
.t-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (max-width: 640px) {
  .t-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- точки ---------- */

.pois { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.poi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.poi figure { margin: 0; aspect-ratio: 3 / 2; overflow: hidden; background: var(--wash); }
.poi figure img { width: 100%; height: 100%; object-fit: cover; }
.poi-b { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.poi-t { display: flex; gap: 10px; align-items: flex-start; }
.num {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--sea);
  color: #fff;
  font: 600 12px/1 "IBM Plex Mono", monospace;
  margin-top: 2px;
}
.poi h3 { font-size: 17px; line-height: 1.25; color: var(--ink); margin: 0; }
.poi-subtitle { font-size: 13.5px; color: var(--sea-ink); font-style: italic; line-height: 1.35; margin-top: -2px; }
.poi-note { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.45; }
.coord { font-size: 12px; color: var(--muted); font-family: "IBM Plex Mono", monospace; }

.btn-story {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  margin-top: 4px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--sea);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-story:hover {
  background: color-mix(in srgb, var(--sea) 10%, transparent);
  border-color: var(--sea);
}
.btn-story .chevron {
  transition: transform .2s ease;
}
.btn-story.active {
  background: color-mix(in srgb, var(--sea) 15%, transparent);
  border-color: var(--sea);
}
.btn-story.active .chevron {
  transform: rotate(180deg);
}

[hidden] { display: none !important; }

.poi-story {
  display: none;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  padding: 14px 16px;
  margin-top: 6px;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn .2s ease;
}
.poi-story.open {
  display: flex;
}
.story-h4 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sea);
  margin: 6px 0 2px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 3px;
}
.story-p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
}
.story-highlights {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}
.story-highlights li {
  margin-bottom: 5px;
}
.poi-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  margin-top: 4px;
}
.poi-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--sea);
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.poi-btn-link:hover {
  border-color: var(--sea);
  background: color-mix(in srgb, var(--sea) 8%, transparent);
}
.poi-btn-link.map {
  color: var(--ink);
  background: color-mix(in srgb, var(--sea) 12%, transparent);
  border-color: color-mix(in srgb, var(--sea) 30%, transparent);
}
.pop-sub {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  margin: 2px 0 4px;
}
.pop-note {
  font-size: 12.5px;
  margin: 4px 0;
  color: var(--ink);
}
.pop-links {
  font-size: 12px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* ---------- сбои ---------- */

.fma { display: grid; gap: 12px; }
.fma-i {
  border-left: 3px solid var(--alert);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fma-i h3 { font-family: "IBM Plex Sans", sans-serif; font-weight: 600; font-size: 15px; }
.fma-i p { margin: 6px 0 0; font-size: 15px; }
.fma-i .fix { color: var(--muted); }
.fma-i .fix b { color: var(--ink); font-weight: 600; }

/* ---------- таблицы ---------- */

.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 14.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 500 11px/1.3 "IBM Plex Sans", sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); background: var(--wash); }
tbody tr:last-child td { border-bottom: 0; }
td.k { font-weight: 600; white-space: nowrap; }

/* ---------- советы ---------- */

.tips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tip.hard { background: var(--alert-wash); border-color: color-mix(in srgb, var(--alert) 35%, var(--line)); }
.chip {
  display: inline-block;
  font: 500 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  margin-bottom: 8px;
}
.tip.hard .chip { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 40%, transparent); }
.tip h3 { font-family: "IBM Plex Sans", sans-serif; font-size: 15px; font-weight: 600; }
.tip p { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); }
.tip.hard p { color: var(--ink); }

/* ---------- источники и подвал ---------- */

.src { display: grid; gap: 10px; }
.src-i { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 15px; }
.src-i h3 { font-family: "IBM Plex Sans", sans-serif; font-size: 14.5px; font-weight: 600; }
.src-i ul { margin: 7px 0 0; padding-left: 17px; font-size: 13.5px; color: var(--muted); }
.src-i li { margin-bottom: 3px; }

footer { border-top: 1px solid var(--line); margin-top: 20px; padding-block: 24px 40px; color: var(--muted); font-size: 13px; }
footer h3 { font-family: "IBM Plex Sans", sans-serif; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.credit-card {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  padding: 6px 8px;
  text-decoration: none;
  color: inherit;
}
.credit-card:hover { border-color: var(--sea); }
.credit-thumb {
  width: 54px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--wash);
}
.credit-info {
  font-size: 12px;
  line-height: 1.35;
  min-width: 0;
}
.credit-title {
  display: block;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.credit-meta {
  color: var(--muted);
  font-size: 11px;
}
.leaflet-popup-content img {
  border-radius: 4px;
  margin: 6px 0;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  width: 100%;
  display: block;
}

/* ---------- карточки дней в обзоре ---------- */
.day-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.day-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.day-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
  border-color: var(--sea);
}
.day-card figure {
  margin: 0;
  aspect-ratio: 16 / 10;
  background: var(--wash);
  overflow: hidden;
  position: relative;
}
.day-card figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.day-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .03em;
}
.day-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.day-card-body h3 {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.day-card-body p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 12px;
  flex: 1;
}
.day-card-meta {
  display: flex;
  gap: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--sea);
  font-weight: 500;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  align-items: center;
  justify-content: space-between;
}
.day-card-action {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--sea);
}

.legend { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
