/* Прогулки по Таллину — общий стиль сайта */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --stone: #f2ede4;
  --stone-2: #e7dfd2;
  --line: #ddd3c4;
  --ink: #1d2830;
  --ink-soft: #46535d;
  --sea: #1d5c86;
  --sea-deep: #143f5d;
  --sea-pale: #e4eef5;
  --brick: #a63f2b;
  --brick-deep: #8a3221;
  --brick-pale: #f7e6df;
  --moss: #4d6b43;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(29, 40, 48, .06), 0 8px 24px rgba(29, 40, 48, .07);
  --font-body: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: Georgia, Cambria, "Times New Roman", Times, serif;
  --wrap: 70rem;
  --measure: 42rem;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 .6em;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  letter-spacing: -.01em;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 1.95rem);
}

h3 {
  font-size: 1.25rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1em;
}

a {
  color: var(--sea);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

a:hover {
  color: var(--brick-deep);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--brick);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: .6rem 1rem;
  background: var(--sea-deep);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
  color: #fff;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding-inline: 1.5rem;
  }
}

/* ---------- Шапка ---------- */

.site-header {
  background: var(--surface);
}

.site-header::after {
  content: "";
  display: block;
  height: 12px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='12' viewBox='0 0 36 12'%3E%3Cpath d='M0 12 9 3l9 9z' fill='%23a63f2b'/%3E%3Cpath d='M18 12l9-7 9 7z' fill='%23c4664c'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: left bottom;
  border-bottom: 3px solid var(--sea);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 2rem;
  padding-block: .9rem .7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.3rem;
}

.brand-tag {
  font-size: .82rem;
  color: var(--ink-soft);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .15rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: .35rem 0 .25rem;
  color: var(--ink);
  font-size: .97rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--sea);
  border-bottom-color: var(--sea);
}

.site-nav a[aria-current] {
  color: var(--brick-deep);
  border-bottom-color: var(--brick);
}

/* ---------- Общие блоки ---------- */

main {
  display: block;
}

main:focus {
  outline: none;
}

.section {
  padding-block: 2.75rem;
}

.section--stone {
  background: var(--stone);
}

.section--sea {
  background: var(--sea-pale);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  margin-bottom: 1.4rem;
}

.section-head h2 {
  margin: 0;
}

.kicker {
  display: block;
  margin-bottom: .45rem;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brick-deep);
}

.lead {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.more-link {
  font-weight: 600;
  white-space: nowrap;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  padding: .7rem 1.2rem;
  border-radius: 999px;
  border: 2px solid var(--sea);
  background: var(--sea);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}

.btn:hover {
  background: var(--sea-deep);
  border-color: var(--sea-deep);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--sea);
}

.btn--ghost:hover {
  background: var(--sea-pale);
  color: var(--sea-deep);
}

/* ---------- Первый экран главной ---------- */

.hero {
  background: linear-gradient(180deg, var(--sea-pale) 0%, var(--bg) 100%);
  padding-block: 2.5rem 3rem;
}

.hero-grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.hero-figure {
  margin: 0;
}

.hero-figure img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--sea-pale);
}

@media (min-width: 54rem) {
  .hero-grid {
    grid-template-columns: 1fr 1.1fr;
    gap: 3rem;
  }
}

.signature {
  font-family: var(--font-head);
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Карточки прогулок ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}

.card:hover {
  border-color: var(--sea);
}

.card:focus-within {
  border-color: var(--sea);
}

.card img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  background: var(--sea-pale);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: .5rem;
  padding: 1rem 1.1rem 1.15rem;
}

.card h3 {
  margin: 0;
  font-size: 1.3rem;
}

.card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card h3 a:hover {
  color: var(--sea);
}

.card h3 a:focus-visible {
  outline: none;
}

.card:has(h3 a:focus-visible) {
  outline: 3px solid var(--brick);
  outline-offset: 3px;
}

.card-date {
  font-size: .88rem;
  color: var(--ink-soft);
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: .98rem;
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: none;
  }
}

/* «время / сложность / лучшее время года» */

