* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* overflow-x:hidden as fallback, clip where supported — neither allows horizontal scroll */
html { overflow-x: hidden; overflow-x: clip; }
body { margin: 0; background: #FFFFFF; color: #14161B; font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; overflow-x: clip; }

/* centered page container — never wider than the viewport */
.byd-container { max-width: 1240px; width: 100%; margin-inline: auto; }

/* metallic-black accent (replaces the former electric blue) */
#bydRoot {
  --accent: #23262D;
  --accent-grad: linear-gradient(158deg, #454b55 0%, #20232a 40%, #121317 72%, #2f333b 100%);
}

/* primary filled buttons: brushed metallic black — stays legible on light
   AND on the dark Gama / Test-drive sections (a flat near-black would vanish). */
.btn-metal {
  background: var(--accent-grad, linear-gradient(158deg, #454b55 0%, #20232a 40%, #121317 72%, #2f333b 100%));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 10px 26px rgba(15, 17, 21, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #fff;
  transition: filter .25s ease, transform .25s ease, box-shadow .25s ease;
}
.btn-metal:hover { filter: brightness(1.12); }

/* ---- mobile nav menu ---- */
/* "Menú" button: hidden on desktop, matches the nav links' type + color */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #6B7280;
  background: transparent;
  border: 1px solid rgba(20, 22, 27, 0.12);
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { color: #14161B; }

/* glass drawer dropped under the nav; top is set to nav height by JS */
.nav-drawer {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 62px;
  z-index: 49;
  padding: 10px clamp(20px, 5vw, 64px) 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid rgba(20, 22, 27, 0.06);
  box-shadow: 0 18px 40px rgba(20, 22, 27, 0.10);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .28s ease, transform .28s ease;
}
.nav-drawer a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 4px 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: #6B7280;
  text-decoration: none;
  border-bottom: 1px solid rgba(20, 22, 27, 0.06);
}
.nav-drawer a.nav-drawer-cta {
  justify-content: center;
  min-height: 52px;
  margin-top: 16px;
  color: #fff;
  font-weight: 600;
  background: var(--accent-grad, linear-gradient(158deg, #454b55 0%, #20232a 40%, #121317 72%, #2f333b 100%));
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(15, 17, 21, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

@media (max-width: 768px) {
  .nav-links { display: none !important; }   /* overrides inline display:flex */
  .nav-toggle { display: inline-flex; }
}
@media (min-width: 769px) {
  /* desktop is untouched: never show the button or drawer */
  .nav-toggle { display: none !important; }
  .nav-drawer { display: none !important; }
}

/* ---- hero pin ----
   The DOM is identical in both modes. Desktop = tall scroll track + sticky,
   clipped stage with the model layers stacked absolutely. Mobile = the same
   nodes laid out in normal flow (a logo screen, then stacked model cards).
   No JS ever moves a node; only these media queries change the layout. */
#hero { position: relative; z-index: 1; height: 540dvh; }
#heroStage {
  position: sticky; top: 0;
  height: 100dvh; width: 100%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#modelDeck {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
#modelDeck [data-modelframe] { position: relative; width: 100%; height: 100%; overflow: hidden; }

/* On phones the screen stays full-bleed like desktop, but a portrait viewport
   would crop the landscape car photos to a slice. So we fill the screen with a
   blurred, darkened copy of the same shot (--shot, set in JS) and lay the whole
   car on top with object-fit:contain — full-screen impact, never "broken". */
@media (max-width: 768px) {
  #modelDeck [data-modelframe] { border-radius: 0; }
  /* blurred backdrop fill */
  #modelDeck [data-modelframe]::before {
    content: ""; position: absolute; inset: 0; z-index: 0;
    background-image: var(--shot); background-size: cover; background-position: center;
    filter: blur(34px) saturate(1.15) brightness(0.5);
    transform: scale(1.2);
  }
  /* the real photo, whole car visible, sitting in the upper area */
  #modelDeck [data-modelframe] > img {
    object-fit: contain !important;
    z-index: 1;
    padding: 12vh 18px 30vh;
  }
  /* darken the lower area for the text */
  #modelDeck [data-modelframe] > div:not([data-modelname]) {
    z-index: 2; height: 52% !important;
    background: linear-gradient(to top, rgba(8,10,14,0.92), rgba(8,10,14,0.55) 42%, rgba(8,10,14,0)) !important;
  }
  #modelDeck [data-modelname] { left: 24px !important; right: 24px !important; bottom: clamp(34px, 7vh, 70px) !important; z-index: 3; }
  #modelDeck [data-modelname] > div:first-child { font-size: clamp(30px, 8.4vw, 46px) !important; line-height: 1.04; }
  #modelDeck .model-desc { max-width: 100% !important; }
}

@keyframes bydBreathe {
  0%   { transform: rotateX(4deg) rotateY(-6deg) scale(1); }
  50%  { transform: rotateX(-3deg) rotateY(6deg) scale(1.015); }
  100% { transform: rotateX(4deg) rotateY(-6deg) scale(1); }
}
@keyframes bydBob { 0%,100% { transform: translateY(0); opacity:.9 } 50% { transform: translateY(9px); opacity:.4 } }
@keyframes bydSheen { 0% { transform: translateX(-130%); } 100% { transform: translateX(230%); } }
@keyframes bydAurora { 0% { transform: translate3d(-2%,-1%,0) scale(1.04) rotate(-1deg); } 100% { transform: translate3d(3%,2%,0) scale(1.16) rotate(1.5deg); } }

/* ============================================================
   MODEL GALLERY LIGHTBOX
   Click a Gama card → the image expands into a glass lightbox
   showing every photo of that model. Shared-element (FLIP) open.
   ============================================================ */

/* reserve the scrollbar gutter so locking scroll never shifts layout */
html { scrollbar-gutter: stable; }
html.gal-lock, body.gal-lock { overflow: hidden !important; }

/* --- card affordance: the whole image becomes a "view gallery" button --- */
.gal-open {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  background: transparent; border: 0; padding: 0; margin: 0;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.gal-open:focus-visible { outline: 2px solid var(--accent, #23262D); outline-offset: -3px; }
.modelcard__more {
  position: absolute; z-index: 3; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(20, 22, 27, 0.55); color: #fff;
  font-family: 'Inter', system-ui, sans-serif; font-size: 12px; font-weight: 600;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  opacity: 0.92; transition: transform .4s cubic-bezier(.2,.7,.2,1), opacity .3s ease;
}
[data-modelcard]:hover .modelcard__more { transform: translateY(-2px); opacity: 1; }

/* --- overlay --- */
.gal { position: fixed; inset: 0; z-index: 120; display: none; }
.gal.is-open { display: flex; align-items: center; justify-content: center; padding: clamp(12px, 3vw, 40px); }
.gal__backdrop {
  position: absolute; inset: 0;
  background: rgba(13, 15, 19, 0.55);
  backdrop-filter: blur(10px) saturate(1.1); -webkit-backdrop-filter: blur(10px) saturate(1.1);
  opacity: 0; transition: opacity .4s ease;
}
.gal.is-shown .gal__backdrop { opacity: 1; }

.gal__panel {
  position: relative; z-index: 1;
  width: min(1080px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(20, 22, 27, 0.34);
  opacity: 0; transition: opacity .4s ease;
}
.gal.is-shown .gal__panel { opacity: 1; }

.gal__close {
  position: absolute; top: 14px; right: 14px; z-index: 6;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.82); border: 1px solid rgba(20, 22, 27, 0.08);
  color: #14161B; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s ease, transform .2s ease;
}
.gal__close:hover { background: #fff; transform: rotate(90deg); }

.gal__head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px clamp(18px, 3vw, 28px);
  padding-right: 66px; /* clear the close button */
  border-bottom: 1px solid rgba(20, 22, 27, 0.07);
}
.gal__title { margin: 0; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: clamp(20px, 2.4vw, 28px); letter-spacing: -0.02em; color: #14161B; }
.gal__badge { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent, #23262D); background: rgba(35, 38, 45, 0.08); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }

/* image + details sit side-by-side on desktop, stacked on mobile */
.gal__body { display: flex; min-height: 0; height: clamp(300px, 58vh, 600px); }
.gal__stage {
  position: relative; flex: 1 1 auto; min-width: 0;
  background: #0d0f13; overflow: hidden;
}
.gal__details {
  flex: 0 0 300px; min-height: 0;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px clamp(18px, 2.4vw, 26px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.5);
  border-left: 1px solid rgba(20, 22, 27, 0.07);
}
.gal__desc { margin: 0; font-family: 'Inter', system-ui, sans-serif; font-size: 14.5px; line-height: 1.62; color: #4a4f57; }
.gal__specs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.gal__specs li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid rgba(20, 22, 27, 0.07);
}
.gal__specs li:last-child { border-bottom: 0; }
.gal__specs .k { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: #6B7280; }
.gal__specs .v { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; color: #14161B; text-align: right; }
.gal__imgwrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gal__img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  opacity: 0; transition: opacity .35s ease;
}
.gal__img.is-ready { opacity: 1; }

.gal__nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 4;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.85); border: 1px solid rgba(20, 22, 27, 0.06);
  color: #14161B; cursor: pointer; box-shadow: 0 8px 24px rgba(20, 22, 27, 0.22);
  transition: background .2s ease, transform .2s ease;
}
.gal__nav:hover { background: #fff; }
.gal__prev { left: 14px; }
.gal__next { right: 14px; }
.gal__prev:hover { transform: translateY(-50%) translateX(-2px); }
.gal__next:hover { transform: translateY(-50%) translateX(2px); }

.gal__counter {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 4;
  font-family: 'Inter', system-ui, sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: #fff; background: rgba(20, 22, 27, 0.5); padding: 5px 12px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.gal__thumbs {
  display: flex; gap: 10px; padding: 14px clamp(14px, 3vw, 22px);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
}
.gal__thumb {
  flex: 0 0 auto; width: 88px; height: 58px; padding: 0;
  border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: #eef0f3; opacity: 0.55;
  transition: opacity .25s ease, border-color .25s ease, transform .25s ease;
}
.gal__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal__thumb:hover { opacity: 1; transform: translateY(-2px); }
.gal__thumb.is-active { opacity: 1; border-color: var(--accent, #23262D); }

/* the flying clone used for the expand/collapse transition */
.gal__flyer {
  position: fixed; z-index: 130; display: none;
  object-fit: cover; overflow: hidden;
  box-shadow: 0 40px 120px rgba(20, 22, 27, 0.34);
  pointer-events: none;
  transition: top .45s cubic-bezier(.2,.7,.2,1), left .45s cubic-bezier(.2,.7,.2,1),
              width .45s cubic-bezier(.2,.7,.2,1), height .45s cubic-bezier(.2,.7,.2,1),
              border-radius .45s cubic-bezier(.2,.7,.2,1), opacity .3s ease;
}

/* --- mobile: stacked viewer (image, then details, then thumbs) --- */
@media (max-width: 768px) {
  .gal.is-open { padding: 12px; }
  .gal__panel { width: 100%; height: auto; max-height: calc(100% - 24px); border-radius: 22px; }
  .gal__body { flex-direction: column; height: auto; }
  .gal__stage { height: clamp(200px, 38vh, 340px); flex: 0 0 auto; }
  .gal__details {
    flex: 1 1 auto; max-height: 28vh;
    border-left: 0; border-top: 1px solid rgba(20, 22, 27, 0.07);
    padding: 16px 18px; gap: 13px;
  }
  .gal__head { padding: 15px 18px; padding-right: 58px; }
  .gal__nav { width: 40px; height: 40px; }
  .gal__prev { left: 8px; }
  .gal__next { right: 8px; }
  .gal__thumb { width: 74px; height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .gal__backdrop, .gal__panel, .gal__img, .gal__flyer, .modelcard__more, .gal__close, .gal__nav { transition: none !important; }
}
