/* filename: assets/css/hero3d.css
 * AMI Notebook Plaza — 3D hero slider
 */

.ami-h3d {
  --accent: #BE0A0A;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--paper, #FBFAF8);
  padding-top: calc(var(--hdr-h, 68px) + clamp(16px, 3vw, 40px));
  min-height: clamp(640px, 100svh, 940px);
  display: flex;
  flex-direction: column;
}
body.admin-bar .ami-h3d { min-height: clamp(640px, calc(100svh - 32px), 940px); }

/* Accent glow follows the active slide */
.ami-h3d__glow {
  position: absolute; inset: -20% -10% auto 30%; height: 120%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(42% 46% at 62% 42%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    radial-gradient(30% 30% at 88% 78%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  transition: background 1s var(--ease, ease);
}
.ami-h3d__grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .55;
  background-image: linear-gradient(var(--line, #E8E5E0) 1px, transparent 1px), linear-gradient(90deg, var(--line, #E8E5E0) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(60% 55% at 65% 45%, #000 20%, transparent 75%);
          mask-image: radial-gradient(60% 55% at 65% 45%, #000 20%, transparent 75%);
}

.ami-h3d__inner {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(16px, 3vw, 48px);
}

/* ───── Copy (slides stacked in one grid cell → no layout shift) ───── */
.ami-h3d__copy { display: grid; align-items: center; }
.ami-h3d__slide { grid-area: 1 / 1; max-width: 560px; pointer-events: none; }
.ami-h3d__slide > * { opacity: 0; transform: translateY(18px); transition: opacity .45s var(--ease, ease), transform .6s var(--ease, ease); }
.ami-h3d__slide.is-active { pointer-events: auto; }
.ami-h3d__slide.is-active > * { opacity: 1; transform: none; }
.ami-h3d__slide.is-active > :nth-child(1) { transition-delay: .25s; }
.ami-h3d__slide.is-active > :nth-child(2) { transition-delay: .33s; }
.ami-h3d__slide.is-active > :nth-child(3) { transition-delay: .41s; }
.ami-h3d__slide.is-active > :nth-child(4) { transition-delay: .49s; }
.ami-h3d__slide.is-leaving > * { opacity: 0; transform: translateY(-12px); transition-duration: .25s; transition-delay: 0s; }

.ami-h3d__eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px;
  font: 600 12px/1 var(--sans, Inter, sans-serif); letter-spacing: .18em; text-transform: uppercase; color: var(--slate, #5F5B55);
}
.ami-h3d__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); transition: background .6s; }
.ami-h3d__title {
  font-family: var(--serif, Fraunces, serif); font-weight: 400;
  font-size: clamp(38px, 5.4vw, 76px); line-height: 1.02; letter-spacing: -.03em;
  color: var(--ink, #1A1917); margin: 0 0 20px; text-wrap: balance;
}
.ami-h3d__text { font-size: clamp(15px, 1.25vw, 18px); line-height: 1.65; color: var(--slate, #5F5B55); margin: 0 0 30px; max-width: 460px; text-wrap: pretty; }
.ami-h3d__ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.ami-h3d__btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px;
  background: var(--ink, #1A1917); color: #fff !important; text-decoration: none;
  font: 600 15px/1 var(--sans, Inter, sans-serif);
  transition: background .3s var(--ease, ease), transform .2s var(--ease, ease), box-shadow .3s;
}
.ami-h3d__btn:hover { background: var(--accent); transform: translateY(-2px); box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent); }
.ami-h3d__btn svg { transition: transform .3s var(--ease, ease); }
.ami-h3d__btn:hover svg { transform: translateX(4px); }
.ami-h3d__play {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 15px var(--sans, Inter, sans-serif); color: var(--ink, #1A1917);
}
.ami-h3d__play span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 1px solid var(--line, #E8E5E0); color: var(--accent); box-shadow: 0 6px 18px -8px rgba(0,0,0,.25); transition: transform .3s var(--ease, ease); }
.ami-h3d__play:hover span { transform: scale(1.08); }
.ami-h3d__btn:focus-visible, .ami-h3d__play:focus-visible, .ami-h3d__tab:focus-visible, .ami-h3d__arrow:focus-visible, .ami-h3d__pause:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ───── Stage (3D canvas over a fallback image) ───── */
.ami-h3d__stage { position: relative; height: clamp(360px, 62vh, 640px); min-width: 0; touch-action: pan-y; }
.ami-h3d__fallback {
  position: absolute; inset: 6% 0 10%; width: 100%; height: 84%; object-fit: contain;
  filter: drop-shadow(0 30px 40px rgba(0,0,0,.18));
  transition: opacity .8s var(--ease, ease), transform .8s var(--ease, ease);
}
.ami-h3d__canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; transition: opacity 1s var(--ease, ease); cursor: grab; }
.ami-h3d__stage.is-ready .ami-h3d__canvas { opacity: 1; }
.ami-h3d__stage.is-ready .ami-h3d__fallback { opacity: 0; transform: scale(.96); pointer-events: none; }
.ami-h3d__floor { display: none; }
.ami-h3d__hint {
  position: absolute; right: 8%; bottom: 4%; font: 500 11.5px var(--sans, Inter, sans-serif); letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint, #9A968F); opacity: 0; transition: opacity .6s;
}
.ami-h3d__stage.is-ready .ami-h3d__hint { opacity: 1; }
.ami-h3d__stage.is-interacted .ami-h3d__hint { opacity: 0; }
@media (hover: none) { .ami-h3d__hint { display: none; } }

/* ───── Controls ───── */
.ami-h3d__controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 10px; padding-bottom: 26px; }
.ami-h3d__tabs { display: flex; gap: 6px; flex: 1; max-width: 760px; }
.ami-h3d__tab {
  --p: 0;
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer; padding: 12px 10px 0 0;
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 12px; align-items: baseline; color: var(--faint, #9A968F);
  transition: color .3s;
}
.ami-h3d__tab:hover, .ami-h3d__tab.is-active { color: var(--ink, #1A1917); }
.ami-h3d__num { font: 600 12px var(--sans, Inter, sans-serif); letter-spacing: .06em; }
.ami-h3d__label { font: 500 14px var(--sans, Inter, sans-serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ami-h3d__bar { grid-column: 1 / -1; height: 2px; background: var(--line, #E8E5E0); border-radius: 2px; overflow: hidden; }
.ami-h3d__bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.ami-h3d__tab.is-active .ami-h3d__bar i { transform: scaleX(var(--p)); }
.ami-h3d.is-paused .ami-h3d__tab.is-active .ami-h3d__bar i { transform: scaleX(1); opacity: .45; }

.ami-h3d__nav { display: flex; gap: 8px; }
.ami-h3d__arrow, .ami-h3d__pause {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line, #E8E5E0); background: #fff; color: var(--ink, #1A1917);
  display: grid; place-items: center; cursor: pointer; transition: background .25s, color .25s, border-color .25s, transform .2s;
}
.ami-h3d__arrow:hover { background: var(--ink, #1A1917); color: #fff; border-color: var(--ink, #1A1917); }
.ami-h3d__arrow:active { transform: scale(.94); }
.ami-h3d__pause .i-play { display: none; }
.ami-h3d.is-paused .ami-h3d__pause .i-play { display: block; }
.ami-h3d.is-paused .ami-h3d__pause .i-pause { display: none; }

/* ───── Trust strip ───── */
.ami-h3d__trust { border-top: 1px solid var(--line, #E8E5E0); background: rgba(255,255,255,.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.ami-h3d__trust-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ami-h3d__trust-in > div { display: flex; align-items: center; gap: 14px; padding: 20px 18px; border-left: 1px solid var(--line, #E8E5E0); color: var(--ink, #1A1917); }
.ami-h3d__trust-in > div:first-child { border-left: 0; padding-left: 0; }
.ami-h3d__trust-in svg { flex: 0 0 auto; color: var(--red, #BE0A0A); }
.ami-h3d__trust-in span { display: grid; gap: 2px; font-size: 12.5px; color: var(--slate, #5F5B55); }
.ami-h3d__trust-in strong { font: 600 14px var(--sans, Inter, sans-serif); color: var(--ink, #1A1917); }

/* ───── Film lightbox ───── */
.ami-film { position: fixed; inset: 0; z-index: 1500; display: grid; place-items: center; padding: 24px; }
.ami-film[hidden] { display: none; }
.ami-film__bg { position: absolute; inset: 0; background: rgba(8,8,10,.86); opacity: 0; transition: opacity .25s; }
.ami-film__box { position: relative; width: min(1100px, 100%); aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; transform: scale(.96); opacity: 0; transition: transform .3s var(--ease, ease), opacity .25s; }
.ami-film.open .ami-film__bg { opacity: 1; }
.ami-film.open .ami-film__box { transform: none; opacity: 1; }
.ami-film__video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.ami-film__x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #111; display: grid; place-items: center; cursor: pointer; }

/* ───── Old hero bits that may still be styled elsewhere ───── */
.ami-hero__stats { display: none !important; }

/* ───── Tablet ───── */
@media (max-width: 1024px) {
  .ami-h3d__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ami-h3d__stage { height: clamp(320px, 48vh, 520px); }
  .ami-h3d__trust-in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ami-h3d__trust-in > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .ami-h3d__trust-in > div:nth-child(n+3) { border-top: 1px solid var(--line, #E8E5E0); }
}

/* ───── Mobile: laptop first, then copy ───── */
@media (max-width: 760px) {
  .ami-h3d { min-height: 0; padding-top: calc(var(--hdr-h, 68px) + 4px); }
  .ami-h3d__inner { grid-template-columns: 1fr; gap: 0; }
  .ami-h3d__stage { order: -1; height: clamp(250px, 66vw, 380px); margin: 0 -8px; }
  .ami-h3d__slide { max-width: none; }
  .ami-h3d__eyebrow { margin-bottom: 12px; font-size: 11px; }
  .ami-h3d__title { font-size: clamp(32px, 9vw, 44px); margin-bottom: 14px; }
  .ami-h3d__text { font-size: 15px; margin-bottom: 22px; }
  .ami-h3d__btn { width: 100%; justify-content: center; }
  .ami-h3d__ctas { gap: 10px; }
  .ami-h3d__play { width: 100%; justify-content: center; }
  .ami-h3d__controls { padding-top: 22px; padding-bottom: 20px; gap: 12px; }
  .ami-h3d__label { display: none; }
  .ami-h3d__tab { grid-template-columns: 1fr; row-gap: 8px; }
  .ami-h3d__arrow { display: none; }
  .ami-h3d__pause { width: 44px; height: 44px; }
  .ami-h3d__trust-in { grid-template-columns: 1fr 1fr; }
  .ami-h3d__trust-in > div { padding: 14px 10px; gap: 10px; }
  .ami-h3d__trust-in > div:nth-child(odd) { padding-left: 0; }
  .ami-h3d__trust-in strong { font-size: 13px; }
  .ami-h3d__trust-in span { font-size: 11.5px; }
  .ami-h3d__grid { background-size: 44px 44px; }
}

/* ───── Reduced motion / no WebGL ───── */
@media (prefers-reduced-motion: reduce) {
  .ami-h3d__slide > *, .ami-h3d__glow, .ami-h3d__btn, .ami-film__box { transition: none !important; }
}
.ami-h3d.is-static .ami-h3d__hint { display: none; }
