/* Jewish India Digital Heritage Trail — peacock-themed redesign */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Cormorant+SC:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Peacock palette */
  --peacock-deep:   #0F4C5C;   /* deep teal — primary */
  --peacock:        #1E5F74;   /* mid teal */
  --peacock-light:  #2C7A8F;
  --gold:           #D4A537;   /* peacock-eye gold */
  --gold-soft:      #E6C677;
  --terracotta:     #BC4639;   /* warm accent */
  --cream:          #F8F2E2;   /* page background */
  --cream-warm:     #F2E9D0;
  --paper:          #FFFEF8;   /* card surface */
  --ink:            #1A2B33;
  --ink-soft:       #4A5A66;
  --muted:          #7B8A92;
  --line:           #E2D6B5;
  --line-soft:      #EFE7CD;

  /* Header palette (so dark mode can swap them) */
  --header-bg-1:    #0F4C5C;
  --header-bg-2:    #1E5F74;
  --header-text:    #ffffff;
  --header-search-bg:        rgba(248,242,226,0.95);
  --header-search-text:      #1A2B33;
  --header-search-border:    rgba(212,165,55,0.55);
  --header-search-placeholder: #7B8A92;

  /* Community colors */
  --bene:      #1E5F74;
  --baghdadi:  #B8862F;
  --cochini:   #5A8A4E;
  --kerala:    #2F6244;
  --diaspora:  #B0584A;
  --emerging:  #6E4F7A;
  --civic:     #768591;

  --maxw: 1200px;
  --radius: 8px;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --sans:  'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --nav:   'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
}

/* ============ Dark mode ============ */
html[data-theme="dark"] {
  --peacock-deep:   #0A2F39;
  --peacock:        #154655;
  --peacock-light:  #2C7A8F;
  --gold:           #E6C677;
  --gold-soft:      #B8862F;
  --terracotta:     #D67064;
  --cream:          #0E1B22;
  --cream-warm:     #142730;
  --paper:          #18303A;
  --ink:            #E9E4D2;
  --ink-soft:       #C2BCA8;
  --muted:          #8A9098;
  --line:           #2A4451;
  --line-soft:      #1F3742;

  --header-bg-1:    #07242D;
  --header-bg-2:    #0F3B48;
  --header-text:    #F0E7CE;
  --header-search-bg:        rgba(15,40,50,0.85);
  --header-search-text:      #F0E7CE;
  --header-search-border:    rgba(230,198,119,0.40);
  --header-search-placeholder: #8A9098;
}
html[data-theme="dark"] body { background: var(--cream); color: var(--ink); }
html[data-theme="dark"] .leaflet-container { background: #142730; }
html[data-theme="dark"] .leaflet-tile { filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.95); }
html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
html[data-theme="dark"] .leaflet-popup-content strong a { color: var(--gold); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--peacock); text-decoration: none; transition: color .15s; }
a:hover { color: var(--terracotta); }
img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--peacock-deep);
  letter-spacing: 0.2px;
  line-height: 1.2;
}
h1 { font-size: 2.6rem; }
h2 { font-size: 2rem; margin: 0 0 1rem; }
h3 { font-size: 1.4rem; margin: 0 0 .5rem; }

/* ============ Header ============ */
.site-header {
  background: linear-gradient(180deg, var(--header-bg-1) 0%, var(--header-bg-2) 100%);
  color: var(--header-text);
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.site-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: #fff; text-decoration: none;
}
.brand:hover { color: #fff; }
.brand-mark {
  width: 38px; height: 44px;
  color: var(--gold-soft);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-text {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #fff;
  line-height: 1.1;
}
.brand-text small {
  display: block;
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--gold-soft);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 3px;
}

/* "BETA" pill next to the brand */
.brand-beta {
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  padding: 2px 8px;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--peacock-deep);
  background: var(--gold-soft);
  border-radius: 999px;
  text-transform: uppercase;
  cursor: help;
  vertical-align: 0.2em;
}

/* Header utility cluster (theme toggle, mobile menu trigger) */
.site-header-utils {
  display: flex; align-items: center; gap: 6px;
  margin-left: auto;
}
.icon-btn {
  background: transparent;
  border: 1px solid rgba(230,198,119,0.35);
  color: var(--gold-soft);
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  padding: 0;
}
.icon-btn:hover {
  background: rgba(230,198,119,0.14);
  color: var(--gold);
  border-color: var(--gold);
}
.icon-btn svg { display: block; }
.menu-btn { display: none; }   /* shown only on small screens */

