:root {
      --panel-width: min(420px, calc(100vw - 32px));
      --rail-gap: 14px;
      --bg: #081521;
      --surface: rgba(32, 44, 56, 0.92);
      --surface-strong: rgba(13, 24, 36, 0.96);
      --border: rgba(196, 228, 255, 0.14);
      --text: rgba(242,248,255,0.98);
      --text-soft: rgba(226,238,250,0.78);
      --text-faint: rgba(213,228,244,0.56);
      --perm: #90a8c2;
      --temp: #d5dce4;
      --featured: #c86767;
      --node: #d9bd83;
      --control-bg: rgba(18, 31, 44, 0.9);
      --control-border: rgba(196, 228, 255, 0.14);
      --control-border-strong: rgba(196, 228, 255, 0.24);
      --overlay-scrim: rgba(4,10,16,.52);
      --marker-ring: rgba(236,245,255,.95);
      --shadow: 0 16px 40px rgba(0,0,0,.18);
      --shadow-card: 0 18px 44px rgba(0,0,0,.20);
      --shadow-toolbar: 0 12px 30px rgba(0,0,0,.18);
      --radius-xl: 26px;
      --radius-lg: 18px;
      --radius-md: 14px;
      --radius-pill: 999px;
    }

    * { box-sizing: border-box; }
    html, body {
      width: 100%; height: 100%; margin: 0;
      background: var(--bg); color: var(--text);
      font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
      -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    }
    button { font: inherit; color: inherit; }
    img { display: block; max-width: 100%; }

    #app,
    button,
    .chip,
    .lang-btn,
    .icon-btn,
    .contact-link {
      -webkit-user-select: none;
      user-select: none;
    }

    img,
    .viewer-image,
    .card-image {
      -webkit-user-drag: none;
      user-select: none;
    }

    #app {
      position: relative; width: 100%; height: 100%; overflow: hidden;
      background: #06111a;
    }
    #app::before {
      content: none;
    }
    #map { width: 100%; height: 100%; background: #0d141c; filter: saturate(.82) contrast(1.02) brightness(.96) hue-rotate(-8deg); }

    .glass {
      background: #2f3c4c;
      border: 1px solid var(--border);
      box-shadow: none;
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }

    #leftRail {
      position: absolute; left: 16px; top: 18px; bottom: 16px; z-index: 2300;
      width: var(--panel-width);
      display: flex; flex-direction: column; gap: var(--rail-gap);
      pointer-events: none;
      min-height: 0;
      height: auto;
    }

    #railContent {
      display: flex;
      flex: 1 1 auto;
      flex-direction: column;
      gap: var(--rail-gap);
      overflow: hidden;
      padding-right: 6px;
      padding-bottom: 0;
      background: transparent;
      min-height: 0;
      align-content: start;
    }
    #railContent::-webkit-scrollbar { width: 6px; }
    #railContent::-webkit-scrollbar-thumb { background: rgba(196, 228, 255, 0.16); border-radius: 999px; }
    #railContent::-webkit-scrollbar-track { background: transparent; }

    #header, #card, #controls { width: 100%; pointer-events: auto; }
    #railContent > * { flex-shrink: 0; }

    #header { padding: 20px 22px; border-radius: var(--radius-xl); flex: 0 0 auto; overflow: hidden; box-shadow: none; border-color: rgba(196, 228, 255, 0.10); }
    #controls { border-radius: var(--radius-xl); overflow: hidden; box-shadow: none; }
    .eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--text-faint); }
    h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.02; letter-spacing: -.04em; font-weight: 620; }
    .intro { margin: 12px 0 0; max-width: 34ch; font-size: 15px; line-height: 1.5; color: var(--text-soft); }

    #infoButton {
      box-shadow: none;
      appearance: none;
      border: 1px solid var(--control-border);
      background: #1c2a38;
      color: var(--text-soft);
      border-radius: var(--radius-pill);
      min-height: 40px;
      padding: 0 15px;
      cursor: pointer;
      position: static;
      z-index: auto;
      white-space: nowrap;
      flex: 0 0 auto;
    }

    #card {
      border-radius: var(--radius-xl);
      overflow: hidden;
      background: #2f3c4c;
      opacity: 0;
      transform: translateY(10px);
      pointer-events: none;
      transition: opacity .22s ease, transform .22s ease;
      flex: 0 0 auto;
      align-self: stretch;
      box-shadow: none;
      display: flex;
      flex-direction: column;
      min-height: 0;
      height: auto;
      max-height: min(72vh, 680px);
      border-color: rgba(196, 228, 255, 0.10);
    }
    #card.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .card-image-wrap {
      aspect-ratio: auto;
      height: auto;
      min-height: 0;
      max-height: 240px;
      background: rgba(255,255,255,.04);
      border-bottom: 1px solid var(--border);
      overflow: hidden;
      position: relative;
      isolation: isolate;
      flex: 0 0 auto;
    }
    .card-image {
      width: 100%;
      height: auto;
      max-height: 240px;
      object-fit: cover;
    }
    .card-body {
      padding: 18px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-height: 0;
      overflow: hidden;
      flex: 0 0 auto;
      border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    }
    .card-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 14px;
      margin-bottom: 4px;
    }
    .card-title { margin: 0; flex: 1 1 auto; min-width: 0; font-size: clamp(22px, 3vw, 32px); line-height: 1.06; letter-spacing: -.035em; font-weight: 600; overflow-wrap: anywhere; }
    .icon-btn {
      appearance: none; width: 40px; height: 40px; flex: 0 0 40px;
      border-radius: 50%; border: 1px solid var(--control-border); background: rgba(255,255,255,.05); cursor: pointer;
    }
    .meta { display: none; }
    .pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: var(--radius-pill); background: rgba(255,255,255,.06); border: 1px solid var(--control-border); color: var(--text); font-size: 12px; font-weight: 600; }
    .pill.featured { background: rgba(201,90,90,.14); border-color: rgba(201,90,90,.32); color: rgba(255,235,235,.98); }
    .coords {
      margin: 0 0 4px;
      color: var(--text-faint);
      font-size: 13px;
      display:flex;
      align-items:center;
      gap:10px;
    }
    .coords::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--perm);
      box-shadow: 0 0 0 4px rgba(147,170,195,.12);
      flex: 0 0 auto;
    }
    .coords.temp::before { background: var(--temp); box-shadow: 0 0 0 4px rgba(216,221,229,.14); }
    .coords.node::before { background: var(--node); box-shadow: 0 0 0 4px rgba(240,210,141,.14); }
    .coords.featured::before { background: var(--featured); box-shadow: 0 0 0 4px rgba(201,90,90,.14); }
    .desc-wrap {
      position: relative;
      min-height: 0;
      flex: 0 1 auto;
    }
    .desc {
      margin: 0; color: var(--text-soft); font-size: 15px; line-height: 1.55;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 6;
      overflow: hidden;
    }
    #card.expanded .desc {
      display: block;
      -webkit-line-clamp: unset;
      overflow: auto;
      max-height: min(28vh, 260px);
      padding-right: 4px;
      scrollbar-width: thin;
      scrollbar-color: rgba(196, 228, 255, 0.18) transparent;
    }
    .desc-wrap.clamped::after {
      content: "";
      position: absolute;
      left: 0; right: 0; bottom: 0;
      height: 44px;
      background: linear-gradient(180deg, rgba(12,24,36,0), rgba(12,24,36,0.96));
      pointer-events: none;
      opacity: 1;
      transition: opacity .18s ease;
    }
    #card.expanded .desc-wrap::after { opacity: 0; }
    .desc-toggle {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      margin-top: 10px;
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--text-faint);
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      letter-spacing: .01em;
      width: fit-content;
    }
    .desc-toggle[hidden] { display: none !important; }
    .desc-toggle::after {
      content: "▾";
      font-size: 12px;
      transform: translateY(-1px);
      transition: transform .18s ease;
    }
    #card.expanded .desc-toggle::after { transform: rotate(180deg) translateY(1px); }
    .card-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 8px;
      padding-top: 0;
      padding-bottom: 0;
      background: transparent;
      align-items: center;
    }
    .btn { appearance: none; min-height: 44px; border-radius: 14px; border: 1px solid var(--control-border); background: rgba(255,255,255,.05); color: var(--text); padding: 0 18px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
    .btn:hover, .btn:focus-visible { background: rgba(255,255,255,.08); border-color: var(--control-border-strong); transform: translateY(-1px); outline: none; }
    .btn.primary { background: #536173; border-color: rgba(196, 228, 255, 0.16); }

    #controls {
      position: relative;
      left: auto;
      bottom: auto;
      width: 100%;
      margin-top: auto;
      padding: 8px;
      overflow: hidden;
      z-index: 2305;
      pointer-events: auto;
      box-shadow: none;
      border-radius: 999px;
      background: #243241;
      border: 1px solid rgba(196, 228, 255, 0.10);
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
      flex: 0 0 auto;
    }
    #chips {
      display: flex; align-items: center; justify-content: flex-start;
      gap: 8px; width: 100%; min-width: 0;
      overflow-x: auto; overflow-y: hidden;
      scrollbar-width: none; -ms-overflow-style: none;
      scroll-behavior: smooth;
      padding: 0;
    }
    #chips::-webkit-scrollbar { display: none; }
    .chip {
      box-shadow: none;
      appearance: none;
      flex: 1 1 0;
      min-width: 0;
      min-height: 48px;
      padding: 10px 16px;
      border: 1px solid rgba(196, 228, 255, 0.10);
      background: rgba(5, 16, 27, 0.62);
      color: var(--text-soft);
      border-radius: 999px;
      cursor: pointer;
      transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
      display: inline-flex; align-items: center; justify-content: center;
      text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; letter-spacing: -.01em;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
    }
    .chip.active { background: #4e5c6d; color: var(--text); border-color: rgba(196, 228, 255, 0.22); box-shadow: none; }
    .chip:hover, .chip:focus-visible { border-color: rgba(196, 228, 255, 0.18); color: var(--text); outline: none; transform: translateY(-1px); }
    .chip-dot { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; margin-right: 7px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.88); vertical-align: -1px; }
    .chip-dot.temp { background: var(--temp); }
    .chip-dot.perm { background: var(--perm); }
    .chip-dot.featured { background: var(--featured); }
    .chip-dot.all { background: linear-gradient(135deg, var(--featured), var(--perm)); }

    .modal-backdrop { position: absolute; inset: 0; z-index: 3000; display: none; align-items: center; justify-content: center; padding: 16px; background: var(--overlay-scrim); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
    .modal-backdrop.open { display: flex; }
    .modal { width: min(720px, 100%); border-radius: 28px; overflow: hidden; }
    .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
    .modal-title { margin: 0; font-size: 18px; font-weight: 600; }
    .modal-body { padding: 18px; }
    .light-copy { margin: 0; color: var(--text-soft); font-size: 15px; line-height: 1.6; }
    .institution-list { display: grid; gap: 12px; margin-top: 16px; }
    .institution { padding: 14px 15px; border-radius: var(--radius-md); background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); }
    .institution strong { display: block; margin-bottom: 4px; font-size: 14px; }

    .contact-links {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px solid rgba(255,255,255,.08);
    }
    .contact-links[hidden] { display: none !important; }
    .contact-link {
      width: 42px;
      height: 42px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 14px;
      border: 1px solid var(--control-border);
      background: rgba(255,255,255,.05);
      color: var(--text-soft);
      text-decoration: none;
      transition: transform .18s ease, border-color .18s ease, background .18s ease;
    }
    .contact-link:hover,
    .contact-link:focus-visible {
      transform: translateY(-1px);
      background: rgba(255,255,255,.08);
      border-color: var(--control-border-strong);
      box-shadow: 0 8px 18px rgba(0,0,0,.14);
      outline: none;
    }
    .contact-link svg {
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }
    .institution-head {
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:14px;
    }
    .institution-copy {
      margin-top: 6px;
    }
    .viewer { display: grid; gap: 14px; }
    .viewer-image-wrap {
      overflow: hidden;
      border-radius: 20px;
      background: rgba(255,255,255,.04);
      border: 1px solid rgba(255,255,255,.06);
      aspect-ratio: 4 / 3;
      position: relative;
      isolation: isolate;
    }
    .viewer-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    .viewer-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    .viewer-caption { color: var(--text-soft); font-size: 14px; }
    .viewer-nav { display: flex; gap: 8px; }
    .viewer-nav .btn { min-width: 44px; }

    #status { position: absolute; right: 16px; top: 64px; z-index: 2400; max-width: min(320px, calc(100vw - 32px)); padding: 9px 12px; border-radius: 12px; background: rgba(8,18,29,.88); border: 1px solid var(--control-border); font-size: 12px; color: rgba(255,255,255,.84); display: none; }

    #topActions {
      position: absolute;
      top: 16px;
      right: 16px;
      z-index: 2200;
      display: flex;
      gap: 10px;
      align-items: center;
    }
    #langToggle {
      box-shadow: none;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 4px;
      min-height: 40px;
      border-radius: var(--radius-pill);
      border: 1px solid var(--control-border);
      background: #1c2a38;
    }
    .lang-btn {
      appearance: none;
      border: 0;
      background: transparent;
      color: var(--text-faint);
      border-radius: 999px;
      min-width: 44px;
      min-height: 30px;
      padding: 0 10px;
      cursor: pointer;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: .04em;
      transition: background .18s ease, color .18s ease;
    }
    .lang-btn.active {
      background: rgba(255,255,255,.14);
      color: var(--text);
    }

    @media (max-width: 520px) {
      #topActions {
        top: 12px;
        right: 12px;
        gap: 8px;
        flex-direction: column;
        align-items: flex-end;
      }
      #langToggle {
        min-height: 36px;
        padding: 3px;
      }
      .lang-btn {
        min-width: 38px;
        min-height: 28px;
        padding: 0 8px;
      }
      #infoButton {
        min-height: 36px;
        padding: 0 13px;
      }
      .leaflet-top.leaflet-right {
        margin-top: 112px;
      }
    }

    .custom-marker { border-radius: 50%; border: 2px solid var(--marker-ring); box-shadow: 0 0 0 1px rgba(0,0,0,.14); transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
    .marker-temp { width: 10px; height: 10px; background: var(--temp); border-width: 1.5px; }
    .marker-perm { width: 14px; height: 14px; background: var(--perm); }
    .marker-featured { width: 22px; height: 22px; background: var(--featured); box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 14px rgba(201,90,90,.28); }
    .marker-node { width: 16px; height: 16px; background: color-mix(in srgb, var(--node) 62%, transparent); border-color: var(--node); }
    .marker-selected { transform: scale(1.14); box-shadow: 0 0 0 2px rgba(255,255,255,.98), 0 0 0 8px rgba(255,255,255,.06), 0 0 14px rgba(255,255,255,.14); }
    .marker-muted { opacity: .24; }

    .leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; overflow: hidden; border-radius: 14px !important; }
    .leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; background: rgba(18,31,44,.92) !important; color: rgba(255,255,255,.92) !important; border-bottom-color: rgba(255,255,255,.08) !important; }
    .leaflet-top.leaflet-right { margin-top: 72px; margin-right: 10px; }
    .leaflet-bottom.leaflet-right { margin-bottom: 18px; margin-right: 18px; }
    .leaflet-control-attribution { background: rgba(8,13,20,.72) !important; color: rgba(226,238,250,.72) !important; border-radius: 12px !important; padding: 4px 8px !important; }
    .leaflet-control-attribution a { color: rgba(242,248,255,.92) !important; }

    @media (max-height: 860px) {
      :root { --panel-width: min(400px, calc(100vw - 32px)); }
      #header { padding: 16px 18px; }
      .intro { font-size: 14px; line-height: 1.42; }
      .card-image-wrap { height: clamp(104px, 18vh, 140px); }
      .card-body { padding: 16px; }
      .desc { font-size: 14px; line-height: 1.48; }
      .btn { min-height: 42px; }
    }

    @media (max-height: 760px) {
      :root { --panel-width: min(380px, calc(100vw - 32px)); --rail-gap: 10px; }
      #leftRail { top: 14px; bottom: 12px; }
      #header { padding: 15px 16px; }
      .eyebrow { margin-bottom: 6px; font-size: 10px; }
      h1 { font-size: clamp(26px, 3vw, 34px); }
      .intro { margin-top: 10px; font-size: 13.5px; line-height: 1.38; }
      .card-image-wrap { height: clamp(92px, 15vh, 118px); }
      .card-body { padding: 14px; }
      .card-title { font-size: clamp(20px, 2.4vw, 28px); }
      .coords { margin-bottom: 10px; }
      .desc { font-size: 13.5px; line-height: 1.42; }
      .card-actions { gap: 8px; margin-top: 12px; }
      .btn { min-height: 40px; padding: 0 16px; }
      #controls { padding: 7px; }
      .chip {
      box-shadow: none; min-height: 40px; padding: 8px 14px; }
    }

    @media (max-width: 900px) {
      :root { --panel-width: calc(100vw - 24px); }
      #leftRail { left: 12px; top: 12px; bottom: 12px; }
      #controls { width: 100%; }
      #railContent { padding-right: 4px; }
      #header { padding: 16px; }
      .intro { max-width: none; }
      .card-image-wrap { height: clamp(104px, 19vh, 150px); }
    }
    @media (max-width: 520px) {
      #leftRail { gap: 12px; }
      #controls { padding: 7px; }
      h1 { font-size: 30px; }
      .card-title { font-size: 22px; }
      .card-body { padding: 16px; }
      #controls { padding: 6px; }
      #chips { gap: 6px; }
      .chip {
      box-shadow: none; min-height: 38px; padding: 8px 14px; font-size: 11px; }
      .chip-dot { width: 8px; height: 8px; margin-right: 4px; }
      .viewer-footer { flex-direction: column; align-items: stretch; }
    }

    @media (max-height: 680px) {
      #header { padding: 14px 15px; }
      .intro { margin-top: 8px; font-size: 13px; line-height: 1.34; }
      .card-image-wrap { height: clamp(84px, 13vh, 104px); }
      .card-body { padding: 13px; }
      .card-title { font-size: clamp(18px, 2.2vw, 24px); }
      .coords { margin-bottom: 8px; font-size: 12px; }
      .desc { font-size: 13px; line-height: 1.36; }
      .card-actions { margin-top: 10px; }
      .btn { min-height: 38px; padding: 0 14px; }
    }