.facts {
  display: grid;
  gap: .4rem;
  margin: auto 0 0;
  padding-top: .8rem;
  border-top: 1px dashed var(--line);
}

.facts div {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr);
  gap: .6rem;
  align-items: baseline;
}

.facts dt {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--brick-deep);
}

.facts dd {
  margin: 0;
  font-size: .93rem;
  line-height: 1.35;
}

.facts--panel {
  gap: .9rem 1.5rem;
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--sea-pale);
}

.facts--panel dd {
  font-size: 1.02rem;
  font-weight: 600;
}

.facts--panel .fact-note {
  display: block;
  margin-top: .2rem;
  font-size: .86rem;
  font-weight: 400;
  color: var(--ink-soft);
}

@media (min-width: 40rem) {
  .facts--panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .facts--panel div {
    display: block;
  }

  .facts--panel dt {
    margin-bottom: .25rem;
  }
}

/* ---------- Статьи ---------- */

.page-head {
  padding-block: 2rem .5rem;
}

.page-head .lead {
  margin-bottom: 0;
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font-size: .9rem;
  color: var(--ink-soft);
}

.crumbs li + li::before {
  content: "/";
  margin-right: .25rem;
  color: var(--line);
}

.crumbs a {
  color: var(--ink-soft);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1rem;
  font-size: .93rem;
  color: var(--ink-soft);
}

.article {
  max-width: var(--measure);
  margin-inline: auto;
}

.article-figure {
  margin: 1.5rem 0 2rem;
}

.article-figure img {
  width: 100%;
  border-radius: var(--radius);
  background: var(--sea-pale);
}

figcaption {
  margin-top: .5rem;
  font-size: .88rem;
  color: var(--ink-soft);
}

.prose {
  padding-bottom: 1rem;
}

.prose h2 {
  margin-top: 2.2rem;
}

.prose h3 {
  margin-top: 1.6rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: .4rem;
}

.route {
  counter-reset: stop;
  list-style: none;
  padding: 0 !important;
  margin: 1.2rem 0 1.6rem;
}

.route li {
  counter-increment: stop;
  position: relative;
  padding: 0 0 .9rem 2.8rem;
  margin: 0;
}

.route li::before {
  content: counter(stop);
  position: absolute;
  left: 0;
  top: .05rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--brick);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
}

.route li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: .9rem;
  top: 2.1rem;
  bottom: .1rem;
  border-left: 2px dotted var(--brick);
  opacity: .5;
}

.note {
  margin: 1.6rem 0;
  padding: 1rem 1.2rem;
  border-left: 4px solid var(--sea);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.note p:last-child {
  margin-bottom: 0;
}

.note-title {
  display: block;
  margin-bottom: .3rem;
  font-weight: 700;
  color: var(--sea-deep);
}

.note--brick {
  border-left-color: var(--brick);
  background: var(--brick-pale);
  box-shadow: none;
}

.note--brick .note-title {
  color: var(--brick-deep);
}

.check-note {
  font-size: .95rem;
  color: var(--ink-soft);
  font-style: italic;
}

.pager {
  display: grid;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .pager {
    grid-template-columns: 1fr 1fr;
  }
}

.pager a {
  display: block;
  height: 100%;
  padding: .9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}

.pager a:hover {
  border-color: var(--sea);
  color: var(--sea-deep);
}

.pager small {
  display: block;
  font-size: .8rem;
  color: var(--ink-soft);
}

.pager .next {
  text-align: right;
}

/* ---------- Карта ---------- */

.map-figure {
  margin: 0;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-figure img {
  width: 100%;
  border-radius: var(--radius-sm);
}

.map-figure figcaption {
  padding: .25rem .25rem 0;
}

.map-grid {
  display: grid;
  gap: 1.75rem;
  align-items: start;
}

@media (min-width: 58rem) {
  .map-grid {
    grid-template-columns: 1.7fr 1fr;
  }
}

.districts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .75rem;
}

.districts li {
  padding: .7rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--dot, var(--sea));
}

.districts strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.08rem;
}

.districts span {
  font-size: .93rem;
  color: var(--ink-soft);
}

