/* ==========================================================================
   popout.css — click-to-expand cards for the Connectivity tiles and the
   Private-by-design assurance cards. A card pops out of its grid slot and
   travels to a centred, enlarged panel over a blurred scrim (FLIP motion is
   driven by popout.js; this file styles the resting + expanded states).
   Only transform / opacity animate during flight; layout is measured in JS.
   ========================================================================== */

/* --- Interactive affordance on collapsed cards --------------------------- */
.expandable {
  cursor: pointer;
}
.expandable:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

/* Corner hint that fades in on hover/focus so the card reads as expandable. */
.expand-hint {
  position: absolute;
  top: var(--s-12);
  right: var(--s-12);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text-tertiary);
  opacity: 0;
  transform: scale(0.88);
  transition: opacity var(--dur-med) var(--ease-std),
    transform var(--dur-med) var(--ease), color var(--dur-med) var(--ease-std);
  pointer-events: none;
}
.expand-hint .icon {
  width: 15px;
  height: 15px;
}
.expandable:hover .expand-hint,
.expandable:focus-visible .expand-hint {
  opacity: 1;
  transform: scale(1);
  color: var(--accent-text);
}

/* --- Scrim --------------------------------------------------------------- */
.popout-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-scrim);
  background: var(--scrim);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-slow) var(--ease-std),
    visibility var(--dur-slow) var(--ease-std);
}
.popout-scrim.is-on {
  opacity: 1;
  visibility: visible;
}

/* --- Placeholder that holds the grid slot while a card is out flying ------ */
.popout-placeholder {
  visibility: hidden;
  pointer-events: none;
}

/* --- Expanded panel ------------------------------------------------------ */
/* Geometry (top/left/width) is set inline by JS; this is the look. */
.is-expanded {
  position: fixed;
  z-index: var(--z-popout);
  margin: 0;
  opacity: 1 !important;
  overflow: auto;
  max-height: 88vh;
  padding: clamp(var(--s-24), 3vw, var(--s-48));
  gap: var(--s-16);
  cursor: default;
  /* Hint-of-multicolor: solid card interior, a subtle gradient border, and a
     soft indigo glow in the drop shadow. Emerald still dominates. */
  border: 1px solid transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box,
    var(--grad-multi) border-box;
  box-shadow: var(--shadow-8),
    0 40px 120px -55px color-mix(in srgb, var(--hue-indigo) 55%, transparent);
}
.is-expanded .expand-hint {
  display: none;
}
/* Let the wider panel breathe: bump the heading + body a step. */
.is-expanded h3 {
  font-size: var(--t-h2);
}
.is-expanded > p,
.is-expanded p {
  font-size: var(--t-body);
}
.is-expanded .tile__icon,
.is-expanded .assure__icon {
  width: 48px;
  height: 48px;
}
.is-expanded .tile__icon .icon,
.is-expanded .assure__icon .icon {
  width: 26px;
  height: 26px;
}

/* Close button, pinned to the panel's top-right corner. */
.popout__close {
  position: absolute;
  top: var(--s-16);
  right: var(--s-16);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  z-index: 3;
  transition: color var(--dur-fast) var(--ease-std),
    border-color var(--dur-fast) var(--ease-std),
    background-color var(--dur-fast) var(--ease-std);
}
.popout__close:hover {
  color: var(--text);
  border-color: var(--text-tertiary);
  background: var(--card);
}
.popout__close .icon {
  width: 18px;
  height: 18px;
}

/* --- Cursor-tracking gradient spotlight (the "alive" sheen) --------------- */
/* The card owns a stacking context so the spotlight can sit at z-index:-1 —
   above the card's own background but below all real content — without
   disturbing the absolutely-positioned hint / close button. */
.expandable {
  isolation: isolate;
}
.expandable::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
  /* A resting glow stays on even with no cursor on the card; hover/focus/expand
     lift it to full. Its position (--mx/--my) is lerp-smoothed in popout.js so
     it trails the cursor with a slight delay. */
  opacity: 0.5;
  transition: opacity var(--dur-med) var(--ease-std);
  background: radial-gradient(
      240px circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--accent) 24%, transparent),
      transparent 60%
    ),
    radial-gradient(
      360px circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--hue-indigo) 13%, transparent),
      transparent 62%
    );
}
.expandable:hover::after,
.expandable:focus-visible::after,
.is-expanded::after {
  opacity: 1;
}

/* Platform cards carry a version badge in the top-right corner; inset the head
   so the on-hover expand hint doesn't land on top of it. */
#platforms .plat-card__head {
  padding-right: var(--s-32);
}

/* --- Extra info revealed only when a card is expanded -------------------- */
.card-more {
  display: none;
  margin-top: var(--s-16);
  padding-top: var(--s-16);
  border-top: 1px solid var(--hairline);
}
.is-expanded .card-more {
  display: block;
  animation: moreIn 420ms var(--ease) 140ms both;
}
@keyframes moreIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.card-more__lead {
  color: var(--text-secondary);
  margin-bottom: var(--s-16);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.detail-list li {
  display: flex;
  gap: var(--s-12);
  align-items: flex-start;
  padding: var(--s-8);
  color: var(--text-secondary);
  font-size: var(--t-small);
}
.detail-list .icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--accent-text);
  margin-top: 2px;
}
.detail-list strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Reduced motion: the JS crossfades instead of FLIP; nothing to add ---- */
@media (prefers-reduced-motion: reduce) {
  .popout-scrim {
    transition: opacity var(--dur-med) linear, visibility var(--dur-med) linear;
  }
  .expandable::after {
    transition: none;
  }
}