#leftRail,
#railContent,
#header,
#card,
#controls {
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

#leftRail,
#railContent {
  background: transparent !important;
}

#header,
#card,
#controls,
#langToggle,
#infoButton {
  background-image: none !important;
}


    @media (max-height: 820px) {
      .card-image-wrap {
        flex-basis: 145px;
        min-height: 60px;
        max-height: 170px;
      }
    }

    @media (max-height: 720px) {
      .card-image-wrap {
        flex-basis: 120px;
        min-height: 48px;
        max-height: 132px;
      }
      .card-body {
        padding: 15px;
      }
      .card-title {
        font-size: clamp(20px, 2.6vw, 28px);
      }
    }

    @media (max-height: 640px) {
      .card-image-wrap {
        flex-basis: 96px;
        min-height: 36px;
        max-height: 104px;
      }
      .card-body {
        padding: 13px;
      }
      .coords {
        margin-bottom: 8px;
      }
      .card-actions {
        margin-top: 12px;
      }
    }


/* Tarjeta compacta para bases no destacadas */
#card.compact {
  max-height: min(60vh, 520px);
}

#card.compact .card-image {
  max-height: 180px;
}

#card.compact .card-image-wrap {
  max-height: 180px;
}

#card.compact .card-body {
  gap: 8px;
}

