/* rasht.city — city portal styles */

:root {
  --bg: #0b1a16;
  --bg-elevated: rgba(12, 28, 24, 0.72);
  --bg-panel: rgba(10, 22, 19, 0.78);
  --ink: #f2f7f4;
  --ink-soft: rgba(242, 247, 244, 0.78);
  --ink-muted: rgba(186, 210, 198, 0.72);
  --line: rgba(200, 230, 216, 0.16);
  --accent: #c9a56a;
  --accent-strong: #e8b87a;
  --accent-soft: rgba(201, 165, 106, 0.18);
  --good: #7dcb9e;
  --warn: #e0b35a;
  --danger: #e08a7a;
  --radius: 1rem;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --font: "Vazirmatn", system-ui, sans-serif;
  --display: "Instrument Serif", "Vazirmatn", Georgia, serif;
  --max: 1120px;
  --header-h: 4rem;
}

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

html {
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
}

main {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.page-bg,
.page-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}

.page-bg {
  background:
    radial-gradient(ellipse 70% 50% at 80% 10%, rgba(70, 130, 110, 0.28), transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 80%, rgba(40, 80, 65, 0.4), transparent 50%),
    linear-gradient(160deg, #12352c 0%, #0b1a16 50%, #081410 100%);
  background-size: cover;
  transition: background-image 0.8s ease;
}

.page-overlay {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 18, 15, 0.55), rgba(8, 18, 15, 0.88)),
    radial-gradient(ellipse at center, transparent 0%, rgba(8, 18, 15, 0.35) 100%);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  min-height: var(--header-h);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  backdrop-filter: blur(14px);
  background: rgba(8, 18, 15, 0.55);
  border-bottom: 1px solid var(--line);
  overflow-x: hidden;
}

.brand {
  flex: 0 0 auto;
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  min-width: 0;
  max-width: 100%;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.nav a {
  position: relative;
  padding: 0.2rem 0;
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent);
}

/* Hero */
.hero {
  position: relative;
  min-height: min(88vh, 720px);
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(160deg, #1a4a3c, #0b1a16),
    url("https://images.unsplash.com/photo-1578662996442-48f60103fc96?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center center;
  transform: scale(1.04);
  animation: drift 22s ease-in-out infinite alternate;
  transition: background-image 1s ease;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 18, 15, 0.35) 0%, rgba(8, 18, 15, 0.55) 40%, rgba(8, 18, 15, 0.92) 100%),
    linear-gradient(to inline-start, rgba(8, 18, 15, 0.55), transparent 55%);
}

.hero-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 5.5rem 0 3.5rem;
  animation: rise 0.9s ease-out both;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 600;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-line {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 0.55em;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.lede {
  margin: 0 0 1.5rem;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 18, 15, 0.45);
  color: var(--ink-muted);
  font-size: 0.9rem;
  max-width: 100%;
}

.hero-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

#local-time {
  display: inline-block;
  min-width: 8.5ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  direction: ltr;
  unicode-bidi: isolate;
  contain: layout style;
}

.square-cta {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin-top: 1.35rem;
  padding: 1rem 1.25rem 1.1rem;
  max-width: 22rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(201, 165, 106, 0.4);
  background: rgba(8, 24, 18, 0.72);
  box-shadow:
    0 0 0 1px rgba(201, 165, 106, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.35),
    0 0 28px rgba(125, 203, 158, 0.1);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.square-cta:hover,
.square-cta:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(201, 165, 106, 0.7);
  box-shadow:
    0 0 0 1px rgba(201, 165, 106, 0.15),
    0 20px 48px rgba(0, 0, 0, 0.4),
    0 0 36px rgba(125, 203, 158, 0.18);
  outline: none;
}

.square-cta-glow {
  position: absolute;
  inset: auto -20% -60% auto;
  width: 70%;
  height: 90%;
  background: radial-gradient(circle, rgba(125, 203, 158, 0.2), transparent 70%);
  pointer-events: none;
}

