/* ============================================================
   澳門天橋圖鑑 — Macau Overhead Bridges Atlas
   Split layout: Left map + Right tabbed content
   Classical paper aesthetic · sepia / gold / crimson
   ============================================================ */

:root {
  --paper: #f5ecdc;
  --paper-deep: #ecdfc8;
  --paper-light: #faf4e8;
  --ink: #1c1814;
  --ink-soft: #4a3f33;
  --ink-mute: #76685a;
  --gold: #a07736;
  --gold-deep: #7e5a23;
  --crimson: #8b2c2c;
  --blue: #2c5c8b;
  --gray-future: #8a8278;
  --line: #d8c9a8;
  --shadow: 0 8px 28px rgba(60, 40, 15, 0.12);
  --shadow-lg: 0 16px 48px rgba(60, 40, 15, 0.18);
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif TC", "Source Han Serif TC", "Songti TC", serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(160, 119, 54, 0.04) 1px, transparent 1px),
    radial-gradient(rgba(139, 44, 44, 0.025) 1px, transparent 1px);
  background-size: 28px 28px, 47px 47px;
  background-position: 0 0, 14px 14px;
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--gold-deep);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold);
}
a:hover { color: var(--crimson); border-bottom-color: var(--crimson); }

strong { color: var(--crimson); font-weight: 600; }

/* ========== APP LAYOUT ========== */
.app-layout {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ========== LEFT: MAP PANEL ========== */
.map-panel {
  width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.map-panel-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(245,236,220,0) 0%, rgba(160,119,54,0.05) 100%);
}

.map-panel-title .kicker {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--gold-deep);
  text-transform: uppercase;
  margin: 0 0 4px;
}

.map-panel-title h1 {
  font-size: clamp(18px, 2.2vw, 26px);
  margin: 0 0 12px;
  letter-spacing: 0.08em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.filter-btn {
  background: var(--paper-light);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 22px;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--gold); color: var(--ink); }
.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.filter-btn span { font-weight: 600; }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px;
}
.lg {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-soft);
  letter-spacing: 0.04em;
  pointer-events: none;
}
.lg i {
  width: 12px; height: 3px; border-radius: 2px;
  display: inline-block;
}
.lg-cross   i { background: var(--crimson); }
.lg-vehicle i { background: var(--gold); }
.lg-ped     i { background: var(--blue); }
.lg-future  i { background: var(--gray-future); }

.map-container {
  flex: 1;
  min-height: 0;
  position: relative;
}

#map {
  position: absolute;
  inset: 0;
  background: #f8f2e3;
}

/* Leaflet popup classical override */
.leaflet-popup-content-wrapper {
  background: var(--paper-light);
  color: var(--ink);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 0;
}
.leaflet-popup-content-wrapper .leaflet-popup-content { margin: 0; }
.leaflet-popup-tip { background: var(--paper-light); }
.leaflet-popup-content {
  font-family: "Noto Serif TC", serif;
  width: 300px !important;
}
.popup-card { padding: 0; }
.popup-img {
  width: 100%; height: 170px; object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: zoom-in;
  display: block;
  border-bottom: 1px solid var(--line);
}
.popup-no-img {
  height: 70px;
  background: linear-gradient(135deg, var(--paper-deep), var(--paper));
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute); font-style: italic; font-size: 13.5px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--line);
}
.popup-body { padding: 14px 16px 16px; }
.popup-kind {
  display: inline-block;
  font-size: 11px; letter-spacing: 0.2em;
  padding: 3px 10px; border-radius: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
  color: #fff;
}
.popup-kind.cs { background: var(--crimson); }
.popup-kind.v  { background: var(--gold); }
.popup-kind.p  { background: var(--blue); }
.popup-kind.f  { background: var(--gray-future); }
.popup-title {
  font-size: 18px; font-weight: 600;
  margin: 0 0 2px; color: var(--ink);
  letter-spacing: 0.04em;
}
.popup-subtitle {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 10px;
}
.popup-meta {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 6px;
}
.popup-meta b { color: var(--ink); font-weight: 600; }
.popup-row { margin-bottom: 2px; }
.popup-note {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  line-height: 1.7;
}

/* ========== RIGHT: CONTENT PANEL ========== */
.content-panel {
  width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--paper);
}