/* Tarjeta destacada: más presencia, pero sin estirarse */
#card.featured-card {
  max-height: min(68vh, 620px);
}

#card.featured-card .card-image {
  max-height: 220px;
}

#card.featured-card .card-image-wrap {
  max-height: 220px;
}

/* Nodo institucional: permitimos más altura si el texto lo necesita */
#card.node-card {
  max-height: min(74vh, 680px);
}

#card.node-card .card-image-wrap {
  max-height: 150px;
}

#card.node-card .card-image {
  width: 100%;
  height: 150px;
  max-height: 150px;
  object-fit: cover;
}

#card.node-card .card-body {
  gap: 8px;
}

/* Tarjetas largas expandidas */
#card.expanded {
  max-height: min(80vh, 760px);
}

#card.expanded .card-body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 228, 255, 0.18) transparent;
}

/* Mobile */
@media (max-width: 900px) {
  #card {
    max-height: min(68vh, 640px);
  }

  #card.compact {
    max-height: min(52vh, 500px);
  }

  #card.featured-card {
    max-height: min(64vh, 600px);
  }

  #card.node-card {
    max-height: min(72vh, 660px);
  }

  .card-image,
  .card-image-wrap {
    max-height: 210px;
  }

  #card.compact .card-image,
  #card.compact .card-image-wrap {
    max-height: 160px;
  }
}

