:root {
  --primary: #193C64;
  --primary-rgb: 25, 60, 100;
  --bg: #f8f9fa;
  --text: #212529;
  --text-light: #6c757d;
  --white: #ffffff;
  --shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Colores de especialidades */
  --color-salud: #0ea5e9;
  --color-proteccion: #3b82f6;
  --color-ahorro: #10b981;
  --color-inversion: #8b5cf6;
  --color-estudios: #f59e0b;
  --color-retiro: #f43f5e;
  --color-autos: #64748b;
  --color-casas: #14b8a6;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  min-height: 100vh;
  padding-bottom: 80px;
}

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* Layout principal */
.main-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card-container {
  width: 100%;
  max-width: 1250px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.card {
  display: flex;
  flex-direction: column-reverse;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

@media (min-width: 992px) {
  .main-section {
    height: 100vh;
    max-height: 100vh;
    min-height: 0;
    overflow: hidden;
    padding: 1rem;
  }

  .card {
    flex-direction: column;
    height: 100%;
    display: grid;
    grid-template-columns: 30px 1fr 45%;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "edge info photo"
      "footer footer footer";
    width: 100%;
  }

  .card-info {
    grid-area: info;
  }

  .card-photo {
    grid-area: photo;
  }

  .footer-bar {
    grid-area: footer;
  }
}

.card-info {
  flex: 1;
  padding: 0;
}

.card-edge {
  background: var(--primary);
  width: 100%;
  height: 30px;
  flex-shrink: 0;
}

@media (min-width: 992px) {
  .card-edge {
    grid-area: edge;
    width: 30px;
    height: 100%;
  }

  .card-info {
    height: 100%;
    overflow-y: auto; /* Enable scrolling for right pane */
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  
  .home-header {
    padding: 2.5rem 2.5rem 1rem 2.5rem;
  }
  
  .home-scrollable {
    padding: 1.5rem 2.5rem 2.5rem 2.5rem;
  }
  
  .view-header {
    padding: 2.5rem 2.5rem 1.5rem 2.5rem;
  }
  
  .detailed-content {
    padding: 1.5rem 2.5rem 2.5rem 2.5rem;
  }
  
  /* Scrollbar styling for card-info */
  .card-info::-webkit-scrollbar {
    width: 6px;
  }
  .card-info::-webkit-scrollbar-track {
    background: transparent;
  }
  .card-info::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.2);
    border-radius: 10px;
  }
  .card-info::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.4);
  }
}

@media (min-width: 992px) {
  .card-info .specialties-grid {
    margin-bottom: 1.25rem;
  }

  .card-info .name-block {
    margin-bottom: 0.75rem;
  }

  .card-info .title-badge {
    margin-bottom: 1rem;
  }

  .first-name {
    font-size: 2.6rem;
  }

  .last-name {
    font-size: 1.6rem;
  }
}

@media (max-width: 991px) {
  .card {
    padding-bottom: 84px;
  }
}

.card-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: 0 0 auto;
}

.card-photo img {
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: cover;
}

@media (min-width: 992px) {
  .card-photo {
    align-self: stretch;
    padding: 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    background: var(--bg);
  }

  .card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
    display: block;
  }
}

/* Nombre */
.name-block {
  text-align: center;
  margin-bottom: 1rem;
}

.first-name {
  display: block;
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 4px solid var(--primary);
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
}

.last-name {
  display: block;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text);
}

@media (max-width: 576px) {
  .first-name {
    font-size: 2.2rem;
  }
  .last-name {
    font-size: 1.3rem;
  }
}

/* Titulo */
.title-badge {
  text-align: center;
  margin-bottom: 1.5rem;
}

.title-badge h2 {
  display: inline-block;
  color: var(--white);
  background-color: var(--primary);
  padding: 0.35rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 500;
}

/* Especialidades */
.specialist-heading {
  text-align: center;
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.intro-text {
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 0.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.specialties-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 576px) {
  .specialties-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@property --sweep-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.specialty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--white);
  border: 1px solid rgba(var(--card-rgb, 0,0,0), 0.3); /* Border color using the card's specific rgb */
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow var(--transition), background var(--transition);
  text-decoration: none;
  color: var(--text);
  position: relative;
}