.d-old { --dot: #b5452f; }
.d-toom { --dot: #8a7a5c; }
.d-kala { --dot: #c89a3c; }
.d-tell { --dot: #7f8fa0; }
.d-kadr { --dot: #5d8a52; }
.d-pir { --dot: #2f7aa8; }

/* ---------- Плитки «полезное» и сезоны ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tile {
  position: relative;
  padding: 1.1rem 1.2rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent, var(--sea));
}

.tile h3 {
  margin-bottom: .35rem;
  font-size: 1.2rem;
}

.tile h3 a {
  color: var(--ink);
  text-decoration: none;
}

.tile h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.tile:hover {
  border-color: var(--sea);
  border-top-color: var(--accent, var(--sea));
}

.tile p {
  margin: 0;
  font-size: .96rem;
  color: var(--ink-soft);
}

.tile--brick { --accent: var(--brick); }
.tile--moss { --accent: var(--moss); }
.tile--deep { --accent: var(--sea-deep); }

.season-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
  list-style: none;
  margin: 1.2rem 0 2rem;
  padding: 0;
}

.season-grid li {
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent, var(--sea));
  font-size: .95rem;
}

.season-grid strong {
  display: block;
  font-family: var(--font-head);
  font-size: 1.1rem;
  margin-bottom: .2rem;
}

.s-summer { --accent: #2f7aa8; }
.s-autumn { --accent: var(--brick); }
.s-winter { --accent: var(--sea-deep); }
.s-spring { --accent: var(--moss); }

.districts a {
  color: var(--ink);
}

.districts a:hover {
  color: var(--sea);
}

.pick-list {
  max-width: var(--measure);
}

/* ---------- Словарик ---------- */

.glossary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem 1.2rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--stone);
}

.glossary dt {
  font-weight: 700;
  color: var(--sea-deep);
}

.glossary dd {
  margin: 0;
}

.et {
  font-style: italic;
  color: var(--sea-deep);
}

/* ---------- 404 ---------- */

.notfound {
  padding-block: 3rem 4rem;
  text-align: center;
}

.notfound img {
  width: min(100%, 26rem);
  margin: 0 auto 1.5rem;
  border-radius: var(--radius);
}

.notfound .lead {
  margin-inline: auto;
}

.notfound .btn-row {
  justify-content: center;
}

/* ---------- Подвал ---------- */

.site-footer {
  margin-top: 3rem;
  background: var(--stone);
  color: var(--ink);
  font-size: .95rem;
}

.site-footer::before {
  content: "";
  display: block;
  height: 14px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='14' viewBox='0 0 40 14'%3E%3Cpath d='M0 8c5 0 5-6 10-6s5 6 10 6 5-6 10-6 5 6 10 6v6H0z' fill='%23f2ede4'/%3E%3Cpath d='M0 8c5 0 5-6 10-6s5 6 10 6 5-6 10-6 5 6 10 6' fill='none' stroke='%231d5c86' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: left bottom;
}

.footer-inner {
  display: grid;
  gap: 1.5rem;
  padding-block: 2rem 1.25rem;
}

@media (min-width: 48rem) {
  .footer-inner {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.footer-brand {
  margin-bottom: .35rem;
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
}

.footer-inner p {
  margin-bottom: .5rem;
  color: var(--ink-soft);
}

.footer-inner ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-inner li {
  margin-bottom: .3rem;
}

.footer-inner a {
  color: var(--sea-deep);
}

.footer-heading {
  margin-bottom: .4rem;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brick-deep);
}

.footer-bottom {
  padding-block: 1rem 1.5rem;
  border-top: 1px solid var(--stone-2);
  color: var(--ink-soft);
  font-size: .9rem;
}

.footer-bottom p {
  margin: 0;
}

/* ---------- Печать ---------- */

@media print {
  .site-nav,
  .skip-link,
  .pager,
  .site-header::after,
  .site-footer::before {
    display: none;
  }

  body {
    background: #fff;
  }

  .card,
  .note {
    box-shadow: none;
  }
}