@media (max-width: 520px) {
  #card {
    max-height: min(66vh, 620px);
  }

  #card.compact {
    max-height: min(48vh, 460px);
  }

  .card-body {
    padding: 16px;
    gap: 8px;
  }

  .card-image,
  .card-image-wrap {
    max-height: 190px;
  }

  #card.compact .card-image,
  #card.compact .card-image-wrap {
    max-height: 145px;
  }
}

@media (max-width: 900px) {
  #card.node-card .card-image-wrap {
    max-height: 136px;
  }

  #card.node-card .card-image {
    height: 136px;
    max-height: 136px;
  }
}

@media (max-width: 520px) {
  #card.node-card .card-image-wrap {
    max-height: 124px;
  }

  #card.node-card .card-image {
    height: 124px;
    max-height: 124px;
  }
}

/* Ajustes finos para nodo institucional */
#card.node-card {
  overflow: hidden;
}

#card.node-card .card-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 8px;
  align-items: center;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

#card.node-card .card-top,
#card.node-card .meta,
#card.node-card .coords,
#card.node-card .desc-wrap,
#card.node-card .desc-toggle {
  grid-column: 1 / -1;
}

#card.node-card #cardLinks {
  grid-column: 1;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  align-self: center;
}

#card.node-card .card-actions {
  grid-column: 2;
  margin-top: 0;
  justify-content: flex-start;
  align-self: center;
}