.site-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  font-family: var(--nav);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 1.4px;
}
.site-nav a {
  color: var(--header-text);
  padding: 8px 14px;
  border-radius: 4px;
  position: relative;
  transition: color .15s;
}
.site-nav a::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 4px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}
.site-nav a:hover { color: var(--gold-soft); }
.site-nav a:hover::after { transform: scaleX(1); }
.site-nav a.active {
  color: var(--gold);
  font-weight: 600;
}
.site-nav a.active::after { transform: scaleX(1); background: var(--gold); }

/* ============ Hero ============ */
.hero {
  position: relative;
  background:
    radial-gradient(ellipse at top, rgba(212,165,55,0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--cream-warm) 0%, var(--cream) 100%);
  padding: 80px 28px 64px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero::before, .hero::after {
  content: ''; position: absolute; top: 30px; width: 110px; height: 130px; opacity: 0.10;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 140'><g fill='none' stroke='%230F4C5C' stroke-width='2'><circle cx='60' cy='60' r='40'/></g></svg>");
}
.hero-peacock {
  width: 88px; height: 100px;
  margin: 0 auto 18px;
  color: var(--peacock-deep);
}
.hero-peacock svg { width: 100%; height: 100%; }
.hero h1 {
  font-size: 3.4rem;
  margin: 0 0 14px;
  color: var(--peacock-deep);
  font-weight: 600;
}
.hero .subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink-soft);
  max-width: 720px;
  margin: 0 auto 8px;
  line-height: 1.55;
}
.hero p.lede {
  font-size: 1.05rem;
  max-width: 680px;
  margin: 16px auto 0;
  color: var(--ink-soft);
}
.hero .cta { margin-top: 32px; display: inline-flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.divider {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 18px auto;
  color: var(--gold);
}
.divider::before, .divider::after {
  content: ''; flex: 0 0 60px; height: 1px; background: var(--gold);
}
.divider span { font-size: 14px; }

.btn {
  display: inline-block;
  background: var(--peacock-deep);
  color: #fff;
  padding: 13px 26px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border: 2px solid var(--peacock-deep);
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { background: var(--peacock-light); border-color: var(--peacock-light); color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--peacock-deep); }
.btn.gold:hover { background: var(--gold-soft); border-color: var(--gold-soft); color: var(--peacock-deep); }
.btn.secondary { background: transparent; color: var(--peacock-deep); }
.btn.secondary:hover { background: var(--peacock-deep); color: #fff; }

/* ============ Sections ============ */
section.section { padding: 64px 28px; }
section.section + section.section { padding-top: 0; }
section.section .section-inner { max-width: var(--maxw); margin: 0 auto; }
.section-title {
  text-align: center;
  margin-bottom: 36px;
}
.section-title h2 {
  font-size: 2.2rem;
  margin: 0 0 8px;
}
.section-title p {
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  margin: 0;
}

/* ============ Card grid ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover {
  box-shadow: 0 10px 28px rgba(15,76,92,0.12);
  transform: translateY(-3px);
  border-color: var(--gold-soft);
}
.card a { color: inherit; display: block; }
.card .thumb {
  background: var(--cream-warm);
  aspect-ratio: 4/3;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.card .thumb.empty {
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, var(--cream-warm) 0 12px, var(--cream) 12px 24px);
  color: var(--peacock);
}
.card .thumb.empty span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--peacock);
  background: rgba(255,254,248,0.85);
  padding: 6px 14px; border-radius: 20px;
}
.card .body { padding: 16px 18px 18px; }
.card .title {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 0 0 4px;
  color: var(--peacock-deep);
  line-height: 1.25;
}
.card .meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.card .chips { margin-top: 10px; }

/* ============ Theme tiles (home page) ============ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.theme-tile {
  position: relative;
  background: linear-gradient(135deg, var(--peacock-deep) 0%, var(--peacock) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  overflow: hidden;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  border: 1px solid var(--peacock-deep);
}
.theme-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15,76,92,0.25);
  color: #fff;
  text-decoration: none;
}
.theme-tile::after {
  content: ''; position: absolute; bottom: -30px; right: -30px;
  width: 130px; height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, var(--gold) 30%, transparent 31%);
  opacity: 0.18;
}
.theme-tile h3 {
  color: var(--gold-soft);
  font-size: 1.4rem;
  margin: 0 0 8px;
}
.theme-tile p {
  font-size: 0.92rem;
  color: rgba(255,255,255,0.85);
  margin: 0;
}
.theme-tile .arrow {
  display: inline-block;
  margin-top: 14px;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ============ Tags / chips ============ */
.chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream-warm);
  color: var(--ink);
  margin-right: 4px;
  margin-bottom: 4px;
}
.chip.bene_israel { background: var(--bene); color: #fff; }
.chip.baghdadi    { background: var(--baghdadi); color: #fff; }
.chip.cochini     { background: var(--cochini); color: #fff; }
.chip.kerala      { background: var(--kerala); color: #fff; }
.chip.diaspora    { background: var(--diaspora); color: #fff; }
.chip.emerging    { background: var(--emerging); color: #fff; }
.chip.civic       { background: var(--civic); color: #fff; }

/* ============ Map page ============ */
.map-layout {
  display: grid;
  grid-template-columns: 300px 1fr 380px;
  height: calc(100vh - 72px);
  border-top: 1px solid var(--line);
  position: relative;
  transition: grid-template-columns .25s ease;
}
.map-layout.sidebar-collapsed { grid-template-columns: 0 1fr 380px; }
.map-layout.sidebar-collapsed .map-controls {
  transform: translateX(-100%);
  border-right: none;
  pointer-events: none;
}

/* Sidebar toggle handle (sits between sidebar and map, mid-height to clear Leaflet zoom controls) */
.sidebar-toggle {
  position: absolute;
  top: 50%; left: 300px;
  transform: translate(-1px, -50%);
  width: 22px; height: 64px;
  background: var(--peacock-deep);
  color: var(--gold-soft);
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 500;
  font-size: 14px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.22);
  transition: left .25s ease, background .15s;
  font-family: var(--sans);
}
.sidebar-toggle:hover { background: var(--peacock); color: #fff; }
.sidebar-toggle::before { content: '◀'; }
.map-layout.sidebar-collapsed .sidebar-toggle { left: 0; }
.map-layout.sidebar-collapsed .sidebar-toggle::before { content: '▶'; }

.map-controls {
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px;
  font-family: var(--sans);
  font-size: 0.88rem;
  transition: transform .25s ease;
}
.map-controls h3 {
  font-family: var(--sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--peacock-deep);
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.map-controls h3:first-child { margin-top: 0; }
.map-controls label {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 0; cursor: pointer;
  color: var(--ink-soft);
}
.map-controls label:hover { color: var(--ink); }
.map-controls input[type="checkbox"] { accent-color: var(--peacock); }
.map-controls .legend-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

#map { width: 100%; height: 100%; background: var(--cream); }

.detail-panel {
  background: var(--paper);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 0;
}
.detail-panel .empty-state {
  padding: 60px 28px; color: var(--muted); text-align: center;
}
.detail-panel .empty-state .peacock-mark {
  width: 80px; height: 92px; margin: 0 auto 16px; display: block;
  color: var(--peacock); opacity: 0.55;
}
.detail-panel .empty-state .peacock-mark svg { width: 100%; height: 100%; }
.detail-panel .empty-state p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  margin: 0;
}
.detail-panel .panel-content { padding: 28px 26px; }
.detail-panel h2 { font-size: 1.6rem; margin: 0 0 6px; }
.detail-panel .meta-line {
  font-family: var(--sans); font-size: 0.78rem; color: var(--muted);
  margin-bottom: 14px; letter-spacing: 0.3px;
}
.detail-panel .gallery {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 18px 0;
}
.detail-panel .gallery img {
  aspect-ratio: 1/1; object-fit: cover; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--line-soft);
  transition: transform .15s;
}
.detail-panel .gallery img:hover { transform: scale(1.02); }
.detail-panel .gallery .more {
  background: var(--cream-warm); aspect-ratio: 1/1; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; color: var(--peacock-deep);
}
.detail-panel .description { font-size: 0.95rem; line-height: 1.7; color: var(--ink-soft); }
.detail-panel .description.placeholder {
  color: var(--muted); font-style: italic; font-family: var(--serif);
  padding: 14px 16px; background: var(--cream); border-radius: 4px; border-left: 3px solid var(--gold-soft);
}
.detail-panel .full-link {
  display: inline-block; margin-top: 14px; font-family: var(--sans);
  font-size: 0.85rem; font-weight: 600; color: var(--peacock-deep);
  letter-spacing: 0.5px;
}
.detail-panel .full-link:hover { color: var(--terracotta); }

/* Timeline — dual-thumb range */
.timeline-control { padding: 4px 4px 0; }
.timeline-output {
  display: flex; justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--peacock-deep);
  font-weight: 600;
  margin-bottom: 12px;
}
.timeline-output span:first-child { color: var(--peacock-deep); }
.timeline-output span:last-child  { color: var(--peacock-deep); }

.dual-range {
  position: relative;
  height: 28px;
  margin: 0 8px;
}
.dual-range-track {
  position: absolute;
  left: 0; right: 0; top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--line);
  border-radius: 2px;
}
.dual-range-fill {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  height: 4px;
  background: var(--gold);
  border-radius: 2px;
  pointer-events: none;
  left: 0; right: 0;
}
.dual-range input[type="range"] {
  position: absolute;
  left: 0; right: 0; top: 0;
  width: 100%;
  height: 28px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  margin: 0;
}
.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--peacock-deep);
  border: 2px solid var(--gold);
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(15,76,92,0.35);
  transition: transform .12s, box-shadow .12s;
}
.dual-range input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 6px rgba(15,76,92,0.5);
}
.dual-range input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--peacock-deep);
  border: 2px solid var(--gold);
  cursor: grab;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(15,76,92,0.35);
}
.dual-range input[type="range"]::-webkit-slider-runnable-track {
  background: transparent; border: none; height: 28px;
}
.dual-range input[type="range"]::-moz-range-track {
  background: transparent; border: none; height: 28px;
}
.dual-range-axis {
  display: flex; justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.4px;
  margin: 6px 4px 0;
}

