/* XPENG Elite — container-relative gallery. Widths are percentages of the
   actual gallery parent, never the browser viewport. */
.xp-detail-main .xp-model-page-shell > .xe-gallery-host,
.xp-detail-main .xe-gallery-host {
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  flex:0 0 100%!important;
  align-self:stretch!important;
  justify-self:stretch!important;
  grid-column:1 / -1!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
}
.xp-detail-main .xe-gallery-host > .wp-block-shortcode,
.xp-detail-main .xe-gallery-host .wp-block-shortcode {
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
  overflow:visible!important;
}
.xp-detail-main .xe-gallery-host .xe-gallery,
body.single-xpeng_model .xe-gallery,
body.page-template-model-detail .xe-gallery {
  display:block!important;
  box-sizing:border-box!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  container-name:xe-gallery;
  container-type:inline-size;
  margin:clamp(42px,5vw,72px) 0 clamp(52px,6vw,86px);
  padding:clamp(22px,2.4vw,34px) 0 0;
  border-top:1px solid #dedede;
  overflow:visible;
}
.xe-gallery *,
.xe-gallery *::before,
.xe-gallery *::after { box-sizing:border-box; }
.xe-gallery-header {
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:24px;
  width:100%;
  margin:0 0 20px;
}
.xe-gallery-heading-copy { min-width:0; }
.xe-gallery-eyebrow {
  margin:0 0 8px!important;
  color:#555;
  font-size:10px!important;
  font-weight:800;
  line-height:1.3;
  letter-spacing:.15em;
  text-transform:uppercase;
}
.xe-gallery-heading-copy h2 {
  margin:0!important;
  color:#111;
  font-size:clamp(30px,3.6vw,52px)!important;
  font-weight:680;
  line-height:1.02;
  letter-spacing:-.06em;
}
.xe-gallery-total {
  flex:0 0 auto;
  padding-bottom:5px;
  color:#696969;
  font-size:9px;
  font-weight:800;
  letter-spacing:.15em;
  white-space:nowrap;
}
.xe-gallery-tabs {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 16px;
}
.xe-gallery-tab {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-height:42px;
  padding:9px 15px;
  border:1px solid #dedede;
  border-radius:4px;
  background:#fff;
  color:#191919;
  font:inherit;
  font-size:11px;
  font-weight:750;
  line-height:1;
  cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease,color .16s ease;
}
.xe-gallery-tab span { color:inherit; opacity:.62; font-size:9px; font-variant-numeric:tabular-nums; }
.xe-gallery-tab:hover { border-color:#999; }
.xe-gallery-tab.is-active { border-color:#111; background:#111; color:#fff; }
.xe-gallery-tab:focus-visible,
.xe-gallery-lead:focus-visible,
.xe-gallery-tile:focus-visible,
.xe-gallery-close:focus-visible,
.xe-gallery-nav:focus-visible,
.xe-gallery-preview-thumb:focus-visible {
  outline:3px solid #b4ff00;
  outline-offset:3px;
}
.xe-gallery-panel[hidden] { display:none!important; }
.xe-gallery-layout {
  display:flex!important;
  flex-flow:row nowrap;
  align-items:stretch;
  justify-content:space-between;
  gap:1%;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:480px;
  height:auto;
  margin:0!important;
  padding:0!important;
}
.xe-gallery-layout > .xe-gallery-lead {
  position:relative;
  display:block!important;
  flex:0 0 62%;
  align-self:stretch;
  box-sizing:border-box;
  width:62%!important;
  max-width:62%!important;
  min-width:0!important;
  min-height:480px;
  height:auto;
  aspect-ratio:1.58;
  padding:0;
  border:0;
  border-radius:5px;
  overflow:hidden;
  background:#e8e8e8;
  cursor:zoom-in;
  text-align:left;
  isolation:isolate;
}
.xe-gallery-lead > img {
  position:absolute;
  inset:0;
  z-index:0;
  display:block;
  width:100%;
  height:100%;
  min-height:0;
  object-fit:cover;
  object-position:center;
  transition:transform .45s cubic-bezier(.2,.7,.2,1);
}
.xe-gallery-lead:hover > img { transform:scale(1.018); }
.xe-gallery-lead::after {
  position:absolute;
  z-index:1;
  inset:58% 0 0;
  content:"";
  pointer-events:none;
  background:linear-gradient(transparent,rgba(0,0,0,.48));
}
.xe-gallery-lead-caption {
  position:absolute;
  z-index:2;
  right:18px;
  bottom:16px;
  left:18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  color:#fff;
  font-size:9px;
  font-weight:800;
  letter-spacing:.14em;
  line-height:1.3;
  text-shadow:0 1px 8px rgba(0,0,0,.4);
  text-transform:uppercase;
}
.xe-gallery-lead-caption > span:last-child { flex:0 0 auto; opacity:.82; }
.xe-gallery-layout > .xe-gallery-rail {
  display:flex!important;
  flex:0 0 37%;
  flex-direction:column;
  align-self:stretch;
  align-content:stretch;
  gap:10px;
  box-sizing:border-box;
  width:37%!important;
  max-width:37%!important;
  min-width:0!important;
  min-height:480px;
  height:auto;
  visibility:visible!important;
  opacity:1!important;
}
.xe-gallery-story {
  display:flex;
  flex:0 0 auto;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  min-width:0;
  min-height:132px;
  padding:clamp(18px,2.2vw,28px);
  border:1px solid #111;
  border-radius:5px;
  background:#111;
  color:#fff;
}
.xe-gallery-story-eyebrow {
  margin:0 0 9px!important;
  color:#b4ff00!important;
  font-size:9px!important;
  font-weight:800;
  line-height:1.3;
  letter-spacing:.15em;
}
.xe-gallery-story h3 {
  margin:0 0 9px!important;
  color:#fff!important;
  font-size:clamp(20px,2vw,28px)!important;
  font-weight:680;
  line-height:1.08;
  letter-spacing:-.045em;
}
.xe-gallery-story-points {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:5px 14px;
  width:100%;
  margin:0;
  padding:0;
  list-style:none;
}
.xe-gallery-story-points li {
  position:relative;
  min-width:0;
  padding-left:11px;
  color:rgba(255,255,255,.82);
  font-size:10px;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.xe-gallery-story-points li::before {
  position:absolute;
  top:.48em;
  left:0;
  width:5px;
  height:5px;
  background:#b4ff00;
  content:"";
}
.xe-gallery-story-fallback {
  max-width:620px;
  margin:0!important;
  color:rgba(255,255,255,.76)!important;
  font-size:11px!important;
  line-height:1.55;
}
.xe-gallery-grid {
  display:grid!important;
  flex:1 1 auto;
  grid-template-columns:49% 49%;
  grid-template-rows:repeat(2,minmax(0,1fr));
  grid-auto-rows:minmax(0,1fr);
  gap:2%;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:240px;
  height:auto;
}
.xe-gallery-tile {
  position:relative;
  display:block;
  box-sizing:border-box;
  width:100%!important;
  max-width:100%!important;
  height:100%;
  min-width:0!important;
  min-height:0;
  aspect-ratio:1.4;
  padding:0;
  border:0;
  border-radius:4px;
  overflow:hidden;
  background:#e8e8e8;
  cursor:zoom-in;
  text-align:left;
  isolation:isolate;
}
.xe-gallery-tile > img {
  display:block;
  width:100%;
  height:100%;
  min-height:0;
  object-fit:cover;
  transition:transform .4s cubic-bezier(.2,.7,.2,1);
}
.xe-gallery-tile:hover > img { transform:scale(1.035); }
.xe-gallery-more {
  position:absolute;
  z-index:2;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:10px;
  background:rgba(0,0,0,.58);
  color:#fff;
  font-size:13px;
  font-weight:850;
  letter-spacing:.08em;
}
.xe-gallery-hint {
  margin:9px 0 0!important;
  color:#777;
  font-size:10px!important;
  line-height:1.4;
}

/* Fullscreen viewer: main image above a horizontally scrollable preview strip. */
.xe-gallery-lightbox {
  position:fixed;
  inset:50% auto auto 50%;
  transform:translate(-50%,-50%);
  box-sizing:border-box;
  width:min(1280px,calc(100vw - 40px));
  max-width:none;
  max-height:calc(100dvh - 40px);
  margin:0;
  padding:0;
  border:1px solid rgba(255,255,255,.12);
  border-radius:5px;
  overflow:auto;
  background:#0c0c0c;
  color:#fff;
  box-shadow:0 24px 90px rgba(0,0,0,.48);
}
.xe-gallery-lightbox::backdrop { background:rgba(0,0,0,.86); backdrop-filter:blur(5px); }
.xe-gallery-lightbox[open] { display:block; }
.xe-gallery-lightbox-inner { display:flex; flex-direction:column; min-height:0; padding:14px 18px 16px; }
.xe-gallery-lightbox-top { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:42px; margin-bottom:6px; }
.xe-gallery-lightbox-model { color:rgba(255,255,255,.72); font-size:9px; font-weight:800; letter-spacing:.15em; }
.xe-gallery-close {
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  width:40px;
  height:40px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:4px;
  background:#1c1c1c;
  color:#fff;
  font-size:27px;
  line-height:1;
  cursor:pointer;
}
.xe-gallery-lightbox-stage {
  display:grid;
  grid-template-columns:48px minmax(0,1fr) 48px;
  align-items:center;
  justify-items:center;
  gap:10px;
  min-width:0;
}
.xe-gallery-lightbox-stage > img {
  display:block;
  width:100%;
  height:auto;
  max-width:100%;
  max-height:calc(100dvh - 230px);
  object-fit:contain;
}
.xe-gallery-nav {
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:52px;
  border:1px solid rgba(255,255,255,.2);
  border-radius:4px;
  background:#191919;
  color:#fff;
  font-size:34px;
  line-height:1;
  cursor:pointer;
}
.xe-gallery-nav:disabled { opacity:.35; cursor:default; }
.xe-gallery-lightbox-footer { min-width:0; margin-top:12px; }
.xe-gallery-lightbox-preview {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  width:100%;
  max-width:100%;
  min-width:0;
  margin:0 auto;
  padding:0 0 4px;
  overflow-x:auto;
  overscroll-behavior-inline:contain;
  scrollbar-width:thin;
}
.xe-gallery-lightbox-preview[hidden] { display:none!important; }
.xe-gallery-preview-thumb {
  flex:0 0 clamp(74px,8vw,108px);
  width:clamp(74px,8vw,108px);
  aspect-ratio:4/3;
  padding:0;
  border:1px solid rgba(255,255,255,.22);
  border-radius:3px;
  overflow:hidden;
  background:#1a1a1a;
  opacity:.72;
  cursor:pointer;
}
.xe-gallery-preview-thumb[aria-current="true"] { border:2px solid #b4ff00; opacity:1; }
.xe-gallery-preview-thumb > img { display:block; width:100%; height:100%; object-fit:cover; }
.xe-gallery-lightbox-count { margin:8px 0 0!important; color:rgba(255,255,255,.72); font-size:10px!important; font-variant-numeric:tabular-nums; letter-spacing:.1em; text-align:center; }

/* Layout adapts to the gallery's parent width, not the physical screen.
   The column widths below always add up to 100% including the 1% gutter. */
@container xe-gallery (min-width:761px) and (max-width:1100px) {
  .xe-gallery-layout { min-height:410px; }
  .xe-gallery-layout > .xe-gallery-lead {
    flex-basis:57%; width:57%!important; max-width:57%!important;
    min-height:410px; aspect-ratio:1.42;
  }
  .xe-gallery-layout > .xe-gallery-rail {
    flex-basis:42%; width:42%!important; max-width:42%!important;
    min-height:410px;
  }
  .xe-gallery-story { min-height:118px; padding:16px; }
  .xe-gallery-story h3 { font-size:20px!important; }
  .xe-gallery-story-points li { font-size:9px; }
}

/* Preserve the familiar compact mobile composition whenever the gallery
   parent itself is narrow, even if the browser window is wide. */
@container xe-gallery (max-width:760px) {
  .xe-gallery-layout {
    display:flex!important;
    flex-direction:column;
    gap:8px;
    width:100%!important;
    min-height:0;
  }
  .xe-gallery-layout > .xe-gallery-lead {
    flex:0 0 auto;
    width:100%!important;
    max-width:100%!important;
    min-height:0;
    height:auto;
    aspect-ratio:16/9;
  }
  .xe-gallery-layout > .xe-gallery-rail {
    display:flex!important;
    flex:0 0 auto;
    flex-direction:column;
    gap:8px;
    width:100%!important;
    max-width:100%!important;
    min-height:0;
    height:auto;
  }
  .xe-gallery-story { order:2; min-height:0; padding:14px 15px; }
  .xe-gallery-story-eyebrow { margin-bottom:6px!important; font-size:8px!important; }
  .xe-gallery-story h3 { margin-bottom:7px!important; font-size:20px!important; }
  .xe-gallery-story-points { gap:5px 10px; }
  .xe-gallery-story-points li { font-size:9px; }
  .xe-gallery-story-fallback { font-size:10px!important; }
  .xe-gallery-grid {
    order:3;
    flex:0 0 auto;
    grid-template-columns:24% 24% 24% 24%;
    grid-template-rows:auto;
    grid-auto-rows:auto;
    gap:1.3333%;
    min-height:0;
    height:auto;
  }
  .xe-gallery-tile { width:100%!important; height:auto; aspect-ratio:1/1; border-radius:3px; }
  .xe-gallery-tile > img { width:100%; height:100%; }
  .xe-gallery-more { font-size:9px; }
}

/* Non-container-query fallback for older browsers. */
@supports not (container-type:inline-size) {
  @media (max-width:767px) {
    .xe-gallery-layout { flex-direction:column; gap:8px; min-height:0; }
    .xe-gallery-layout > .xe-gallery-lead { flex-basis:auto; width:100%!important; max-width:100%!important; min-height:0; aspect-ratio:16/9; }
    .xe-gallery-layout > .xe-gallery-rail { flex-basis:auto; width:100%!important; max-width:100%!important; min-height:0; }
    .xe-gallery-story { order:2; min-height:0; }
    .xe-gallery-grid { order:3; flex:none; grid-template-columns:24% 24% 24% 24%; grid-template-rows:auto; gap:1.3333%; min-height:0; }
    .xe-gallery-tile { height:auto; aspect-ratio:1/1; }
  }
  @media (min-width:768px) and (max-width:1100px) {
    .xe-gallery-layout > .xe-gallery-lead { flex-basis:57%; width:57%!important; max-width:57%!important; }
    .xe-gallery-layout > .xe-gallery-rail { flex-basis:42%; width:42%!important; max-width:42%!important; }
  }
}

/* Gallery heading and tabs stay compact on narrow parent containers. */
@container xe-gallery (max-width:760px) {
  .xe-gallery-header { align-items:flex-end; gap:10px; margin-bottom:14px; }
  .xe-gallery-eyebrow { margin-bottom:7px!important; font-size:9px!important; }
  .xe-gallery-heading-copy h2 { font-size:clamp(27px,7cqw,38px)!important; }
  .xe-gallery-total { padding-bottom:3px; font-size:8px; }
  .xe-gallery-tabs { gap:6px; margin-bottom:11px; }
  .xe-gallery-tab { min-height:39px; padding:8px 11px; font-size:10px; }
  .xe-gallery-hint { margin-top:7px!important; font-size:9px!important; }
  .xe-gallery-lightbox { width:calc(100vw - 14px); max-height:calc(100dvh - 14px); border-radius:4px; }
  .xe-gallery-lightbox-inner { padding:8px 7px 12px; }
  .xe-gallery-lightbox-top { min-height:38px; margin-bottom:5px; }
  .xe-gallery-close { width:38px; height:38px; }
  .xe-gallery-lightbox-stage { grid-template-columns:32px minmax(0,1fr) 32px; gap:4px; }
  .xe-gallery-lightbox-stage > img { max-height:calc(100dvh - 225px); }
  .xe-gallery-nav { width:32px; height:42px; font-size:27px; }
  .xe-gallery-lightbox-footer { margin-top:9px; }
  .xe-gallery-lightbox-preview { justify-content:flex-start; gap:6px; }
  .xe-gallery-preview-thumb { flex-basis:66px; width:66px; }
  .xe-gallery-lightbox-count { margin-top:6px!important; }
}
@container xe-gallery (max-width:390px) {
  .xe-gallery-heading-copy h2 { font-size:26px!important; }
  .xe-gallery-tab { min-height:37px; padding:7px 9px; font-size:9px; }
  .xe-gallery-story-points { grid-template-columns:1fr 1fr; }
}
@media (prefers-reduced-motion:reduce) {
  .xe-gallery-tab,.xe-gallery-lead > img,.xe-gallery-tile > img { transition:none!important; }
}
