/* ===========================
   GENERAL
=========================== */

html, body {
  margin: 0;
  height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  background: #e9e5de;
  color: #20252b;
}

:root {
  --ink: #20252b;
  --muted-ink: #5d666f;
  --paper: #f8f6f0;
  --canvas: #e9e5de;
  --accent: #d14b3a;
  --accent-dark: #9e3027;
  --line: rgba(32, 37, 43, 0.16);
  --shadow: 0 12px 30px rgba(28, 33, 38, 0.15);
}


/* ===========================
   HEADER
=========================== */

#siteHeader {
  height: 88px;
  background: var(--ink);
  display: flex;
  align-items: center;
  padding: 0 32px;
  border-bottom: 3px solid var(--accent);
  z-index: 2000;
}

#siteHeader .site-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#siteHeader h1 {
  margin: 0;
  color: #fffdf8;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: Georgia, "Times New Roman", serif;
}

.site-subtitle {
  margin: 0;
  color: rgba(255, 253, 248, 0.78);
  font-size: 12px;
  letter-spacing: 0.04em;
}


/* ===========================
   LAYOUT
=========================== */

#app {
  display: flex;
  height: calc(100% - 88px);
}

#sidebar {
  width: 330px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 24px 18px 20px;
  box-sizing: border-box;
  position: relative;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#sidebar::before {
  content: "";
  position: absolute;
  inset: 12px 10px;
  border: 1px solid rgba(32, 37, 43, 0.12);
  pointer-events: none;
}

.project-info {
  position: relative;
  z-index: 1;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.project-info-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0 0 8px;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  font-family: Arial, sans-serif;
  text-align: left;
}

.project-info-arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 14px;
  color: var(--accent);
}

.project-info-toggle[aria-expanded="true"] .project-info-arrow {
  transform: rotate(180deg);
}

.project-info-content {
  color: var(--muted-ink);
  font-size: 13px;
  line-height: 1.6;
  padding: 0 2px 4px;
}

.project-info-content p {
  margin: 0;
  font-style: italic;
}

.project-info-content p + p {
  margin-top: 16px;
}

#sidebar h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  position: relative;
  z-index: 1;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

#sidebar label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  padding: 11px 12px;
  border-radius: 5px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  letter-spacing: 0.01em;
}

#sidebar label:hover {
  background: rgba(209,75,58,0.07);
  border-color: rgba(209,75,58,0.2);
  transform: translateX(2px);
}

#sidebar input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1.5px solid #68717a;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0;
  flex-shrink: 0;
}

#sidebar input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

#sidebar input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.disabled-layer {
  color: #7d716b;
}

#mapContainer {
  position: relative;
  flex: 1;
  height: 100%;
}

.content-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 28px 32px;
  background: var(--canvas);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}

.info-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px;
  min-height: 120px;
}

.info-card h2 {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 18px;
}

.info-card p {
  margin: 0;
  color: #555;
  font-style: italic;
}

/* ===========================
   MAP
=========================== */

#map {
  width: 100%;
  height: 100%;
}

.disappeared-barrio-marker {
  width: 56px !important;
  height: 56px !important;
  border: 1px solid rgba(204,0,51,0.75);
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(204,0,51,0.78) 0%,
    rgba(204,0,51,0.45) 30%,
    rgba(204,0,51,0.16) 62%,
    rgba(204,0,51,0) 100%
  );
  box-sizing: border-box;
  cursor: pointer;
}

.disappeared-barrio-panel {
  position: absolute;
  z-index: 1100;
  top: 20px;
  right: 20px;
  bottom: 116px;
  width: min(400px, calc(100% - 40px));
  box-sizing: border-box;
  padding: 24px;
  overflow-y: auto;
  background: rgba(248,246,240,0.97);
  border: 1px solid rgba(32,37,43,0.22);
  border-radius: 6px;
  box-shadow: var(--shadow);
  color: var(--ink);
  backdrop-filter: blur(10px);
}

.disappeared-barrio-panel h2 {
  margin: 0 34px 12px 0;
  font-size: 24px;
  line-height: 1.2;
}

