/* KHA Marine — boat-detail 3D + specs + gallery section (ROM-dark aesthetic) */
.kha-bd {
  position: relative;      /* sit above ROM's fixed reveal-footer (z-index:0) */
  z-index: 1;
  background: #0b0f14;
  color: #eef3f8;
  padding: clamp(64px, 9vw, 140px) 0;
  font-family: "Hurme", "Plus Jakarta Sans", -apple-system, Helvetica, Arial, sans-serif;
}
.kha-bd__wrap {
  box-sizing: border-box; /* width:100% + padding was overflowing ~50px and cutting off the specs on the right */
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 64px);
}
/* On phones the 3D stage falls back to a poster <img>. Without this it rendered at
   its natural 1080px width and blew way past the screen. Constrain it to the stage. */
.kha-bd__stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.kha-bd__head { text-align: center; margin: clamp(48px, 7vw, 96px) 0 clamp(28px, 4vw, 48px); }
.kha-bd__head:first-child { margin-top: 0; }
.kha-bd__eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #4a9eff;
  margin-bottom: 18px;
}
.kha-bd__title {
  font-family: "Canela", "Fraunces", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.kha-bd__title em { font-style: italic; color: #4a9eff; }
.kha-bd__lede {
  max-width: 58ch;
  margin: 18px auto 0;
  color: #9fb2c8;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* 3D stage */
.kha-bd__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(120% 90% at 50% 18%, rgba(74, 158, 255, 0.16) 0%, transparent 58%),
    linear-gradient(180deg, #121a26 0%, #05080d 100%);
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, 0.95);
}
.kha-bd__stage model-viewer { width: 100%; height: 100%; background: transparent; --poster-color: transparent; }
.kha-bd__badge {
  position: absolute;
  top: 20px; left: 20px; z-index: 2;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #cfe0f5;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  padding: 8px 14px; border-radius: 100px;
  display: inline-flex; align-items: center; gap: 8px; pointer-events: none;
}
.kha-bd__badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4a9eff;
}
@media (max-width: 680px) { .kha-bd__stage { aspect-ratio: 4 / 3; } }

/* Specifications table + feature list (from the KHA concept spec sheets) */
.kha-bd__specgrid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.kha-bd__specbox {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: clamp(20px, 2.5vw, 34px);
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.7), rgba(5, 8, 13, 0.7));
}
.kha-bd__specboxTitle {
  font-family: "Canela", "Fraunces", serif;
  font-weight: 400;
  font-size: 1.5rem;
  margin: 0 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.kha-bd__row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 1rem;
}
.kha-bd__row:last-child { border-bottom: 0; }
.kha-bd__row .k { color: #9fb2c8; }
.kha-bd__row .v { color: #eef3f8; font-weight: 600; text-align: right; }
.kha-bd__feats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-content: start;
}
.kha-bd__feat {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
  color: #cfe0f5;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(74, 158, 255, 0.05);
}
.kha-bd__feat svg { width: 18px; height: 18px; color: #4a9eff; flex: 0 0 auto; }
@media (max-width: 780px) { .kha-bd__specgrid { grid-template-columns: 1fr; } }

/* Concept spec sheets — full-width plates */
.kha-bd__specs { display: grid; gap: clamp(20px, 3vw, 40px); }
.kha-bd__spec {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #fff;
  box-shadow: 0 30px 70px -44px rgba(0, 0, 0, 0.9);
}
.kha-bd__spec img { display: block; width: 100%; height: auto; }

/* Photo gallery */
.kha-bd__gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(12px, 1.6vw, 20px);
}
.kha-bd__tile {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 4 / 3;
  background: #121a26;
}
.kha-bd__tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.kha-bd__tile:hover img { transform: scale(1.05); }
@media (max-width: 780px) { .kha-bd__gallery { grid-template-columns: repeat(2, 1fr); } }

/* Homepage fleet 3D explorer — two boxes: model (left) + specifications (right) */
.kha-fleet3d__grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: clamp(16px, 2.2vw, 30px);
  align-items: stretch;
}
.kha-fleet3d__grid .kha-bd__stage { height: 100%; }
.kha-fleet3d__wm {
  position: absolute; left: 20px; bottom: 16px; z-index: 2; pointer-events: none;
  font-family: "Fraunces", Georgia, serif; letter-spacing: .12em;
  font-size: 14px; color: rgba(233, 242, 251, .78); text-shadow: 0 2px 12px rgba(0,0,0,.6);
}
/* Zoom controls — bottom-right, balancing the KHA watermark on the left */
.kha-fleet3d__zoom {
  position: absolute; right: 16px; bottom: 16px; z-index: 3;
  display: flex; flex-direction: column; gap: 8px;
}
.kha-fleet3d__zbtn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; font-weight: 400; color: #cfe0f5;
  background: rgba(10, 22, 40, 0.6); border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px); cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.kha-fleet3d__zbtn:hover {
  background: rgba(74, 158, 255, 0.22); border-color: rgba(74, 158, 255, 0.55); color: #fff;
}
.kha-fleet3d__zbtn:active { transform: scale(0.92); }