/* ============ Feature detail page ============ */
.feature-page { max-width: 980px; margin: 0 auto; padding: 48px 28px 64px; }
.feature-page .back { font-size: 0.85rem; color: var(--muted); }
.feature-page h1 {
  font-size: 2.6rem;
  margin: 12px 0 6px;
  color: var(--peacock-deep);
}
.feature-page .meta-line {
  font-family: var(--sans); color: var(--muted); margin-bottom: 8px; font-size: 0.92rem;
}
.feature-page .gallery-large {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin: 32px 0;
}
.feature-page .gallery-large img {
  aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line-soft);
  transition: transform .15s, box-shadow .15s;
}
.feature-page .gallery-large img:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 14px rgba(15,76,92,0.15);
}
.feature-page .description {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--ink);
  max-width: 720px;
  margin-top: 18px;
}
.feature-page .description.placeholder {
  color: var(--muted); font-style: italic;
  padding: 18px 20px; background: var(--cream); border-radius: 4px;
  border-left: 3px solid var(--gold-soft);
  font-size: 0.95rem;
  font-family: var(--sans);
}
.feature-page .mini-map { height: 360px; border-radius: 8px; border: 1px solid var(--line); margin-top: 24px; }
.feature-page .empty-gallery {
  padding: 40px 24px; background: var(--cream-warm); border-radius: 8px;
  text-align: center; color: var(--muted); font-style: italic; font-family: var(--serif);
  font-size: 1.1rem;
}
.feature-page .empty-gallery .peacock-mark {
  width: 70px; height: 80px; margin: 0 auto 12px; display: block; color: var(--peacock); opacity: 0.4;
}