.specialty-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius) + 1px);
  padding: 2px;
  background: conic-gradient(
    from 0deg, 
    rgba(var(--card-rgb), 1) 0deg, 
    rgba(var(--card-rgb), 1) var(--sweep-angle), 
    transparent var(--sweep-angle), 
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: --sweep-angle 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  z-index: 1;
}

.specialty-card:hover, .specialty-card:focus-visible {
  box-shadow: 0 0.5rem 1.5rem rgba(var(--card-rgb), 0.15);
  background: linear-gradient(to bottom right, rgba(var(--card-rgb), 0.05), var(--white));
  outline: none;
}

.specialty-card:hover::before, .specialty-card:focus-visible::before {
  opacity: 1;
  --sweep-angle: 360deg;
}

.specialty-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(var(--card-rgb, var(--primary-rgb)), 0.1);
  color: var(--card-color, var(--primary));
  margin-bottom: 0.75rem;
  transition: background var(--transition), color var(--transition);
}

.specialty-card-icon .bi {
  font-size: 24px;
}

.specialty-card-content h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

.specialty-card-content p {
  display: none;
}

/* Colores dinámicos */
.border-salud { --card-color: var(--color-salud); --card-rgb: 14, 165, 233; }
.border-proteccion { --card-color: var(--color-proteccion); --card-rgb: 59, 130, 246; }
.border-ahorro { --card-color: var(--color-ahorro); --card-rgb: 16, 185, 129; }
.border-inversion { --card-color: var(--color-inversion); --card-rgb: 139, 92, 246; }
.border-estudios { --card-color: var(--color-estudios); --card-rgb: 245, 158, 11; }
.border-retiro { --card-color: var(--color-retiro); --card-rgb: 244, 63, 94; }
.border-autos { --card-color: var(--color-autos); --card-rgb: 100, 116, 139; }
.border-casas { --card-color: var(--color-casas); --card-rgb: 20, 184, 166; }

/* Highlight Card */
.specialty-card--highlight {
  grid-column: 1 / -1;
  flex-direction: row;
  text-align: left;
  padding: 1.5rem;
  background: linear-gradient(to right, rgba(var(--card-rgb), 0.05), transparent);
  border-color: rgba(var(--card-rgb), 0.4);
}

.specialty-card--highlight .specialty-card-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 0;
  margin-right: 1.25rem;
  flex-shrink: 0;
}

.specialty-card--highlight .specialty-card-icon .bi {
  font-size: 30px;
}

.specialty-card--highlight .specialty-card-content {
  flex: 1;
}

.specialty-card--highlight .specialty-card-content h4 {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.specialty-card--highlight .specialty-card-content p {
  display: block;
  font-size: 0.9rem;
  color: var(--text-light);
  margin: 0;
}

.arrow-icon {
  margin-left: 1rem;
  color: var(--card-color);
  opacity: 0;
  transform: translateX(-10px);
  transition: all var(--transition);
}

.specialty-card--highlight:hover .arrow-icon {
  opacity: 1;
  transform: translateX(0);
}

/* Contacto */
.contact-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .contact-row {
    flex-direction: column;
    text-align: center;
  }
}

.logo {
  width: 100px;
  height: auto;
  padding-right: 10px;
  margin-right: 10px;
  border-right: 2px solid #ccc;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .logo {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
  }
}

.contact-data h4 {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
}

.contact-data h4 a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  margin: 0.15rem 0;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.contact-data h4 a:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.contact-data h5 {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.contact-data h5 a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem;
  margin: 0.15rem 0;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.contact-data h5 a:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.save-contact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  margin-top: 0.25rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.save-contact:hover {
  background: rgba(var(--primary-rgb), 0.08);
}

.save-contact .bi {
  font-size: 16px;
}

@media (max-width: 991px) {
  .save-contact {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    background: var(--primary);
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
    transition: background var(--transition), box-shadow var(--transition);
  }

  .save-contact:hover {
    background: #0f2a4a;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
  }

  .save-contact .bi {
    font-size: 18px;
  }
}

/* Footer */
.footer-bar {
  background: var(--primary);
  padding: 0.5rem 1rem;
}

@media (max-width: 991px) {
  .footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }
}