.disappeared-barrio-panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.disappeared-barrio-description {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-line;
}

.disappeared-barrio-gallery {
  border-top: 1px solid rgba(29,27,26,0.18);
  padding-top: 16px;
}

.disappeared-barrio-photo-frame {
  position: relative;
  height: 220px;
  background: #dedad1;
  border-radius: 4px;
  overflow: hidden;
}

.disappeared-barrio-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.disappeared-barrio-photo-button {
  position: absolute;
  top: 50%;
  width: 32px;
  height: 42px;
  transform: translateY(-50%);
  border: 0;
  background: rgba(32,37,43,0.82);
  color: #fff;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
}

.disappeared-barrio-photo-button.previous {
  left: 0;
}

.disappeared-barrio-photo-button.next {
  right: 0;
}

.disappeared-barrio-photo-metadata {
  margin: 10px 0 0;
  color: #534c49;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 700px) {
  .disappeared-barrio-panel {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 56%;
    padding: 18px;
  }
}

/* ===========================
   TIMELINE
=========================== */

#timeline {
  position: absolute;
  left: 80px;
  right: 80px;
  bottom: 18px;
  z-index: 1000;

  padding: 12px 20px 28px;
  background: rgba(248,246,240,0.94);
  border: 1px solid rgba(32,37,43,0.18);
  border-radius: 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

#timelineHeader {
  color: var(--ink);
  font-family: Arial, sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

#yearLoading {
  margin-left: 8px;
  color: #666;
  font-size: 12px;
}

#timelineTrack {
  position: relative;
  height: 42px;
}

#timelineTrack {
  position: relative;
  height: 42px;
  --timeline-line-y: 15px;
}

#timelineTrack::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--timeline-line-y);
  height: 2px;
  background: var(--ink);
  transform: translateY(-50%);
}

.year-marker {
  position: absolute;
  top: var(--timeline-line-y);
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
}

.year-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--paper);
  cursor: pointer;
  padding: 0;
}

.year-marker.active .year-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(209,75,58,0.15);
}

.year-label {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted-ink);
  font-family: Arial, sans-serif;
  font-size: 10px;
  white-space: nowrap;
  display: none;
}

.year-marker.active .year-label {
  display: block;
  color: var(--accent-dark);
  font-weight: 700;
}

/* ===========================
   BARRIO LABELS
=========================== */

.barrio-label {
  padding: 5px 9px;
  background: rgba(248,246,240,0.92);
  border: 1px solid rgba(209,75,58,0.32);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(28,33,38,0.14);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.07em;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
    color 0.18s ease, font-size 0.18s ease, padding 0.18s ease;
}

.barrio-label.barrio-label-selected {
  z-index: 1000;
  padding: 7px 12px;
  background: var(--paper);
  border-color: var(--accent);
  box-shadow: 0 5px 16px rgba(28,33,38,0.24);
  color: var(--accent-dark);
  font-size: 13px;
}

.barrio-label::before {
  display: none;
}

/* ===========================
   FOOTER
=========================== */

#siteFooter {
  min-height: 180px;
  padding: 36px 24px;
  box-sizing: border-box;
  background: white;
  border-top: 1px solid #ddd;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;

  font-family: Arial, sans-serif;
}

#siteFooter p {
  margin: 0 0 22px;
  font-size: 14px;
  color: #555;
  text-align: left;
}

#footerLogos {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

#footerLogos img {
  display: block;
  max-height: 120px;
  max-width: 360px;
  width: auto;
  height: auto;
}

/* ===========================
   HISTORIC BUILDINGS
=========================== */

.historic-building-marker{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px !important;
  height: 34px !important;
  background: var(--ink);
  border: 2px solid rgba(255,253,248,0.9);
  border-radius: 50%;
  font-size: 20px;
  filter: drop-shadow(0 3px 5px rgba(29,27,26,0.35));
}

.buildingTooltip {
    background: #f7f2ed;
    border: 1px solid rgba(29,27,26,0.18);
    border-radius: 0;
    box-shadow: 0 6px 20px rgba(29,27,26,0.12);
    max-width: min(320px, calc(100vw - 24px));
    white-space: normal;
    overflow: hidden;
    color: #1d1b1a;
    font-family: "Helvetica Neue", Arial, sans-serif;
    padding: 0;
}