.square-cta-kicker {
  position: relative;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.square-cta-title {
  position: relative;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.square-cta-sub {
  position: relative;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.nav-square {
  color: #7dcb9e !important;
  font-weight: 700;
}

.nav-square:hover,
.nav-square:focus-visible {
  color: var(--accent-strong) !important;
}

/* Panels grid */
.panels {
  width: min(100% - 2rem, var(--max));
  max-width: 100%;
  margin: 0 auto 3.5rem;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  box-sizing: border-box;
  min-width: 0;
}

@media (min-width: 800px) {
  .panels {
    grid-template-columns: 1fr 1fr;
  }

  .events-panel {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1100px) {
  .panels {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
  }
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 0.9s ease-out both;
}

.weather-panel { animation-delay: 0.08s; }
.weather-panel .panel-body {
  position: relative;
  z-index: 1;
}

.weather-rain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  overflow: hidden;
  border-radius: inherit;
}

.weather-panel.is-rainy .weather-rain {
  opacity: 1;
}

.weather-rain-layer {
  position: absolute;
  inset: -20% 0 0;
  background-image:
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 14px,
      rgba(186, 220, 240, 0.14) 14px,
      rgba(186, 220, 240, 0.14) 16px
    ),
    repeating-linear-gradient(
      185deg,
      transparent 0,
      transparent 22px,
      rgba(125, 203, 158, 0.08) 22px,
      rgba(125, 203, 158, 0.08) 23px
    );
  background-size: 18px 120px, 28px 160px;
  animation: weather-rain-fall 0.9s linear infinite;
  opacity: 0.85;
}

.weather-rain-layer--soft {
  animation-duration: 1.35s;
  animation-direction: reverse;
  opacity: 0.45;
  filter: blur(0.4px);
}

@keyframes weather-rain-fall {
  from { transform: translateY(-8%); }
  to { transform: translateY(12%); }
}

.weather-ambient-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.weather-ambient-toggle {
  appearance: none;
  border: 1px solid rgba(201, 165, 106, 0.4);
  background: rgba(201, 165, 106, 0.1);
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.weather-ambient-toggle:hover,
.weather-ambient-toggle:focus-visible {
  background: rgba(201, 165, 106, 0.18);
  border-color: rgba(201, 165, 106, 0.65);
  outline: none;
}

.weather-ambient-toggle[aria-pressed="true"] {
  background: rgba(125, 203, 158, 0.16);
  border-color: rgba(125, 203, 158, 0.45);
  color: var(--good);
}

.weather-ambient-volume {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.weather-ambient-volume input[type="range"] {
  width: 7rem;
  accent-color: var(--good);
  cursor: pointer;
}

.weather-ambient-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .weather-rain-layer,
  .weather-rain-layer--soft {
    animation: none;
  }
}

.prayer-panel { animation-delay: 0.16s; }
.events-panel { animation-delay: 0.24s; }

.panel-bg {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-size: cover;
  background-position: center;
  transition: background-image 0.8s ease, opacity 0.4s ease;
  pointer-events: none;
}

.panel-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 18, 15, 0.55), rgba(8, 18, 15, 0.92));
}

.panel-body {
  position: relative;
  z-index: 1;
  padding: 1.35rem 1.35rem 1.5rem;
}

.panel-head {
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 700;
}