.app-layout.photo-record-expanded .map-panel {
  display: none;
}

.app-layout.photo-record-expanded .content-panel {
  width: 100%;
}

.app-layout.photo-record-expanded #tab-photo-record .tab-inner {
  padding-left: clamp(24px, 5vw, 72px);
  padding-right: clamp(24px, 5vw, 72px);
}

.content-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--paper-deep);
  flex-shrink: 0;
  overflow-x: auto;
}

.content-tab {
  padding: 12px 20px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.content-tab:hover {
  color: var(--ink);
  background: rgba(160,119,54,0.06);
}
.content-tab.active {
  color: var(--ink);
  border-bottom-color: var(--crimson);
  font-weight: 600;
}

.tab-pane {
  display: none;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.tab-pane.active {
  display: block;
}

.tab-inner {
  padding: 28px 24px 48px;
}

/* ---------- TAB: OVERVIEW ---------- */
.lede {
  max-width: 100%;
  margin: 0 auto 32px;
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.95;
  border-left: 3px solid var(--gold);
  padding-left: 16px;
}

.section-head { text-align: center; margin-bottom: 28px; }
.section-num {
  display: inline-block;
  font-family: "Noto Serif TC", serif;
  font-size: 20px;
  color: var(--crimson);
  border: 1px solid var(--crimson);
  width: 40px; height: 40px;
  line-height: 38px;
  margin-bottom: 10px;
  border-radius: 50%;
  letter-spacing: 0;
}
.section-head h2 {
  font-size: 24px;
  margin: 0;
  letter-spacing: 0.1em;
  color: var(--ink);
  font-weight: 600;
}
.section-sub {
  max-width: 100%; margin: 10px auto 0;
  color: var(--ink-soft); font-size: 14px;
}

/* ---------- STATS ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 34px;
  line-height: 1;
  color: var(--crimson);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.stat-label {
  margin-top: 8px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ---------- CROSS-SEA HIGHLIGHT GRID ---------- */
.cross-sea-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.cs-card {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: pointer;
  display: flex;
  flex-direction: row;
}
.cs-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.cs-img {
  width: 200px; min-height: 160px; object-fit: cover;
  border-right: 1px solid var(--line);
  background: var(--paper-deep);
  display: block;
  flex-shrink: 0;
}
.cs-no-img {
  width: 200px; min-height: 160px;
  background: linear-gradient(135deg, var(--paper-deep), var(--paper));
  display: flex; align-items: center; justify-content: center;
  font-style: italic; color: var(--ink-mute);
  border-right: 1px solid var(--line);
  flex-shrink: 0;
}
.cs-body { padding: 16px 18px; flex: 1; min-width: 0; }
.cs-year {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--crimson);
  letter-spacing: 0.1em;
}
.cs-name {
  font-size: 19px;
  font-weight: 600;
  margin: 3px 0 2px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.cs-pt {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-mute);
  margin: 0 0 8px;
}
.cs-spec {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.8;
}
.cs-spec b { color: var(--ink); font-weight: 600; }
.cs-highlight {
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink);
  font-style: italic;
  border-left: 2px solid var(--gold);
  padding-left: 10px;
  line-height: 1.7;
}

/* ---------- CATALOG ---------- */
.catalog-tabs {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-bottom: 22px;
}
.cat-tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13.5px;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s;
}
.cat-tab:hover { color: var(--ink); border-color: var(--gold); }
.cat-tab.active {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.catalog-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.cat-item {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-item:hover {
  background: #fff;
  transform: translateX(2px);
  box-shadow: var(--shadow);
}
.cat-item.cs { border-left-color: var(--crimson); }
.cat-item.v  { border-left-color: var(--gold); }
.cat-item.p  { border-left-color: var(--blue); }
.cat-item.f  { border-left-color: var(--gray-future); border-left-style: dashed; }
.cat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}
.cat-pt {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.cat-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
}

/* ---------- TABLE SECTION ---------- */
.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.table-search {
  flex: 1;
  min-width: 160px;
  max-width: 260px;
}

.table-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13.5px;
  background: var(--paper-light);
  color: var(--ink);
  transition: border-color 0.2s;
}
.table-search input:focus {
  outline: none;
  border-color: var(--gold);
}

