/* BASE VARIABLES */
:root {
    --bg-color: #ffffff;
    --bg-secondary-color: #f6f6f6;
    --color-lightGrey: #d2d6dd;
    --color-grey: #747681;
    --color-darkGrey: #3a3a3a;
    --color-error: #d43939;
    --color-success: #28bd14;
    --grid-maxWidth: 120rem;
    --grid-gutter: 2rem;
    --font-size: 1.6rem;
    --font-color: #1a1a1a;
    --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius: 4px;
}

html { box-sizing: border-box; font-size: 62.5%; }
*, :after, :before { box-sizing: inherit; }
body {
    background: var(--bg-color);
    line-height: 1.6;
    font-size: var(--font-size);
    color: var(--font-color);
    font-family: var(--font-family-sans);
    margin: 0;
}
h1, h2, h3, h4, h5, h6 { font-weight: 500; margin: .35em 0 .7em; }
h1 { font-size: 2em; }
h2 { font-size: 1.75em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.25em; }
p { margin-top: 0; }
a { color: var(--color-primary); text-decoration: none; }
a:hover:not(.button) { opacity: .75; }
img { max-width: 100%; }
iframe { border: 0; }
fieldset{display: none;}
.container {
    max-width: var(--grid-maxWidth);
    margin: 0 auto;
    width: 96%;
    padding: 0 calc(var(--grid-gutter) / 2);
}
.row {
    display: flex;
    flex-flow: row wrap;
    justify-content: flex-start;
    margin-left: calc(var(--grid-gutter) / -2);
    margin-right: calc(var(--grid-gutter) / -2);
}
.col { flex: 1; }
.col, [class*=" col-"], [class^="col-"] {
    margin: 0 calc(var(--grid-gutter) / 2) calc(var(--grid-gutter) / 2);
}
.col-12 {
    flex: 0 0 calc(100% - var(--grid-gutter));
    max-width: calc(100% - var(--grid-gutter));
}
.col-6 {
    flex: 0 0 calc(50% - var(--grid-gutter));
    max-width: calc(50% - var(--grid-gutter));
}

/* === UTILIDADES DE LAYOUT — bariatric landing === */

/* Sections — padding base y variantes */
.section        { padding: 3rem 0; }

/* Fondos */
.bg-secondary   { background: var(--bg-secondary-color); }
.bg-primary     { background: var(--color-primary); }

/* Encabezado de sección centrado */
.section-header { text-align: center; margin-bottom: 3rem; }

@media (max-width: 599px) {
    .container { width: 100%; }
    .col-6, .col, [class*="col-"], [class^="col-"] { flex: 0 1 100%; max-width: 100%; }
}

@media (min-width: 900px) {
    .col-6-md { flex: 0 0 calc(50% - var(--grid-gutter)); max-width: calc(50% - var(--grid-gutter)); }
    .col-4-md { flex: 0 0 calc(33.333% - var(--grid-gutter)); max-width: calc(33.333% - var(--grid-gutter)); }
    .col-8-md { flex: 0 0 calc(66.666% - var(--grid-gutter)); max-width: calc(66.666% - var(--grid-gutter)); }
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select, textarea {
    font-family: inherit;
    padding: .8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-lightGrey);
    font-size: 1em;
    min-height: 48px;
    transition: all .2s ease;
    display: block;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 1px var(--color-primary);
}
@media (max-width: 599px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
    select, textarea { font-size: 16px; }
}
label { display: block; margin-bottom: .4rem; font-weight: 500; }