/* ============ Lightbox ============ */
.lightbox {
  position: fixed; inset: 0; background: rgba(15,30,38,0.94);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
.lightbox .close {
  position: absolute; top: 18px; right: 24px; color: #fff;
  font-size: 36px; cursor: pointer; user-select: none; line-height: 1;
}

/* ============ Search inputs ============ */
.search-input {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.92rem;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-width: 240px;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--peacock);
  box-shadow: 0 0 0 3px rgba(30,95,116,0.12);
}

/* Site-wide search in header */
.site-search {
  position: relative;
  flex: 0 1 260px;
  min-width: 180px;
}
.site-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--header-search-bg);
  border: 1px solid var(--header-search-border);
  border-radius: 999px;
  color: var(--header-search-text);
  font-family: var(--sans);
  font-size: 0.86rem;
  letter-spacing: 0.2px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.site-search input::placeholder { color: var(--header-search-placeholder); font-style: italic; }
.site-search input:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,165,55,0.25);
}
.site-search::before {
  content: '';
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  background: no-repeat center / contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231E5F74' stroke-width='2.2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
  pointer-events: none;
  opacity: 0.65;
}
.site-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15,76,92,0.18);
  max-height: 380px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.site-search-results.open { display: block; }
.site-search-item {
  display: flex; flex-direction: column;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.site-search-item:last-child { border-bottom: none; }
.site-search-item:hover { background: var(--cream); }
.site-search-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  color: var(--peacock-deep);
}
.site-search-meta {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.site-search-empty,
.site-search-more {
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
.site-search-more {
  border-top: 1px solid var(--line-soft);
  background: var(--cream);
}

/* "Open in map" inline CTAs on category pages */
.hero-cta {
  margin-top: 22px;
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 18px;
}
.list-toolbar h2 { margin: 0; }
.list-toolbar .count {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}
.page-map {
  height: 460px;
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 28px;
  background: var(--cream);
}
.page-map.tall { height: 520px; }

/* Empty state used in category galleries */
.empty-state {
  padding: 60px 28px;
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  background: var(--cream-warm);
  border-radius: 8px;
  border: 1px dashed var(--line);
}
.empty-state .empty-peacock,
.empty-state .peacock-mark {
  width: 70px; height: 80px; margin: 0 auto 14px; display: block;
  color: var(--peacock); opacity: 0.5;
}
.empty-state p { margin: 0; }
.no-images {
  padding: 18px;
  background: var(--cream);
  border-radius: 4px;
  color: var(--muted);
  font-style: italic;
  text-align: center;
  font-size: 0.85rem;
  font-family: var(--serif);
}

/* Misc bits used by pages */
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.footnote { color: var(--muted); font-size: 0.82rem; margin-top: 24px; }
.control-help { font-size: 0.72rem; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.control-check { margin-top: 8px; font-size: 0.78rem; }
.download-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--peacock-deep);
  font-weight: 500;
}
.chips-row { margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 4px; }
.feature-desc {
  font-family: var(--serif); font-size: 1.15rem; line-height: 1.75;
  color: var(--ink); max-width: 720px; margin-top: 18px;
}
.feature-desc-placeholder {
  color: var(--muted); font-style: italic;
  padding: 16px 18px; background: var(--cream); border-radius: 4px;
  border-left: 3px solid var(--gold-soft);
  font-size: 0.92rem;
  font-family: var(--sans);
  max-width: 720px;
}
.feature-address { font-size: 0.92rem; color: var(--muted); margin: 14px 0; }
.feature-sources { font-size: 0.78rem; color: var(--muted); margin-top: 24px; }
.back-link a { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); }
.back-link a:hover { color: var(--peacock); }
.section-cream { background: var(--cream-warm); }
.panel-address { margin-top: 10px; font-size: 0.82rem; color: var(--muted); }