.table-filters {
  display: flex;
  gap: 10px;
}
.table-filters select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13.5px;
  background: var(--paper-light);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s;
}
.table-filters select:focus {
  outline: none;
  border-color: var(--gold);
}

.table-wrapper {
  overflow-x: auto;
}

#bridgeTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#bridgeTable thead {
  background: var(--paper-deep);
}

#bridgeTable th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
  position: sticky;
  top: 0;
  background: var(--paper-deep);
}
#bridgeTable th:hover { color: var(--gold); }
#bridgeTable th.sorted-asc::after { content: " ↑"; color: var(--gold); }
#bridgeTable th.sorted-desc::after { content: " ↓"; color: var(--gold); }

#bridgeTable td {
  padding: 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

#bridgeTable tbody tr { transition: background 0.2s; }
#bridgeTable tbody tr:hover { background: var(--paper-deep); }
#bridgeTable tbody tr.clickable { cursor: pointer; }
#bridgeTable .kind-cross_sea { color: var(--crimson); font-weight: 500; }
#bridgeTable .kind-vehicle { color: var(--gold); }
#bridgeTable .kind-pedestrian { color: var(--blue); }
#bridgeTable .status-existing { color: var(--ink); }
#bridgeTable .status-planned { color: var(--gray-future); }
#bridgeTable .status-under_construction { color: var(--gold-deep); }

#bridgeTable .btn-locate {
  padding: 5px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
#bridgeTable .btn-locate:hover { background: var(--gold); color: var(--paper); }
#bridgeTable .btn-locate.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-add-bridge {
  padding: 8px 14px;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-add-bridge:hover { background: var(--blue); color: var(--paper); }

#bridgeTable .table-actions { white-space: nowrap; }

#bridgeTable .coord-cell {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

#bridgeTable .btn-edit-bridge,
#bridgeTable .btn-delete-bridge {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 4px;
}
#bridgeTable .btn-edit-bridge {
  border: 1px solid var(--blue);
  color: var(--blue);
  background: transparent;
}
#bridgeTable .btn-edit-bridge:hover { background: var(--blue); color: var(--paper); }
#bridgeTable .btn-delete-bridge {
  border: 1px solid var(--crimson);
  color: var(--crimson);
  background: transparent;
}
#bridgeTable .btn-delete-bridge:hover { background: var(--crimson); color: var(--paper); }

/* ---------- BRIDGE FORM MODAL ---------- */
.bridge-form-content {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}
.bridge-form-header {
  padding: 22px 24px 0;
}
.bridge-form-header h3 {
  font-family: "Noto Serif TC", serif;
  font-size: 20px;
  margin: 0;
  color: var(--ink);
}
.bridge-form {
  padding: 18px 24px 24px;
}
.bf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.bf-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.bf-grid input,
.bf-grid select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--paper-light);
  color: var(--ink);
  transition: border-color 0.2s;
}
.bf-grid input:focus,
.bf-grid select:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}
.bf-grid .bf-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0;
  cursor: pointer;
}
.bf-grid .bf-check input { width: 16px; height: 16px; }
.bf-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.btn-bridge-cancel,
.btn-bridge-save {
  padding: 9px 20px;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-bridge-cancel {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
}
.btn-bridge-cancel:hover { background: var(--paper-deep); color: var(--ink); }
.btn-bridge-save {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: var(--paper);
}
.btn-bridge-save:hover { background: #24507e; }

.table-footer {
  padding: 14px 0 0;
  text-align: center;
  color: var(--ink-mute);
  font-size: 12.5px;
}

/* ---------- PHOTO RECORD SECTION ---------- */
.photo-record-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.photo-summary-card {
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.photo-summary-card.done { border-top: 3px solid var(--blue); }
.photo-summary-card.pending { border-top: 3px solid var(--gold); }

.photo-summary-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 32px;
  line-height: 1;
  color: var(--crimson);
  font-weight: 600;
}

.photo-summary-label {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.photo-record-controls {
  align-items: stretch;
}

#photoRecordTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#photoRecordTable thead {
  background: var(--paper-deep);
}

#photoRecordTable th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--paper-deep);
}

#photoRecordTable td {
  padding: 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: top;
}

