/* Flow layout reserves a real column and row for the whole rotating model. */
.hero:has(.hero-3d) {
  display: grid;
  grid-template-columns: clamp(180px, 17vw, 240px) minmax(0, 1fr) clamp(180px, 17vw, 240px);
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px clamp(16px, 2vw, 40px);
  align-items: center;
  align-content: stretch;
  height: 100svh;
  min-height: 0;
  max-height: none;
  padding-top: 108px;
  padding-bottom: 20px;
}
.hero:has(.hero-3d) h1 {
  font-size: min(14.5vw, 26svh);
  animation-name: hero-title-reveal;
}
@keyframes hero-title-reveal { from { opacity: 0; } to { opacity: 1; } }
.hero:has(.hero-3d) .hero-topline { grid-column: 1 / -1; grid-row: 1; align-self: start; }
.hero:has(.hero-3d) .hero-mission {
  grid-column: 1;
  grid-row: 1;
  position: static;
  width: auto;
  min-width: 0;
}
.hero:has(.hero-3d) .hero-event {
  grid-column: 3;
  grid-row: 1;
  position: relative;
  inset: auto;
  width: auto;
  min-width: 0;
}
.hero:has(.hero-3d) .hero-bottom {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  inset: auto;
  min-width: 0;
  /* Manrope's Cyrillic descenders extend beyond its tight line box. */
  padding-bottom: min(2.61vw, 4.68svh);
}
.hero-art.hero-3d {
  --heart-controls-space: 24px;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  position: relative;
  width: min(100%, 960px);
  height: 100%;
  max-height: 760px;
  min-height: 0;
  min-width: 0;
  left: auto;
  top: auto;
  transform: none;
  z-index: 1;
  overflow: hidden;
  mix-blend-mode: normal;
  mask: none;
  -webkit-mask: none;
  filter: none;
  box-shadow: none;
  background: transparent;
  will-change: auto;
  isolation: isolate;
}
.heart3d-poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: calc(100% - var(--heart-controls-space));
  object-fit: contain;
  pointer-events: none;
}
.heart3d-ready .heart3d-poster { visibility: hidden; }
.heart3d-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: calc(100% - var(--heart-controls-space));
  background: transparent;
  filter: none;
  box-shadow: none;
  cursor: grab;
  touch-action: pan-y;
  border-radius: 24px;
  -webkit-user-select: none;
  user-select: none;
}
.heart3d-canvas:focus-visible {
  outline: 1px solid #eb287466;
  outline-offset: -20px;
}
.heart3d-dragging .heart3d-canvas { cursor: grabbing; }
.heart3d-canvas[hidden],
.heart3d-controls[hidden] { display: none; }
.heart3d-controls {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: max-content;
  max-width: calc(100% - 18px);
  color: #59677e;
  font-size: 9px;
  letter-spacing: .01em;
  white-space: nowrap;
  pointer-events: none;
}
.heart3d-hint { display: inline-flex; align-items: center; }
@media (max-width: 1050px) and (min-width: 761px) {
  .heart3d-controls { font-size: 8px; }
}
/* At narrow tablet widths or high browser zoom, keep the model on its own row. */
@media (min-width: 761px) and (max-width: 1000px) {
  .hero:has(.hero-3d) {
    grid-template-columns: minmax(0, 1fr) minmax(180px, .6fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .hero:has(.hero-3d) .hero-mission { grid-row: 2; }
  .hero:has(.hero-3d) .hero-event { grid-column: 2; grid-row: 2; }
  .hero-art.hero-3d {
    grid-column: 1 / -1;
    grid-row: 3;
    width: min(100%, 760px);
    max-height: 620px;
  }
  .hero:has(.hero-3d) .hero-bottom { grid-row: 4; }
}
/* A short, wide window needs side columns to leave enough height for the heart. */
@media (min-width: 761px) and (max-width: 1000px) and (max-height: 900px) {
  .hero:has(.hero-3d) {
    grid-template-columns: 170px minmax(0, 1fr) 180px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .hero:has(.hero-3d) .hero-event { grid-column: 3; }
  .hero-art.hero-3d { grid-column: 2; grid-row: 2; }
  .hero:has(.hero-3d) .hero-bottom { grid-row: 3; }
}
@media (max-width: 760px) {
  .hero:has(.hero-3d) {
    --hero-title-size: calc((100vw - 44px) * .173);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    row-gap: 16px;
    align-content: start;
    min-height: 0;
    height: auto;
    max-height: none;
    padding-top: 66px;
  }
  .hero:has(.hero-3d) .hero-topline { display: none; }
  .hero:has(.hero-3d) .hero-mission {
    grid-column: 1;
    grid-row: 1;
    position: static;
    width: min(340px, 100%);
  }
  .hero:has(.hero-3d) .hero-mission p { max-width: 340px; }
  .hero-art.hero-3d {
    --heart-mobile-width: min(600px, calc(100vw - 16px));
    grid-column: 1;
    grid-row: 2;
    position: relative;
    justify-self: center;
    width: var(--heart-mobile-width);
    height: calc(min(var(--heart-mobile-width), max(160px, calc(100svh - 260px - var(--hero-title-size) * 1.15))) + var(--heart-controls-space));
    aspect-ratio: auto;
    max-width: none;
    max-height: none;
    top: auto;
    left: auto;
    transform: none;
  }
  .heart3d-controls { bottom: 0; font-size: 8px; }
  /* Keep the title in the same mobile flow as the trip card. */
  .hero:has(.hero-3d) .hero-bottom { display: contents; }
  .hero:has(.hero-3d) h1 {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    font-size: var(--hero-title-size);
  }
  .hero:has(.hero-3d) .hero-event {
    grid-column: 1;
    grid-row: 4;
    position: relative;
    inset: auto;
    width: auto;
    min-width: 0;
    padding: 17px 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 16px;
    border-radius: 22px;
  }
  .hero:has(.hero-3d) .event-kicker { grid-column: 1 / -1; }
  .hero:has(.hero-3d) .hero-event-place { margin: 0; font-size: 22px; }
  .hero:has(.hero-3d) .hero-event-date { grid-column: 1; margin: 0; font-size: 10px; }
  .hero:has(.hero-3d) .event-link {
    grid-column: 2;
    grid-row: 2 / 4;
    align-self: center;
    border: 1px solid #243b6724;
    border-radius: 999px;
    padding: 10px 12px;
    margin: 0;
    font-size: 9px;
  }
}
@media (max-width: 380px) {
  .heart3d-controls { font-size: 8px; }
  .hero:has(.hero-3d) .hero-event { padding: 16px; gap: 7px 10px; }
  .hero:has(.hero-3d) .event-link { font-size: 8px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-art.hero-3d { transform: none !important; }
}

.hero-title-baseline {
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: baseline;
  line-height: 0;
}

/* A transparent stage can use the surrounding whitespace without moving text. */
@media (min-width: 1001px) {
  .hero.hero-spacious { display: block; }
  .hero.hero-spacious .hero-topline {
    position: absolute;
    top: 108px;
    left: var(--gutter);
    right: var(--gutter);
  }
  .hero.hero-spacious .hero-mission,
  .hero.hero-spacious .hero-event {
    position: absolute;
    width: clamp(180px, 17vw, 240px);
  }
  .hero.hero-spacious .hero-mission { top: var(--mission-top, 200px); left: var(--gutter); }
  .hero.hero-spacious .hero-event { top: var(--event-top, 200px); right: var(--gutter); }
  .hero.hero-spacious .hero-bottom {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    bottom: 40px;
    padding-bottom: 0;
  }
  .hero.hero-spacious .hero-art.hero-3d {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    pointer-events: none;
    z-index: 4;
  }
  .hero.hero-spacious .heart3d-canvas,
  .hero.hero-spacious .heart3d-poster {
    inset: auto;
    left: var(--heart-left);
    top: var(--heart-top);
    width: var(--heart-width);
    height: max(100px, calc(var(--hero-title-ink-top) - var(--heart-top) - 12px));
    border-radius: 0;
    pointer-events: auto;
  }
  .hero.hero-spacious .heart3d-poster { pointer-events: none; }
  .hero.hero-spacious .heart3d-controls {
    top: var(--heart-controls-top);
    bottom: auto;
    left: var(--gutter);
    transform: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
  .hero.hero-compact .hero-mission .eyebrow { margin-bottom: 8px; font-size: 9px; }
  .hero.hero-compact .hero-mission p { font-size: 14px; line-height: 1.35; }
  .hero.hero-compact .heart3d-hint { display: none; }
  .hero.hero-compact .hero-event { padding: 14px 16px; }
  .hero.hero-compact .hero-event-place { margin-top: 12px; font-size: 19px; }
  .hero.hero-compact .hero-event-date { margin-top: 6px; font-size: 10px; }
  .hero.hero-compact .event-link { margin-top: 12px; padding-top: 10px; font-size: 9px; }
}