/* Schema table on the About page */
.schema-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 28px;
  font-family: var(--sans);
  font-size: 0.86rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.schema-table th, .schema-table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}
.schema-table th {
  background: var(--cream-warm);
  color: var(--peacock-deep);
  font-family: var(--nav);
  font-weight: 600;
  letter-spacing: 0.6px;
  font-size: 0.78rem;
  text-transform: uppercase;
}
.schema-table tr:last-child td { border-bottom: none; }
.schema-table code {
  background: var(--cream);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.82rem;
  color: var(--peacock-deep);
}
.feature-page ol.numbered { padding-left: 22px; line-height: 1.7; }
.feature-page ol.numbered li { margin-bottom: 6px; }
.feature-page pre {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 0.82rem;
  overflow-x: auto;
  color: var(--ink);
  margin: 8px 0;
}
.feature-page code {
  background: var(--cream);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
  color: var(--peacock-deep);
}
@media (max-width: 700px) {
  .schema-table, .schema-table thead, .schema-table tbody, .schema-table tr, .schema-table th, .schema-table td {
    display: block;
  }
  .schema-table thead { display: none; }
  .schema-table tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 0;
  }
  .schema-table td {
    border: none;
    padding: 4px 14px;
  }
  .schema-table td:first-child {
    font-family: var(--nav);
    color: var(--peacock-deep);
    font-size: 0.95rem;
    padding-top: 10px;
  }
}

