:root {
  color-scheme: light;
  --ink: #1d2a2f;
  --muted: #5d6b71;
  --line: #d9e2df;
  --paper: #fbf8f1;
  --white: #ffffff;
  --green: #246b4f;
  --green-dark: #174837;
  --blue: #2b6780;
  --clay: #b95f3b;
  --gold: #c79b3c;
  --shadow: 0 18px 45px rgba(25, 43, 48, .12);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

main, section { scroll-margin-top: 88px; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(251, 248, 241, .94);
  border-bottom: 1px solid rgba(29, 42, 47, .08);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong { display: block; line-height: 1.05; }
.brand small { display: block; color: var(--muted); font-size: .78rem; }

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
}

.language-switcher button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.16rem;
  line-height: 1;
}

.language-switcher button.active {
  background: var(--green);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .8);
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.nav a:hover { color: var(--green-dark); background: rgba(36, 107, 79, .08); }

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: calc(100svh - 72px);
  display: grid;
  align-items: end;
  isolation: isolate;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(14, 33, 31, .82) 0%, rgba(14, 33, 31, .55) 46%, rgba(14, 33, 31, .22) 100%),
    url("DSC_0458_2.JPG") center 54%/cover;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 28%;
  z-index: -1;
  background: linear-gradient(0deg, var(--paper), rgba(251, 248, 241, 0));
}

.hero-content {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto 12vh clamp(16px, 6vw, 72px);
  color: var(--white);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--clay);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

.hero .eyebrow { color: #f7c56f; }

h1, h2, h3 { line-height: 1.08; margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.4rem, 7vw, 5.8rem); max-width: 820px; }
h2 { font-size: clamp(2rem, 4.6vw, 3.5rem); }
h3 { font-size: 1.18rem; }

.lead {
  max-width: 700px;
  margin: 22px 0 0;
  font-size: clamp(1.02rem, 2.1vw, 1.28rem);
  color: rgba(255, 255, 255, .9);
}

.search-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: min(680px, 100%);
  margin-top: 26px;
  padding: 8px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 13px 14px;
  background: transparent;
  color: var(--ink);
}

.search-box button, .button, .filters button, .quick-links button {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}

.search-box button, .button.primary {
  background: var(--green);
  color: var(--white);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button.ghost {
  background: rgba(255, 255, 255, .16);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, .35);
}

.quick-links {
  display: flex;
  gap: 10px;
  max-width: 1180px;
  margin: -34px auto 0;
  padding: 0 16px;
  overflow-x: auto;
  position: relative;
  z-index: 3;
}

.quick-links button {
  flex: 0 0 auto;
  background: var(--white);
  color: var(--green-dark);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(29, 42, 47, .08);
}

.section {
  padding: clamp(58px, 8vw, 104px) clamp(16px, 4vw, 48px);
}

.section-heading {
  max-width: 850px;
  margin: 0 auto 30px;
}

.section-heading p:not(.eyebrow) { color: var(--muted); font-size: 1.04rem; }
.section-heading.split {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
}

.band { background: #eef3ee; }

.info-grid, .guide-grid, .council-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-grid article, .guide-card, .council-card, .map-info, .compare-table, .checklist, .source-list {
  background: var(--white);
  border: 1px solid rgba(29, 42, 47, .09);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(29, 42, 47, .06);
}

.info-grid article, .guide-card, .council-card { padding: 20px; }
.info-grid p, .guide-card p, .council-card p { color: var(--muted); margin-bottom: 0; }

.icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(36, 107, 79, .1);
  color: var(--green);
  font-weight: 900;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters button {
  background: var(--white);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 10px 12px;
}

.filters button.active {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.council-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(43, 103, 128, .1);
  color: var(--blue);
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  min-width: 0;
  padding: 10px;
  background: #f7f5ee;
  border-radius: var(--radius);
}

.stat strong { display: block; font-size: .98rem; }
.stat span { color: var(--muted); font-size: .76rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: .78rem;
  background: #fbfaf6;
}

.open-detail {
  margin-top: auto;
  border: 1px solid var(--green);
  color: var(--green-dark);
  background: transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-weight: 850;
  cursor: pointer;
}

.compare-controls {
  max-width: 1180px;
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.compare-controls select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--white);
}

.compare-table {
  max-width: 1180px;
  margin: 0 auto;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th { background: #f7f5ee; }

.guide-card {
  min-height: 230px;
  display: flex;
  flex-direction: column;
}

.guide-card a {
  margin-top: auto;
  color: var(--green-dark);
  font-weight: 850;
  text-decoration: none;
}

.map-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 18px;
  align-items: stretch;
}

.asturias-map {
  position: relative;
  z-index: 0;
  min-height: 460px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #dbe7dd;
  box-shadow: var(--shadow);
}

.asturias-map .leaflet-control-attribution { font-size: .68rem; }
.asturias-map .leaflet-popup-content-wrapper { border-radius: var(--radius); }
.asturias-map .leaflet-popup-content { margin: 12px 14px; color: var(--ink); }
.asturias-map .leaflet-popup-content strong { display: block; margin-bottom: 4px; }

.capital-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--green-dark);
  color: var(--white);
  font-size: .82rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(23, 72, 55, .32);
}

.map-legend {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.map-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .9rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 12px;
}

.map-info { padding: 22px; }
.map-info p, .map-info li { color: var(--muted); }

.checklist {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 24px 46px;
}

.checklist li { margin: 0 0 14px; }
.checklist li:last-child { margin-bottom: 0; }

.source-list {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  gap: 0;
  overflow: hidden;
}

.source-list a {
  padding: 15px 18px;
  text-decoration: none;
  color: var(--green-dark);
  font-weight: 780;
  border-bottom: 1px solid var(--line);
}

.source-list a:last-child { border-bottom: 0; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 32px clamp(16px, 4vw, 48px);
  background: var(--green-dark);
  color: var(--white);
}

.footer p { margin: 4px 0 0; color: rgba(255,255,255,.76); }
.footer a { color: var(--white); font-weight: 800; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 18, 19, .58);
}

.modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: min(760px, calc(100svh - 36px));
  overflow: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 32px);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.detail-block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfaf6;
}

.detail-block ul { padding-left: 20px; margin-bottom: 0; color: var(--muted); }

@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .language-switcher { margin-left: auto; }
  .nav {
    position: absolute;
    top: 72px;
    left: 16px;
    right: 16px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }
  .nav.open { display: flex; }
  .nav a { border-radius: var(--radius); }
  .hero-content { margin-left: auto; margin-right: auto; }
  .section-heading.split, .map-layout { grid-template-columns: 1fr; }
  .filters { justify-content: flex-start; }
  .info-grid, .guide-grid, .council-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header { min-height: 66px; }
  .brand small { display: none; }
  .site-header { gap: 8px; }
  .language-switcher { padding: 3px; }
  .language-switcher button { width: 31px; height: 31px; font-size: 1rem; }
  .menu-toggle { padding: 8px 10px; }
  .nav { top: 66px; }
  .hero { min-height: 720px; }
  .hero-content { width: calc(100% - 28px); margin-bottom: 96px; }
  .search-box { grid-template-columns: 1fr; }
  .hero-actions .button { width: 100%; }
  .quick-links { margin-top: -26px; }
  .section { padding-left: 14px; padding-right: 14px; }
  .info-grid, .guide-grid, .council-grid, .compare-controls, .detail-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .asturias-map { min-height: 380px; }
  .footer { display: block; }
  .footer a { display: inline-block; margin-top: 16px; }
}