.button, [type="button"], [type="submit"], button {
    padding: 1rem 2.5rem;
    color: var(--color-darkGrey);
    background: var(--color-lightGrey);
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: var(--font-size);
    line-height: 1;
    text-align: center;
    transition: opacity .2s ease;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    font-weight: 600;
    min-height: 44px;
}
.button:hover { opacity: .8; }
.button.primary, [type="submit"] { color: #fff; background-color: var(--color-primary); }
.button.primary:hover { background-color: var(--color-primary-dark); opacity: 1; }
.button.outline { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.button.outline:hover { background: var(--color-primary); color: #fff; opacity: 1; }

.card { padding: 1.5rem 2rem; border-radius: var(--radius); background: var(--bg-color); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.text-primary  { color: var(--color-primary) !important; }
.text-center   { text-align: center; }
.text-grey     { color: var(--color-grey); }
.bg-dark       { background-color: var(--color-grey) !important; color: #fff; }
.is-full-width { width: 100% !important; }
.is-vertical-align { display: flex; align-items: center; }
.hide-xs       { display: none !important; }
@media (min-width: 600px) { .hide-xs { display: block !important; } }

/* YOUTUBE LAZY */
.youtube-video { position: relative; background: var(--bg-secondary-color); cursor: pointer; overflow: hidden; border-radius: var(--radius); aspect-ratio: 9 / 16; }
.youtube-video img { width: 100%; height: 100%; object-fit: cover; display: block; }
.youtube-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play-button { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.3); transition: background .2s; z-index: 2; }
.youtube-video:hover .play-button { background: rgba(0,0,0,.5); }
.play-button svg { width: 68px; height: 48px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); transition: transform .2s; }
.youtube-video:hover .play-button svg { transform: scale(1.05); }

/* YouTube con picture element - FIX vertical */
.youtube-video picture {   position: absolute;  inset: 0;  width: 100%;   height: 100%;  display: block;}
.youtube-video picture img {   width: 100%;   height: 100%;   object-fit: fill;   display: block;}

/* --- NUEVO --- */
.youtube-video.ratio-vertical { aspect-ratio: 9 / 16; }
.youtube-video.ratio-horizontal { aspect-ratio: 16 / 9; }
/* Vertical sin recorte - muestra la imagen completa */
.youtube-video.ratio-vertical picture img {  object-fit: contain;  background: var(--bg-secondary-color);}

@media (min-width: 768px) { 
  /* tu comportamiento actual, pero solo si NO fuerzas una clase */
  .youtube-video:not(.ratio-vertical):not(.ratio-horizontal) { aspect-ratio: 16 / 9; }
}

/* TABS CSS */
.tabs { display: flex; flex-wrap: wrap; gap: .2rem; border-bottom: 2px solid var(--color-lightGrey); margin-bottom: 2rem; }
.tabs > details { flex: 1; min-width: 120px; }
.tabs summary { list-style: none; padding: 1.2rem; background: var(--bg-secondary-color); cursor: pointer; text-align: center; font-weight: 600; border-radius: var(--radius) var(--radius) 0 0; transition: background .2s; }
.tabs summary::-webkit-details-marker { display: none; }
.tabs details[open] summary { background: var(--color-primary); color: #fff; }
.tabs details > div { padding: 2rem; background: var(--bg-color); border: 1px solid var(--color-lightGrey); border-top: 0; display: none; }
.tabs details[open] > div { display: block; }

/* ACCORDION */
.accordion details { border: 1px solid var(--color-lightGrey); border-radius: var(--radius); margin-bottom: .5rem; overflow: hidden; background: var(--bg-color); }
.accordion summary { padding: 1.5rem; cursor: pointer; font-weight: 600; display: flex; justify-content: space-between; align-items: center; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: '+'; color: var(--color-primary); font-size: 1.8rem; line-height: 1; transition: transform .2s; flex-shrink: 0; }
.accordion details[open] summary::after { transform: rotate(45deg); }
.accordion details p { padding: 0 1.5rem 1.5rem; margin: 0; color: var(--color-grey); }

/* GALLERY + LIGHTBOX */
.gallery-3x3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; }
.gallery-3x3 a { display: block; aspect-ratio: 1; overflow: hidden; }
/* Imágenes de galería: loading="lazy" decoding="async" en el HTML */
.gallery-3x3 img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery-3x3 a:hover img { transform: scale(1.05); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; padding: 1rem; }
.lightbox:target { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: var(--radius); }
.lightbox-close { position: absolute; top: 1.5rem; right: 1.5rem; color: #fff; font-size: 3rem; text-decoration: none; width: 44px; height: 44px; display: grid; place-items: center; line-height: 1; }

/* INFINITE SCROLLER - VERSIÓN CORREGIDA */
.scroller {overflow: hidden; mask: linear-gradient(90deg,transparent,#000 10%,#000 90%,transparent);-webkit-mask: linear-gradient(90deg,transparent,#000 10%,#000 90%,transparent); padding: 1rem 0; }
.scroller-track { display: flex; gap: 3rem; width: max-content;  animation: scroll-loop 30s linear infinite; will-change: transform; }
.scroller:hover .scroller-track {     animation-play-state: paused; }
.scroller-track img {  height: 60px; width: 120px; object-fit: contain; opacity: .7; transition: opacity .2s; flex-shrink: 0; }
.scroller-track img:hover {     opacity: 1; }
@keyframes scroll-loop { from { transform: translateX(0); }  to { transform: translateX(-50%); } }

/* CARDS PRECIO */
.card.price { text-align: center; padding: 2rem; background: var(--bg-color); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.1); height: 100%; }
.card.price img { width: 66px; height: auto; margin: 0 auto 1rem; display: block; }
.card.price h3 { color: var(--color-primary); margin-bottom: .5rem; }
.card.price .price { font-size: 2.4rem; font-weight: 700; color: var(--font-color); margin: 1rem 0; }

/* WHATSAPP FLOAT
   FIX #17: max() con env(safe-area-inset-bottom) para iPhones con notch/Dynamic Island.
   Sin este fix el botón queda tapado por el indicador de home en iOS. */
.whatsapp-float {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    right: 16px;
    z-index: 100;
    width: 72px;
    height: 72px;
    background: #25D366;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: transform .2s;
    animation: wa-pulse 2s infinite;
}
.whatsapp-float:hover { transform: scale(1.1); }
@keyframes wa-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,.2); }
    50%       { box-shadow: 0 4px 20px rgba(37,211,102,.4); }
}
/* === NAV SYSTEM - Mobile First === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-color);
  border-bottom: 1px solid var(--color-lightGrey);
  height: 56px;
}

.nav > .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 1rem;
}

/* Mobile base - hamburger visible */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: -0.5rem;
  flex-shrink: 0;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--font-color);
  position: relative;
}
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: '';
  position: absolute;
  left: 0;
}
.nav-toggle-label span::before { top: -6px; }
.nav-toggle-label span::after { top: 6px; }