#card.node-card .contact-link {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

#card.node-card .btn {
  min-height: 44px;
  padding: 0 15px;
}

@media (max-width: 520px) {
  #card.node-card .card-body {
    grid-template-columns: 42px minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 8px;
  }

  #card.node-card .contact-link {
    width: 42px;
    height: 42px;
  }

  #card.node-card .btn {
    min-height: 42px;
    padding: 0 12px;
    font-size: 13px;
  }
}


/* =========================
   UNIFICACIÓN DE ESPACIADO
   Tarjetas / cards
   Reemplazo directo agregado por ChatGPT
   ========================= */

:root {
  --card-space-1: 4px;
  --card-space-2: 8px;
  --card-space-3: 12px;
  --card-space-4: 16px;
  --card-space-5: 20px;
}

/* Ritmo vertical principal */
.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: var(--card-space-3);
}

/* Reset de márgenes verticales que hoy duplican el gap */
.card-top,
.coords,
.desc,
.desc-toggle,
.card-actions,
.contact-links,
.card-title {
  margin-top: 0;
  margin-bottom: 0;
}

/* Encabezado */
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--card-space-3);
}

/* Título */
.card-title {
  line-height: 1.08;
}

/* Coordenadas */
.coords {
  display: flex;
  align-items: center;
  gap: var(--card-space-2);
  font-size: 13px;
  line-height: 1.35;
}