.panel-sub {
  margin: 0.25rem 0 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.state {
  margin: 0;
  color: var(--ink-muted);
}

.state.error {
  color: var(--danger);
}

.state.loading {
  color: var(--ink-muted);
}

/* Weather */
.weather-grid {
  display: grid;
  gap: 1rem;
}

.weather-main {
  display: flex;
  align-items: flex-end;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.temp {
  font-size: clamp(2.8rem, 8vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.temp span {
  font-size: 0.45em;
  font-weight: 600;
  color: var(--ink-muted);
  vertical-align: super;
}

.weather-desc {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.weather-place {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.weather-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat {
  padding: 0.85rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.stat-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
}

/* Prayer table */
.prayer-table-wrap {
  overflow-x: auto;
}

.prayer-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.prayer-table th,
.prayer-table td {
  padding: 0.7rem 0.35rem;
  text-align: start;
  border-bottom: 1px solid var(--line);
}

.prayer-table th {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.88rem;
}

.prayer-table td {
  font-weight: 700;
  font-size: 1.05rem;
}

.prayer-table tr:last-child th,
.prayer-table tr:last-child td {
  border-bottom: 0;
}

.prayer-note {
  margin: 0.9rem 0 0;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

/* Events */
.events-list {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 800px) {
  .events-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .events-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.event-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.event-item:hover {
  border-color: rgba(201, 165, 106, 0.4);
  transform: translateY(-2px);
}

.event-type {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.event-item h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.event-meta {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.85rem;
}

.event-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* =========================================================
   Interactive map (Leaflet + OSM)
   ========================================================= */

.map-section {
  width: min(100% - 2rem, var(--max));
  max-width: 100%;
  margin: 0 auto 3.5rem;
  animation: rise 0.9s ease-out 0.3s both;
  box-sizing: border-box;
  min-width: 0;
  overflow-x: hidden;
}

.history-section {
  width: 100%;
  max-width: 100%;
  margin: 0 0 2rem;
  min-width: 0;
}

.maf-teaser-section {
  width: min(100% - 2rem, var(--max));
  max-width: 100%;
  margin: 0 auto 1.75rem;
  animation: rise 0.9s ease-out 0.18s both;
  box-sizing: border-box;
  min-width: 0;
}

.news-section {
  width: min(100% - 2rem, var(--max));
  max-width: 100%;
  margin: 0 auto 1.75rem;
  animation: rise 0.9s ease-out 0.2s both;
  box-sizing: border-box;
  min-width: 0;
}

.news-panel {
  overflow: hidden;
}

.news-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.65rem 1rem;
}

.news-updated {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.news-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.25rem;
}

@media (min-width: 800px) {
  .news-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.news-card {
  appearance: none;
  width: 100%;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.news-card:hover,
.news-card:focus-visible {
  border-color: rgba(201, 165, 106, 0.45);
  background: rgba(201, 165, 106, 0.06);
  transform: translateY(-2px);
  outline: none;
}

.news-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
}

.news-card-source {
  display: inline-flex;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
}

.news-card-time {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.news-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}

.news-card-excerpt {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.news-popup[hidden] {
  display: none !important;
}

.news-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 10, 0.72);
  backdrop-filter: blur(4px);
}

.news-popup-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
  max-height: min(82vh, 36rem);
  overflow: auto;
  padding: 1.25rem 1.2rem 1.35rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, rgba(125, 203, 158, 0.08), transparent 42%),
    rgba(10, 22, 19, 0.96);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.news-popup-close {
  appearance: none;
  position: absolute;
  left: 0.75rem;
  right: auto;
  top: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.news-popup-close:hover,
.news-popup-close:focus-visible {
  border-color: rgba(201, 165, 106, 0.55);
  background: rgba(201, 165, 106, 0.12);
  outline: none;
}

.news-popup-meta {
  margin: 0 0 0.55rem;
  padding-left: 2.4rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.news-popup-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--accent-strong);
}

.news-popup-body {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.85;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.news-popup-source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(201, 165, 106, 0.45);
  background: rgba(201, 165, 106, 0.12);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.news-popup-source:hover,
.news-popup-source:focus-visible {
  background: rgba(201, 165, 106, 0.2);
  outline: none;
}

.maf-teaser-card {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  border-radius: calc(var(--radius) - 0.15rem);
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(8, 18, 15, 0.35);
  transition: border-color 0.2s ease;
}

.maf-teaser-card:hover {
  border-color: rgba(201, 165, 106, 0.45);
}

.maf-teaser-photo {
  display: block;
  width: 100%;
  min-height: 8.5rem;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: #10241e;
  border: 0;
}

.maf-teaser-photo.is-empty {
  background: linear-gradient(160deg, rgba(125, 203, 158, 0.12), transparent 55%), #10241e;
}

.maf-teaser-body {
  padding: 0.9rem 0.95rem 1rem 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

.maf-teaser-chip {
  align-self: flex-start;
  padding: 0.15rem 0.45rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(201, 165, 106, 0.35);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
}

.maf-teaser-body h3 {
  margin: 0;
  font-size: 1.15rem;
}

.maf-teaser-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.maf-teaser-meta {
  color: var(--ink-muted) !important;
  font-size: 0.8rem !important;
}

@media (max-width: 560px) {
  .maf-teaser-card {
    grid-template-columns: 1fr;
  }

  .maf-teaser-photo {
    min-height: 10rem;
  }

  .maf-teaser-body {
    padding: 0 0.95rem 1rem;
  }
}

.map-panel {
  overflow: hidden;
  max-width: 100%;
}

.map-panel-body {
  padding-bottom: 1.25rem;
}

.map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.map-head-text {
  min-width: min(100%, 14rem);
}

.map-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.map-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.map-chip-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--chip-accent, var(--accent));
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.map-chip:hover,
.map-chip:focus-visible {
  border-color: color-mix(in srgb, var(--chip-accent, var(--accent)) 55%, transparent);
  color: var(--ink);
  outline: none;
}

.map-chip.is-primary {
  border-color: rgba(201, 165, 106, 0.35);
}

.map-chip.is-active {
  background: color-mix(in srgb, var(--chip-accent, var(--accent)) 18%, transparent);
  border-color: color-mix(in srgb, var(--chip-accent, var(--accent)) 70%, transparent);
  color: var(--ink);
  transform: translateY(-1px);
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.15rem 0 0.75rem;
  min-height: 0;
}

.map-route-status {
  flex: 1 1 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.7rem;
  background: rgba(8, 18, 15, 0.55);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.map-route-status[hidden] {
  display: none !important;
}

.map-route-status strong {
  color: var(--accent);
  font-weight: 700;
}

.map-route-from {
  color: var(--ink-muted);
  font-size: 0.8rem;
}

.map-route-clear {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.8rem;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.map-route-clear:hover,
.map-route-clear:focus-visible {
  border-color: rgba(201, 165, 106, 0.55);
  color: var(--accent);
  outline: none;
}

.map-route-clear[hidden] {
  display: none !important;
}

.map-frame {
  position: relative;
  margin-top: 0.25rem;
  border-radius: calc(var(--radius) - 0.15rem);
  overflow: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #10241e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.map-glow {
  position: absolute;
  inset: auto 10% -30% auto;
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 165, 106, 0.18), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.map-canvas {
  position: relative;
  width: 100%;
  height: clamp(320px, 58vh, 520px);
  min-height: 320px;
  z-index: 1;
  background: #10241e;
  border-radius: calc(var(--radius) - 0.15rem);
  /* Do NOT use CSS filter here — it clips Leaflet popups on mobile */
  overflow: hidden;
}

.map-status {
  position: absolute;
  inset-inline: 1rem;
  bottom: 1rem;
  z-index: 500;
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  background: rgba(8, 18, 15, 0.82);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.map-status[hidden] {
  display: none !important;
}

.map-note {
  margin: 0.85rem 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.map-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Custom markers */
.rasht-marker {
  background: transparent;
  border: 0;
}

.rasht-marker-pin {
  position: absolute;
  inset-inline-start: 50%;
  bottom: 0;
  width: 16px;
  height: 16px;
  margin-inline-start: -8px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--marker-color, var(--accent)) 85%, white),
    var(--marker-color, var(--accent))
  );
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.75);
}

.rasht-marker.is-primary .rasht-marker-pin {
  width: 18px;
  height: 18px;
  margin-inline-start: -9px;
}

.rasht-marker-pulse {
  position: absolute;
  inset-inline-start: 50%;
  bottom: 2px;
  width: 22px;
  height: 22px;
  margin-inline-start: -11px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--marker-color, var(--accent)) 40%, transparent);
  animation: map-pulse 2.2s ease-out infinite;
}

@keyframes map-pulse {
  0% { transform: scale(0.7); opacity: 0.7; }
  70% { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* Popup (RTL) */
.rasht-popup-wrap .leaflet-popup-content-wrapper {
  background: rgba(12, 28, 24, 0.96);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.rasht-popup-wrap .leaflet-popup-tip {
  background: rgba(12, 28, 24, 0.96);
  border: 1px solid var(--line);
}

.rasht-popup-wrap .leaflet-popup-content {
  margin: 0.85rem 1rem;
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.65;
  text-align: right;
  direction: rtl;
}

.rasht-popup {
  direction: rtl;
  text-align: right;
}

.rasht-popup-cat {
  display: inline-block;
  margin-bottom: 0.4rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--marker-color, var(--accent)) 90%, white);
  background: color-mix(in srgb, var(--marker-color, var(--accent)) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--marker-color, var(--accent)) 45%, transparent);
}

.rasht-popup-title,
.rasht-popup strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-size: 1.05rem;
  text-align: right;
}

.rasht-popup-address {
  margin: 0 0 0.45rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.7;
  text-align: right;
}

.rasht-popup-blurb {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.rasht-popup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
}

.rasht-popup-route {
  appearance: none;
  border: 1px solid rgba(125, 203, 158, 0.55);
  background: rgba(125, 203, 158, 0.14);
  color: #9ed4b4;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.4rem 0.75rem;
  border-radius: 0.55rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.rasht-popup-route:hover,
.rasht-popup-route:focus-visible {
  background: rgba(125, 203, 158, 0.24);
  border-color: rgba(125, 203, 158, 0.8);
  color: #c5ebd4;
  outline: none;
}

.rasht-popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 165, 106, 0.45);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.rasht-popup-link:hover,
.rasht-popup-link:focus-visible {
  color: var(--accent-strong, #e8b87a);
  border-bottom-color: rgba(232, 184, 122, 0.8);
  outline: none;
}

.rasht-popup-wrap a.leaflet-popup-close-button {
  color: var(--ink-muted);
  inset-inline-end: 4px;
  inset-inline-start: auto;
}

.rasht-route-line {
  filter: drop-shadow(0 0 4px rgba(125, 203, 158, 0.45));
}

/* Leaflet chrome tuned to site */
.map-canvas .leaflet-control-zoom a {
  background: rgba(12, 28, 24, 0.9);
  color: var(--ink);
  border-color: var(--line);
  width: 32px;
  height: 32px;
  line-height: 32px;
}

.map-canvas .leaflet-control-zoom a:hover {
  background: rgba(20, 40, 34, 0.95);
  color: var(--accent);
}

.map-canvas .leaflet-control-attribution {
  background: rgba(8, 18, 15, 0.78);
  color: var(--ink-muted);
  font-size: 10px;
  max-width: min(100%, 18rem);
  padding: 2px 6px;
  border-start-start-radius: 0.35rem;
}

.map-canvas .leaflet-control-attribution a {
  color: var(--accent);
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    gap: 0.5rem 0.75rem;
    padding-inline: 0.85rem;
  }

  .nav {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 0.3rem 0.65rem;
    font-size: 0.8rem;
  }

  /* Keep hero photo locked to viewport center — drift looks off-center on phones */
  .hero-bg {
    animation: none;
    transform: scale(1.08);
    background-position: center center;
  }

  .hero-meta {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 1rem;
    text-align: center;
  }

  .map-chips {
    width: 100%;
    justify-content: flex-start;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .map-route-clear {
    width: 100%;
  }

  .map-panel,
  .map-frame,
  .map-canvas {
    max-width: 100%;
  }

  .map-canvas {
    height: 420px;
    min-height: 380px;
    /* keep clipped — Leaflet autoPan handles popup visibility */
    overflow: hidden;
  }

  .map-frame {
    overflow: hidden;
  }

  .rasht-popup-wrap .leaflet-popup-content-wrapper {
    max-width: min(88vw, 260px);
  }

  .rasht-popup-wrap .leaflet-popup-content {
    margin: 0.7rem 0.85rem;
    font-size: 0.86rem;
  }

  .rasht-popup-address {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rasht-marker-pulse {
    animation: none;
  }
}

/* Footer */
.site-footer {
  width: min(100% - 2rem, var(--max));
  max-width: 100%;
  margin: 0 auto;
  padding: 0 0 2.5rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  text-align: center;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.site-footer strong {
  color: var(--ink-soft);
  font-weight: 600;
}

.footer-owner {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.footer-owner a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.footer-owner a:hover,
.footer-owner a:focus-visible {
  border-bottom-color: currentColor;
}

.credit {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  opacity: 0.85;
}

.credit a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@keyframes drift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.2%, 1%, 0); }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-bg,
  .hero-inner,
  .panel {
    animation: none;
  }
}
