/* Catálogo de Especialidades Médicas — fase 2 */
.esp-catalog { background: #f4f8fa; padding: clamp(36px, 5vw, 70px) 20px; }
.esp-container { max-width: 1220px; margin: 0 auto; }
.esp-top { text-align: center; max-width: 850px; margin: 0 auto 26px; }
.esp-eyebrow { font-size: 11px; color: #237b91; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; margin: 0 0 8px; }
.esp-top h2 { font-size: clamp(27px, 3vw, 38px); color: #133d51; font-weight: 850; line-height: 1.2; margin: 0 0 10px; }
.esp-lead { color: #526c78; font-size: 15px; line-height: 1.65; margin: 0 auto 24px; }
.esp-search-label { display: block; font-size: 12px; font-weight: 700; color: #315567; margin-bottom: 8px; text-align: left; }
.esp-searchbox { display: flex; align-items: center; gap: 12px; background: white; border: 2px solid #c5d9df; border-radius: 13px; padding: 0 14px; box-shadow: 0 7px 18px rgba(8,61,77,.035); }
.esp-searchbox:focus-within { border-color: #2489a0; outline: 3px solid rgba(44,148,171,.13); }
.esp-searchbox svg { width: 21px; height: 21px; flex: 0 0 auto; color: #377e90; }
.esp-searchbox input { width: 100%; font: inherit; min-width: 0; border: 0; outline: none; padding: 15px 0; color: #143d4e; background: transparent; font-size: 15px; }
.esp-searchbox input::placeholder { color: #829ba7; }
.esp-count { text-align: right; color: #557883; font-size: 12px; margin: 9px 3px 0; }
.esp-icon-sprite { position: absolute; overflow: hidden; width: 0; height: 0; pointer-events:none; }
/* Five actual columns at desktop width, expanded across page */
.esp-grid { display: grid; grid-template-columns: repeat(10, minmax(0,1fr)); gap: 13px; }
.esp-card { grid-column: span 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 128px; padding: 15px 9px; border-radius: 16px; border: 1px solid #356b81; background: linear-gradient(145deg, #23647a, #154359); color: #fff; text-decoration: none; text-align: center; box-shadow: 0 4px 13px rgba(13,52,70,.12); transition: transform .16s ease, background .16s ease, box-shadow .16s ease; scroll-margin-top: 95px; }
.esp-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(13,52,70,.2); background: linear-gradient(145deg,#2b8298,#1c596f); }
.esp-card:focus-visible, .esp-toggle-other:focus-visible, .esp-cta:focus-visible { outline: 3px solid #f7b733; outline-offset: 4px; }
.esp-card.is-selected { border-color: #a3eee7; background: linear-gradient(140deg, #2d91a0, #1b667d); box-shadow: 0 0 0 2px rgba(87,198,198,.45), 0 10px 25px rgba(24,83,99,.19); }
.esp-card-icon { display: flex; align-items: center; justify-content: center; width: 43px; height: 43px; border-radius: 12px; color: #adf2ef; background: rgba(190,253,255,.095); }
.esp-card-icon svg, .esp-detail-icon svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.esp-card-label { color: #fff; font-size: clamp(12px,1.16vw,15px); line-height: 1.25; font-weight: 750; overflow-wrap: anywhere; }
.esp-grid:not(.esp-is-filtering) .esp-card:nth-child(16) { grid-column: 4 / span 2; }
.esp-grid:not(.esp-is-filtering) .esp-card:nth-child(17) { grid-column: 6 / span 2; }
.esp-card[hidden], .esp-empty[hidden], .esp-detail[hidden] { display: none !important; }
.esp-empty { background: #fff; color: #244d5e; padding: 20px; border-radius: 12px; margin: 18px 0; text-align: center; }
.esp-toggle-other { display: none; }
.esp-detail { margin: 26px auto 0; padding: clamp(20px,3vw,30px); background: #fff; border: 1px solid #d4e6ea; border-radius: 20px; box-shadow: 0 9px 33px rgba(15,58,77,.08); scroll-margin-top: 102px; }
.esp-detail-header { display: flex; gap: 15px; align-items: center; margin-bottom: 18px; }
.esp-detail-icon { display:flex; align-items:center; justify-content:center; width: 58px; height: 58px; background: #e5f6f7; color: #176d85; border-radius: 15px; }
.esp-detail-icon svg { width: 32px; height: 32px; }
.esp-detail-kicker { font-size: 11px; letter-spacing: .1em; font-weight: 850; text-transform: uppercase; color: #488b9c; margin: 0 0 4px; }
.esp-detail h3 { color: #123c50; font-size: clamp(20px,2.5vw,28px); font-weight: 850; margin:0; }
.esp-detail-cols { display:grid; grid-template-columns:1fr 1fr; gap:26px; }
.esp-detail-cols h4 { color:#163d4e; font-size:14px; font-weight:800; margin:0 0 7px; }
.esp-detail-cols p { color:#4c6570; font-size:14px; line-height:1.65; margin:0; }
.esp-conditions { margin:18px 0 17px; font-size:12px; color:#667f88; line-height:1.6; }
.esp-cta { display:inline-flex; align-items:center; justify-content:center; gap:10px; padding:13px 20px; background:#16728c; color:#fff; font-size:14px; font-weight:800; border-radius:12px; text-decoration:none; transition:background .18s; }
.esp-cta:hover { background:#0e5069; color:#fff; }
@media(max-width:1100px) {
  .esp-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .esp-card { grid-column:auto; }
  .esp-grid:not(.esp-is-filtering) .esp-card:nth-child(16),.esp-grid:not(.esp-is-filtering) .esp-card:nth-child(17) {grid-column:auto;}
  .esp-card-label { font-size: 13px; }
}
@media(max-width:820px) {
  .esp-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media(max-width:680px) {
  .esp-catalog { padding: 34px 16px 56px; }
  .esp-top { text-align: left; margin-bottom: 20px; }
  .esp-lead { font-size: 14px; }
  .esp-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .esp-card { min-height: 106px; border-radius: 13px; padding: 12px 7px; gap: 7px; }
  .esp-card-icon { width: 35px; height: 35px; }
  .esp-card-icon svg { width: 24px; height: 24px; }
  .esp-card-label { font-size: 12px; }
  .esp-card[data-tier="other"] { display: none; }
  .esp-grid.esp-show-all .esp-card[data-tier="other"], .esp-grid.esp-search-active .esp-card[data-tier="other"] { display:flex; }
  .esp-card[hidden] {display:none!important;}
  .esp-toggle-other { display:flex; align-items:center; justify-content:center; gap:12px; width:100%; padding:14px; margin-top:13px; border:1px solid #acd1d9; border-radius:12px; background:#fff; color:#165b70; font:inherit; font-weight:800; font-size:14px; cursor:pointer; }
  .esp-more-icon {font-size:20px; transition:transform .2s; }
  .esp-toggle-other[aria-expanded="true"] .esp-more-icon {transform:rotate(180deg);}
  .esp-toggle-other[hidden] {display:none!important;}
  .esp-count {text-align:left;}
  .esp-detail { margin-top:18px; padding:18px; }
  .esp-detail-cols {grid-template-columns:1fr; gap:16px;}
  .esp-detail-header {gap:12px;}
  .esp-detail-icon {width:48px;height:48px;flex:0 0 auto;}
  .esp-detail-icon svg {width:28px;height:28px;}
  .esp-cta {width:100%;}
}
@media(prefers-reduced-motion:reduce) { .esp-card, .esp-cta, .esp-more-icon {transition:none;} }

/* Evitar saltos visuales al seleccionar especialidades en escritorio.
   El panel se presenta completo en modal fijo, SIN desplazar la página. */
.esp-modal-backdrop[hidden], .esp-detail-close[hidden] { display:none !important; }
@media (min-width: 681px) {
  body.esp-modal-open { overflow: hidden; scrollbar-gutter: stable; }
  .esp-modal-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 11000;
    background: rgba(6, 31, 43, .66);
  }
  .esp-detail:not([hidden]) {
    position: fixed;
    z-index: 11001;
    inset: auto;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(710px, calc(100vw - 52px));
    max-height: calc(100dvh - 52px);
    margin: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 30px;
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(2,29,42,.36);
  }
  .esp-detail-close:not([hidden]) {
    position: absolute;
    right: 15px; top: 13px;
    display: flex;
    align-items:center; justify-content:center;
    width:38px; height:38px;
    border: 1px solid #c8e0e5;
    border-radius: 50%;
    background: #eef8fa;
    color: #174f63;
    font-size: 26px;
    font-weight: 700;
    line-height:1;
    cursor: pointer;
  }
  .esp-detail-close:hover { background: #dceff4; }
  .esp-detail-close:focus-visible { outline: 3px solid #f7b733; outline-offset: 2px; }
  .esp-detail-header { padding-right: 38px; }
}
@media (max-width: 680px) {
  .esp-modal-backdrop { display: none !important; }
  .esp-detail-close { display: none !important; }
}