/* ============ Footer ============ */
.site-footer {
  background: var(--peacock-deep);
  color: rgba(255,255,255,0.78);
  border-top: 3px solid var(--gold);
  padding: 36px 28px 32px;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.85rem;
  margin-top: 64px;
}
.site-footer .peacock-mark {
  width: 50px; height: 58px; margin: 0 auto 14px; display: block; color: var(--gold-soft);
}
.site-footer a { color: var(--gold-soft); }
.site-footer a:hover { color: #fff; }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .map-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 60vh auto;
    height: auto;
  }
  .map-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 0 60vh auto;
  }
  .map-layout.sidebar-collapsed .map-controls {
    transform: translateY(-100%);
    max-height: 0; padding-top: 0; padding-bottom: 0; overflow: hidden;
  }
  .map-controls {
    max-height: 320px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    transition: max-height .25s ease, transform .25s ease;
  }
  .detail-panel {
    border-left: none;
    border-top: 1px solid var(--line);
    max-height: 60vh;
  }
  .sidebar-toggle {
    top: auto; bottom: -14px;
    left: 50%; transform: translateX(-50%);
    width: 56px; height: 28px;
    border-radius: 0 0 6px 6px;
  }
  .sidebar-toggle::before { content: '▲'; }
  .map-layout.sidebar-collapsed .sidebar-toggle { left: 50%; }
  .map-layout.sidebar-collapsed .sidebar-toggle::before { content: '▼'; }
}
@media (max-width: 900px) {
  .site-header-inner { gap: 10px; }
  .site-search { order: 4; flex: 1 1 100%; min-width: 0; }
  .menu-btn { display: inline-flex; }
  .site-nav {
    order: 5;
    flex: 1 1 100%;
    flex-direction: column;
    gap: 0;
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    padding: 6px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .25s ease, opacity .2s ease, padding .25s ease;
  }
  .site-nav.open {
    max-height: 320px;
    opacity: 1;
    padding: 6px;
  }
  .site-nav a { padding: 10px 14px; }
  .site-nav a::after { display: none; }
}
@media (max-width: 700px) {
  .hero { padding: 48px 20px 36px; }
  .hero h1 { font-size: 2.1rem; }
  h2 { font-size: 1.55rem; }
  section.section { padding: 40px 20px; }
  .site-header-inner { padding: 10px 16px; }
  .brand-text { font-size: 1.1rem; }
  .brand-text small { font-size: 0.58rem; }
  .brand-mark { width: 32px; height: 36px; }
  .theme-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .feature-page { padding: 32px 18px 48px; }
  .feature-page h1 { font-size: 1.9rem; }
  .feature-page .gallery-large { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .list-toolbar .search-input { width: 100%; }
  .page-map { height: 360px; }
  .page-map.tall { height: 400px; }
  .hero-cta { flex-direction: column; align-items: stretch; }
  .hero-cta .btn { width: 100%; text-align: center; }
  .icon-btn { width: 36px; height: 36px; }
  /* Map page on phones — show controls/detail above and below the map */
  .map-controls { font-size: 0.92rem; padding: 16px; max-height: 50vh; }
  .detail-panel { max-height: 50vh; }
  .map-layout { grid-template-rows: auto 50vh auto; }
}

/* ============ External link strip (JewishGen / Wikidata / etc.) ============ */
.ext-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 14px;
}
.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--cream-warm);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--peacock-deep);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.ext-link:hover {
  background: var(--peacock-deep);
  border-color: var(--peacock-deep);
  color: var(--gold);
}
.ext-link .ext-arrow {
  font-size: 0.85em;
  opacity: 0.7;
}

/* ============ IIIF Viewer ============ */
.iiif-section {
  margin: 36px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.iiif-heading {
  font-size: 1.35rem;
  margin: 0 0 14px;
  color: var(--peacock-deep);
}
/* Responsive 16:10 aspect-ratio container */
.iiif-embed {
  position: relative;
  width: 100%;
  padding-bottom: 62.5%;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--peacock-deep);
}
.iiif-embed iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}
.iiif-links {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 10px;
}
.iiif-links a { color: var(--peacock); }
.iiif-links a:hover { color: var(--terracotta); }
/* Small "View IIIF" link in the map side-panel */
.iiif-panel-link {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--peacock-deep);
}
.iiif-panel-link:hover { color: var(--terracotta); }

/* ============ Leaflet popup styling ============ */
.leaflet-popup-content { font-family: var(--sans); font-size: 0.88rem; }
.leaflet-popup-content strong a { color: var(--peacock-deep); font-family: var(--serif); font-size: 1.05rem; }