.kha-fleet3d__specs {
  display: flex; flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px;
  padding: clamp(20px, 2.2vw, 32px);
  background: linear-gradient(180deg, rgba(18, 26, 38, 0.72), rgba(5, 8, 13, 0.72));
}
.kha-fleet3d__spec-eyebrow {
  font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: #4a9eff;
}
.kha-fleet3d__spec-name {
  font-family: "Canela", "Fraunces", serif; font-weight: 400;
  font-size: clamp(1.4rem, 1rem + 1.2vw, 1.95rem);
  margin: 8px 0 12px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.kha-fleet3d__spec-list {
  list-style: none; margin: 0; padding: 0;
  flex: 1; display: flex; flex-direction: column; justify-content: space-between;
}
.kha-fleet3d__spec-row {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.07); font-size: .98rem;
}
.kha-fleet3d__spec-row:last-child { border-bottom: 0; }
.kha-fleet3d__spec-row .k { color: #9fb2c8; }
.kha-fleet3d__spec-row .v { color: #eef3f8; font-weight: 600; text-align: right; }
/* brief fade when the boat changes */
.kha-fleet3d__specs.is-swap .kha-fleet3d__spec-name,
.kha-fleet3d__specs.is-swap .kha-fleet3d__spec-row .v { animation: khaSpecIn .45s ease; }
@keyframes khaSpecIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 820px) { .kha-fleet3d__grid { grid-template-columns: 1fr; } }

/* Homepage fleet 3D explorer — boat selector tabs (above the stage) */
.kha-fleet3d__tabs {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  margin: 0 0 clamp(18px, 2.2vw, 28px);
}
/* the active tab reads as the current boat: filled, plus a small marker under it */
.kha-fleet3d__tabs button[aria-pressed="true"] { position: relative; }
.kha-fleet3d__tabs button[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: #4a9eff;
}
@media (max-width: 680px) {
  .kha-fleet3d__tabs { gap: 8px; }
  .kha-fleet3d__tabs button { padding: 10px 16px; font-size: 12px; }
}
.kha-fleet3d__tabs button {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: #9fb2c8; padding: 11px 20px; border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(18,26,38,0.5); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.kha-fleet3d__tabs button:hover { color: #eef3f8; border-color: rgba(255,255,255,0.3); transform: translateY(-1px); }
.kha-fleet3d__tabs button[aria-pressed="true"] { color: #05080d; background: #4a9eff; border-color: #4a9eff; }

/* RTL safety: model-viewer + the 3D explorer grid stay LTR in Arabic so the WebGL
   stage never collapses / mis-lays-out (the spec text inside stays localized). */
model-viewer{ direction:ltr; }
html[dir="rtl"] .kha-fleet3d__grid,
html[dir="rtl"] .kha-bd__stage{ direction:ltr; }
html[dir="rtl"] .kha-fleet3d__specs{ direction:rtl; text-align:right; }
html[dir="rtl"] .kha-fleet3d__spec-row{ direction:rtl; }
html[dir="rtl"] .kha-fleet3d__spec-row .v{ text-align:left; }
/* Stage chrome mirrored for Arabic: the badge (read first) top-right, the watermark
   bottom-right, the zoom buttons bottom-left. The badge runs right-to-left so the boat
   name leads its Arabic class line instead of trailing it. */
html[dir="rtl"] .kha-bd__badge{ direction:rtl; left:auto; right:20px; }
html[dir="rtl"] .kha-fleet3d__wm{ left:auto; right:20px; }
html[dir="rtl"] .kha-fleet3d__zoom{ right:auto; left:16px; }

/* Homepage fleet explorer on phones: the GLB is only fetched when asked for. The stage
   shows the boat render with this button over it; a tap swaps in the live model. */
.kha-fleet3d__load {
  position: absolute; left: 50%; bottom: 18px; z-index: 3;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 100px; cursor: pointer;
  font: 600 12px/1 "Hurme", "Plus Jakarta Sans", -apple-system, Helvetica, Arial, sans-serif;
  letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  color: #05080d; background: #4a9eff; border: 1px solid #4a9eff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
.kha-fleet3d__load svg { width: 16px; height: 16px; }
.kha-fleet3d__load:active { transform: translateX(-50%) scale(.96); }

/* Lite mode (phones): backdrop blurs cost GPU time on every frame they are on screen. */
html.kha-lite .kha-bd__badge,
html.kha-lite .kha-fleet3d__zbtn {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(10, 22, 40, 0.86);
}
