/* ——— MODERN POPOVER ENGINE ——— */
:root {
  --po-bg: #1b1b1b;
  --po-border: rgba(240, 237, 230, 0.07);
  --po-border-hi: rgba(240, 237, 230, 0.15);
  
  /* These map to the dark theme default */
  --po-text: rgb(255, 255, 255);
  --po-text-dim: rgba(239, 239, 239, 1);
  
  --po-accent: #f4f4f4;
  --po-fd: "inter-variable", sans-serif;
  --po-fm: "DM Mono", monospace;
}

.modern-popover {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  background: var(--po-bg);
  font-family: var(--po-fm);
  color: var(--po-text);
  overflow: hidden; /* container handles scroll */
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  z-index: 99999;
  display: none; /* fallback hidden state */
}

/* Fallback visibility logic */
.modern-popover.po-fallback-open,
.modern-popover:popover-open {
  display: block;
}

.modern-popover::backdrop {
  background: rgb(254, 104, 179);
}

.po-close-btn {
  position: absolute; /* Using absolute instead of fixed prevents Safari from leaking the button outside hidden popovers */
  top: 24px;
  right: 32px;
  background: rgb(254, 104, 179);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--po-border-hi);
  border-radius: 40px;
  color: white;
  font-family: var(--po-fd);
  font-size: 1.1rem;
  letter-spacing: 0.0em;
  cursor: pointer;
  padding: 8px 21px;
  z-index: 100;
  transition: color 0.3s, background 0.3s;
}
.po-close-btn:hover {
  background: rgba(40, 40, 40, 0.8);
  color: var(--po-accent);
}

/* ——— Scroll container ——— */
.po-scroll-container {
  height: 100vh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  position: relative;
  -webkit-overflow-scrolling: touch;
  
  /* Gap control */
  display: flex;
  flex-direction: column;
  gap: /* var(--po-slide-gap, 24px) */ 0;
  background: var(--po-bg);
}
.po-scroll-container::-webkit-scrollbar {
  display: none;
}

/* ——— Sections (Slides) ——— */
.po-section {
  height: 100vh;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background-color: var(--po-bg);
}

/* Theme overrides mapped via HTML data-theme attr */
.po-section[data-theme="light"] {
  --po-text: #454545;
  --po-text-dim: rgb(59, 59, 59);
  --po-img-border: 2.5px solid #4f4f4f;
}
.po-section[data-theme="dark"] {
  --po-text: rgb(206, 206, 206);
  --po-text-dim: rgb(206, 206, 206);
  --po-img-border: 2.5px solid #ececec;
}

/* Image Element */
.po-bg-image {
    z-index: 1;
    pointer-events: auto;
}
.po-bg-image.mode-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    outline: none;
}
.po-bg-image.mode-contain {
    position: relative;
    /* Hug the intrinsic image aspect identically so borders clip beautifully */
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 75vh;
    object-fit: contain;

    border-radius: var(--po-img-radius, 5px);
    outline: var(--po-img-border, 2.5px solid #ececec);
    outline-offset: 0px; /* Tucks the border natively inside the antialiased cut */
    margin: 0;
}

/* Fix for Lottie web components which calculate their own internal containment natively */
lottie-player.po-bg-image.mode-contain {
    width: 100%;
    height: 100%;
}

.po-bg-image.no-border {
    outline: none !important;
    border-radius: 0 !important;
}

/* Large section-number bg watermark */
.po-section-bg-num {
  position: absolute;
  font-family: var(--po-fd);
  font-size: clamp(5.5vw, 6.5vw, 70px);
  line-height: 0.8;
  letter-spacing: -0.04em;
  color: var(--po-ind-color, rgba(200, 255, 0, 0.04));
  opacity: .3;
  z-index: 2;
  user-select: none;
  pointer-events: none;
  right: 24px;
  bottom: 24px;
}

/* Horizontal accent bar at bottom of each section */
.po-section::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--po-border);
  z-index: 5;
}