#photoRecordTable tbody tr { transition: background 0.2s; }
#photoRecordTable tbody tr:hover { background: var(--paper-deep); }
#photoRecordTable tbody tr.clickable { cursor: pointer; }
#photoRecordTable .kind-cross_sea { color: var(--crimson); font-weight: 500; }
#photoRecordTable .kind-vehicle { color: var(--gold); }
#photoRecordTable .kind-pedestrian { color: var(--blue); }

#photoRecordTable .btn-locate {
  padding: 5px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}
#photoRecordTable .btn-locate:hover { background: var(--gold); color: var(--paper); }
#photoRecordTable .btn-locate.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.photo-record-input {
  width: 100%;
  min-width: 130px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(250, 244, 232, 0.8);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
}
.photo-record-input:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}

.photo-actions {
  white-space: nowrap;
}

.btn-save-photo {
  padding: 5px 10px;
  border: 1px solid var(--blue);
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 6px;
}
.btn-save-photo:hover {
  background: var(--blue);
  color: var(--paper);
}

.photo-status {
  display: inline-block;
  min-width: 58px;
  padding: 3px 8px;
  border-radius: 14px;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
}
.photo-status.done {
  background: rgba(44, 92, 139, 0.12);
  color: var(--blue);
  border: 1px solid rgba(44, 92, 139, 0.35);
}
.photo-status.pending {
  background: rgba(160, 119, 54, 0.12);
  color: var(--gold-deep);
  border: 1px solid rgba(160, 119, 54, 0.35);
}

.drive-link {
  display: inline-block;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 11.5px;
  line-height: 1.4;
}

.photo-drive-preview {
  margin-top: 5px;
}

.photo-subtext,
.photo-missing {
  display: block;
  color: var(--ink-mute);
  font-size: 12px;
  line-height: 1.5;
}

.photo-record-save-status {
  display: block;
  margin-top: 6px;
  color: var(--blue);
  font-size: 12px;
}

/* ---------- SOURCES ---------- */
.sources-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
.sources-grid h3 {
  font-size: 15px;
  letter-spacing: 0.15em;
  color: var(--crimson);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin: 0 0 10px;
  font-weight: 600;
}
.sources-grid ul { padding-left: 20px; margin: 0; line-height: 1.9; }
.sources-grid li { color: var(--ink-soft); font-size: 13.5px; }

.footer-note {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--paper-light);
  border-left: 3px solid var(--crimson);
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.8;
}

/* ---------- LIGHTBOX ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(28, 24, 20, 0.94);
  display: flex;
  align-items: center; justify-content: center;
  z-index: 9999;
  padding: 40px;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw; max-height: 82vh;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lb-caption {
  position: absolute;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  color: var(--paper);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16px;
  text-align: center;
  max-width: 80vw;
  letter-spacing: 0.04em;
}
.lb-close {
  position: absolute;
  top: 24px; right: 28px;
  background: transparent;
  border: 1px solid rgba(245, 236, 220, 0.4);
  color: var(--paper);
  width: 44px; height: 44px;
  font-size: 26px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.lb-close:hover { background: rgba(245, 236, 220, 0.15); }

/* ---------- BRIDGE DETAIL MODAL ---------- */
.bridge-modal {
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.bridge-modal[hidden] { display: none; }

.bridge-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 24, 20, 0.6);
}

.bridge-modal-content {
  position: relative;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1;
}

.bridge-modal-close {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(245, 236, 220, 0.85);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 32px; height: 32px;
  font-size: 20px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
  transition: all 0.2s;
}
.bridge-modal-close:hover { background: var(--ink); color: var(--paper); }

/* Modal inner content reuse popup styles at larger size */
.bridge-modal-content .popup-card { padding: 0; }
.bridge-modal-content .popup-img {
  height: 240px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.bridge-modal-content .popup-no-img {
  height: 100px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.bridge-modal-content .popup-body { padding: 20px 24px 24px; }
.bridge-modal-content .popup-title { font-size: 22px; }
.bridge-modal-content .popup-meta { font-size: 14px; }
.bridge-modal-content .popup-note { font-size: 14px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }
  .map-panel {
    width: 100%;
    height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .content-panel {
    width: 100%;
    height: 55vh;
  }
  .map-panel-title h1 {
    font-size: 18px;
  }
  .cs-card {
    flex-direction: column;
  }
  .cs-img, .cs-no-img {
    width: 100%;
    min-height: 140px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .photo-record-summary {
    grid-template-columns: 1fr;
  }
}