.footer-actions {
  display: flex;
  justify-content: center;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

@media (min-width: 992px) {
  .footer-bar {
    padding: 0.4rem 0;
  }

  .footer-actions {
    flex-direction: row;
    font-size: 0.85rem;
  }
}

.footer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--white);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.footer-btn:hover,
.footer-btn:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.footer-btn .bi {
  font-size: 24px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.is-open {
  display: flex;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #dee2e6;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-header--dark {
  background: var(--primary);
  border-bottom: none;
}

.modal-header--dark h2 {
  color: var(--white);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: inherit;
  transition: background var(--transition);
  flex-shrink: 0;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(0, 0, 0, 0.1);
  outline: none;
}

.modal-header--dark .modal-close {
  color: var(--white);
}

.modal-close .bi {
  font-size: 20px;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal-body p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: 50px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  color: var(--white);
  background: var(--primary);
  border-color: var(--white);
}

.btn--primary:hover {
  background: #0f2a4a;
}

.btn--secondary {
  color: var(--white);
  background: var(--primary);
}

.btn--secondary:hover {
  background: #0f2a4a;
}

/* Botones dentro de modales: ancho estandarizado y uniforme */
.modal-footer {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #dee2e6;
}

.modal-footer .btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 180px;
  padding: 0.6rem 1rem;
  text-align: center;
  height: 42px;
  line-height: 1;
  box-sizing: border-box;
}

.modal-footer a.btn,
.modal-footer button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 480px) {
  .modal-footer .btn {
    max-width: none;
  }
}

/* Compartir */
.share-heading {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.5rem !important;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  color: var(--white);
  transition: opacity var(--transition);
}

.share-btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.share-btn .bi {
  font-size: 28px;
}

.share-btn--facebook { background: #4c66a4; }
.share-btn--twitter { background: #55acee; }
.share-btn--linkedin { background: #0077b5; }
.share-btn--whatsapp { background: #25D366; }

/* Contacto modal */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 300px;
  margin: 0 auto;
}

.contact-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  transition: background var(--transition), color var(--transition);
}

.contact-icon-btn:hover {
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
}

.contact-icon-btn .bi {
  font-size: 32px;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Body scroll lock when modal is open */
body.modal-open {
  overflow: hidden;
}

/* -------------------------------------
   Detailed View (Gastos Médicos Mayores)
-------------------------------------- */
.home-header {
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.home-scrollable {
  padding: 1.5rem 1.5rem 2rem 1.5rem;
}

.view-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-light);
  transition: color var(--transition);
}

.back-button:hover {
  color: var(--primary);
  text-decoration: none;
}

.detailed-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem 1.5rem;
}

.detailed-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detailed-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(var(--card-rgb, var(--primary-rgb)), 0.1);
  color: var(--card-color, var(--primary));
}

.detailed-icon .bi {
  font-size: 28px;
}

.detailed-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: 1.2;
}

@media (min-width: 992px) {
  .detailed-header h1 {
    font-size: 1.75rem;
  }
}

.detailed-hero-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.detailed-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

.detailed-text h3 {
  color: var(--primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.detailed-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}

.detailed-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.detailed-list li .bi {
  color: var(--color-salud);
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.detailed-cta {
  margin-top: 3rem;
  text-align: center;
}

.btn--large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
}

/* -------------------------------------
   View Transitions
-------------------------------------- */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
}

::view-transition-old(card-photo),
::view-transition-new(card-photo),
::view-transition-old(footer-bar),
::view-transition-new(footer-bar),
::view-transition-old(card-edge),
::view-transition-new(card-edge) {
  animation: none;
  mix-blend-mode: normal;
}