/* Brand - izquierda en mobile */
.nav-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.nav.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--font-color);
  text-decoration: none;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
}
.nav.brand img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}
.nav.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Menu - oculto en mobile */
.nav-center {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  flex-direction: column;
  border-top: 1px solid var(--color-lightGrey);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.nav-toggle:checked ~ .nav-center {
  display: flex;
}
.nav-center a {
  padding: 1.2rem 1.5rem;
  color: var(--color-darkGrey);
  text-decoration: none;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--color-lightGrey);
}
.nav-center a:last-child { border-bottom: 0; }
.nav-center a:hover { background: var(--bg-secondary-color); }

/* CTA Button - derecha en mobile */
.nav-right {
  gap:.4rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 1.2rem;
  font-size: 1.4rem;
  font-weight: 600;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  border: 0;
}
.nav .button:hover {
  background: var(--color-primary-dark);
}

/* === DESKTOP - 900px+ === */
@media (min-width: 900px) {
  .nav { height: 68px; }
  
  .nav-toggle-label { display: none; }
  
  .nav-left { flex: 0 0 auto; }
  .nav .brand { font-size: 1.8rem; }
  .nav .brand img { height: 65px; }
  
  .nav-center {
    display: flex;
    position: static;
    flex-direction: row;
    flex: 1;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .nav-center a {
    padding: 0.7rem 1.2rem;
    border: 0;
    border-radius: var(--radius);
    font-size: 1.5rem;
  }
  .nav-center a:hover {
    background: var(--bg-secondary-color);
  }
  
  .nav-right { flex: 0 0 auto; }
  .nav .button {
    height: 40px;
    padding: 0 1.6rem;
    font-size: 1.5rem;
  }
}