/* Left section counter bar */
.po-section-counter {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--po-border);
  z-index: 5;
  overflow: hidden;
}
.po-section-counter-fill {
  width: 100%;
  background: var(--po-ind-color, var(--po-accent));
  height: 0%;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.po-section.active .po-section-counter-fill {
  height: 100%;
}

/* ——— Shared Content Layout ——— */
.po-content {
  position: absolute; /* Hover over the deeply-centered image natively */
  inset: 0;
  margin: auto;
  height: fit-content;
  z-index: 3; /* Above image and scrim */
  width: 100%;
  /* max-width: 1300px; */ /* Aligns content inside */
  padding: 0 clamp(32px, 8vw, 80px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  
  /* Initial Entry State */
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.po-section.active .po-content {
  opacity: 1;
  transform: translateY(0);
}


/* ——— Overview Type overrides ——— */
.overview-style h1 {
  font-family: var(--po-fd);
  font-size: clamp(3.5rem, .01rem + 8vw, 7.0rem);
  font-variation-settings: 'wght' 300;
  line-height: 0.9;
  letter-spacing: -0.04em;
  max-inline-size: 30ch;
  color: var(--po-text);
  margin: 0 0 0px -6px;
}

.overview-style h2 {
  font-family: var(--po-fd);
  font-size: clamp(1.55rem, 2vw, 2rem);
  font-variation-settings: 'wght' 350;
  max-inline-size: 30ch;
  line-height: 1.2;
  color: var(--po-text);
  margin-bottom: 0px;
}
.overview-style p {
  font-family: "inter-variable", sans-serif;
  font-variation-settings: 'wght' 250;
  font-size: clamp(1rem, 1.4vw, 1.7rem);
  letter-spacing: 0em;
  color: var(--po-text-dim);
  line-height: 1.3;
  max-width: 750px;
}

/* ——— Flex Type overrides ——— */
.flex-style h1 {
  font-family: var(--po-fd);
  font-variation-settings: 'wght' 300;
  font-size: clamp(3.5rem, .01rem + 8vw, 7.0rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin: 0 0 10px -11px;
  color: var(--po-text);
}
.flex-style h1 em {
  font-style: normal;
  color: var(--po-ind-color, var(--po-accent));
}
.flex-style p {
  font-family: "inter-variable", sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.0em;
  /* text-transform: capitalize; */
  color: var(--po-text-dim);
  line-height: 1.35;
  max-width: 680px;
  font-weight: 300;
}
.po-content-eyebrow {
  font-family: "inter-variable", sans-serif;
  font-size: 16px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 550;
  padding-bottom: 30px;
  color: var(--po-text);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.5s 0.1s ease, transform 0.5s 0.1s ease;
}
.po-section.active .po-content-eyebrow {
  opacity: 1;
  transform: translateX(0);
}
.po-content-divider {
  width: 48px;
  height: 0px;
  background: var(--po-border-hi);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 0.4s 0.2s ease,
    transform 0.5s 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.po-section.active .po-content-divider {
  opacity: 1;
  transform: scaleX(1);
}

/* ——— Feature Focus Type overrides ——— */
.feature-focus-style {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(16px, 2vw, 32px);
  align-items: center;
  width: 100%;
  padding: 0 48 px; /* Minimized for desktop */
}
@media (max-width: 1500px) {
  .feature-focus-style {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 0 100px; /* Kept for small screens */
  }
}
.feature-focus-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.feature-focus-right {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Image Frame */
.feature-focus-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--po-img-radius, 4.5px);
  outline: 8.5px solid rgba(255, 192, 203, 0.153);
  outline-offset: 0px;
}
.feature-focus-frame.orientation-landscape {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.feature-focus-frame.orientation-portrait {
  width: auto;
  height: 65vh;
  aspect-ratio: 9 / 16;
}
.feature-focus-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  transform-origin: 0 0;
  will-change: transform;
}

/* Typography & Content */
.feature-focus-style h1 {
  font-family: var(--po-fd);
  font-size: clamp(2.5rem, .01rem + 5vw, 4.5rem);
  font-variation-settings: 'wght' 300;
  line-height: 0.9;
  letter-spacing: -0.00em;
  color: var(--po-text);
  max-inline-size: 10ch;
  margin: 0;
}
.feature-focus-content {
  font-family: "inter-variable", sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.3rem);
  font-weight: 300;
  color: var(--po-text-dim);
  line-height: 1.4;
  min-height: 4em; /* Prevent layout shift when swapping text */
}

/* Controls */
.feature-focus-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 4px -8px;
}
.feature-focus-btn {
  background: transparent;
  border: 1px solid var(--po-border-hi);
  color: var(--po-text);
  padding: 8px 18px;
  border-radius: 40px;
  font-family: var(--po-fd);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.feature-focus-btn:hover {
  background: var(--po-border-hi);
}
.feature-focus-btn.active {
  background: #FF69B4;
  color: #fff;
  border-color: transparent;
}

/* ——— Hotspot Tooltips ——— */
.po-hotspot {
  position: absolute;
  width: 28px;
  height: 28px;
  background: #FF69B4;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--po-border-hi);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--po-fd);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  z-index: 20;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, color 0.3s ease;
  pointer-events: auto;
  line-height: 1;
  padding: 0;
}

.po-hotspot::after {
  content: "+";
  text-box-trim: trim-both;
  text-box-edge: cap alphabetic;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-top: -1px;
}

.po-hotspot:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #FF69B4;
  transform: translate(-50%, -50%) scale(1.15);
}

.po-hotspot-label {
  position: absolute;
  top: 50%;
  left: calc(100% + 14px);
  transform: translateY(-50%) translateX(-8px);
  background: #FF69B4;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255, 255, 255, 0.95);
  padding: 8px 14px;
  border-radius: 6px;
  white-space: nowrap;
  font-family: "inter-variable", sans-serif;
  font-variation-settings: 'wght' 350;
  font-size: 13px;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.po-hotspot.right-aligned .po-hotspot-label {
    left: auto;
    right: calc(100% + 14px);
    transform: translateY(-50%) translateX(8px);
}

.po-hotspot:hover .po-hotspot-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