/* Descripción */
.desc {
  line-height: 1.55;
}

/* Botón leer más: un poco más cerca del texto */
.desc-toggle {
  margin-top: calc(var(--card-space-2) * -1);
  align-self: flex-start;
}

/* Links de contacto */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--card-space-2);
  padding-top: var(--card-space-3);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Acciones */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--card-space-2);
  padding-top: 0;
}

/* Mantener misma lógica en compact, featured y node */
#card.compact .card-body,
#card.featured-card .card-body {
  gap: var(--card-space-3);
}

/* Nodo institucional: conservar grid pero con mismo ritmo */
#card.node-card .card-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: var(--card-space-3);
  padding: 18px;
  align-items: start;
}

#card.node-card .card-top,
#card.node-card .meta,
#card.node-card .coords,
#card.node-card .desc-wrap,
#card.node-card .desc-toggle {
  grid-column: 1 / -1;
}

#card.node-card #cardLinks {
  grid-column: 1;
  margin: 0;
  padding-top: 0;
  border-top: 0;
  align-self: start;
}

#card.node-card .card-actions {
  grid-column: 2;
  margin: 0;
  align-self: center;
  justify-content: flex-start;
}

/* Mobile */
@media (max-width: 520px) {
  .card-body {
    padding: 16px;
    gap: var(--card-space-3);
  }

  #card.node-card .card-body {
    grid-template-columns: 42px minmax(0, 1fr);
    column-gap: var(--card-space-2);
    row-gap: var(--card-space-3);
    padding: 16px;
  }
}