.buildingTooltip::before {
    border-top-color: #f7f2ed;
}

.buildingTooltip.leaflet-tooltip-left::before {
  border-left-color: #f7f2ed;
}

.buildingTooltip.leaflet-tooltip-right::before {
  border-right-color: #f7f2ed;
}

.buildingTooltip.leaflet-tooltip-bottom::before {
  border-bottom-color: #f7f2ed;
}

.buildingTooltip .buildingCard {
    background: #f7f2ed;
    border: 1px solid rgba(29,27,26,0.1);
}

.buildingTooltip .buildingCard img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid rgba(29,27,26,0.12);
}

.buildingTooltip .buildingCard h3 {
    margin: 14px 14px 6px;
    font-size: 18px;
    line-height: 1.2;
    color: #1d1b1a;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.buildingTooltip .buildingCard strong {
    display: block;
    margin: 0 14px 10px;
    color: #7a312d;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.buildingTooltip .buildingCard p {
    margin: 0 14px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #3a3432;
}

.buildingTooltip .buildingCard small {
    display: block;
    margin: 0 14px 14px;
    font-size: 11px;
    line-height: 1.5;
    color: #534c49;
    border-top: 1px solid rgba(29,27,26,0.12);
    padding-top: 10px;
}

.buildingTooltip .buildingCard small b {
    color: #1d1b1a;
}

.buildingCard{

    width:min(320px, calc(100vw - 24px));

    max-width:320px;

    box-sizing:border-box;

    overflow:hidden;

}

.buildingCard img{

    width:100%;

    height:190px;

    object-fit:cover;

    border-radius:8px 8px 0 0;

}

.buildingCard h3{

    margin:10px;

    color:#CC0033;

}

.buildingCard p{

    margin:10px;

    line-height:1.4;

    white-space:normal;

    overflow-wrap:anywhere;

    word-break:break-word;

}

.buildingCard small{

    display:block;

    margin:10px;

    color:#555;

}

/* ===========================
   LUGARES DE INTERES
=========================== */

#sidebar .interest-classifications {
  position: relative;
  z-index: 1;
  margin: -4px 0 12px 28px;
}

#sidebar label.interest-classification {
  margin: 4px 0;
  padding: 6px 8px;
  background: transparent;
  border-color: transparent;
  font-size: 13px;
  text-transform: capitalize;
}

#sidebar label.interest-classification:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(29,27,26,0.12);
}

.interest-popup .leaflet-popup-content-wrapper {
  background: var(--paper);
  border: 1px solid rgba(32,37,43,0.2);
  border-radius: 6px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.interest-popup .leaflet-popup-content {
  width: min(456px, calc(100vw - 72px)) !important;
  max-height: min(440px, calc(100vh - 180px));
  margin: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.interest-popup-card {
  overflow-wrap: anywhere;
}

.interest-popup-card h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.25;
}

.interest-photo-frame {
  position: relative;
  height: 260px;
  margin-bottom: 12px;
  background: #dedad1;
  border-radius: 4px;
  overflow: hidden;
}

.interest-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.interest-photo-button {
  position: absolute;
  top: 50%;
  width: 34px;
  height: 48px;
  transform: translateY(-50%);
  border: 0;
  background: rgba(32,37,43,0.82);
  color: #fff;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
}

.interest-photo-button.previous {
  left: 0;
}

.interest-photo-button.next {
  right: 0;
}

.interest-popup-detail {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.interest-date-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}

.interest-date-details > div {
  text-align: center;
}

.interest-date-details strong,
.interest-date-details span {
  display: block;
}

.interest-date-details strong {
  font-size: 12px;
}

.interest-date-details span {
  margin-top: 3px;
  font-size: 14px;
}

.interest-popup-reference {
  font-size: 10px;
  line-height: 1.35;
}

.interest-photo-counter {
  margin: 0;
  color: #534c49;
  font-size: 12px;
  text-align: center;
}