/* ==========================================================================
   Portal SSM Holding — v2 "Liquid Glass"
   Apple-dark: black ground, video under a vignette, glass tiles tinted per
   app with Apple system hues. Previous look: git tag v1-original.
   ========================================================================== */

:root {
  --bg: #000000;
  --ink: #f5f5f7;
  --ink-2: rgba(235, 235, 245, 0.74);
  --ink-3: rgba(235, 235, 245, 0.56);
  --hairline: rgba(255, 255, 255, 0.12);
  --focus: #0a84ff;

  --radius: 28px;
  --radius-inner: 18px;

  /* Glass material */
  --glass-fill-top: rgba(255, 255, 255, 0.13);
  --glass-fill-bottom: rgba(255, 255, 255, 0.045);
  --glass-blur: blur(28px) saturate(180%);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.35), 0 28px 56px -24px rgba(0, 0, 0, 0.75);
  --glass-shadow-lift: inset 0 1px 0 rgba(255, 255, 255, 0.34), inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.35), 0 40px 80px -28px rgba(0, 0, 0, 0.85);

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Apple's own UI curve (sheets, springs without overshoot) */
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --z-content: 10;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: rgba(10, 132, 255, 0.55);
  color: #fff;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 80%, white);
  outline-offset: 3px;
}

html {
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.34);
  background-clip: padding-box;
}

svg use {
  pointer-events: none;
}

/* ---- Ground: brand video under a vignette ---- */

.bg-video {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(60% 38% at 50% 14%, rgba(0, 0, 0, 0.38), transparent 75%),
    radial-gradient(130% 90% at 50% 20%, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0.86) 100%);
}

.wrap {
  position: relative;
  z-index: var(--z-content);
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 72px) clamp(16px, 4vw, 40px) clamp(40px, 6vw, 72px);
}

/* Carousel view: the hero fills one viewport, no scroll needed */
html[data-view="carousel"] .hero {
  min-height: calc(100svh - clamp(110px, 14vh, 150px));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---- Header ---- */

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: clamp(28px, 5vh, 52px);
}

.logo {
  height: clamp(52px, min(8vh, 11vw), 80px);
  width: auto;
  display: block;
  margin-bottom: clamp(18px, 3vh, 30px);
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, min(8vh, 7vw), 4.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  word-spacing: 0.08em;
  line-height: 1;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
}

.sub {
  margin: clamp(12px, 2vh, 18px) 0 0;
  max-width: 58ch;
  color: var(--ink-2);
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.005em;
  text-wrap: pretty;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.7);
}

/* ---- Segmented control (glass, sliding thumb) ---- */

.view-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: clamp(22px, 3.4vh, 32px);
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 30px -12px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.view-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #ececf1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 4px 14px -4px rgba(0, 0, 0, 0.55);
  transition: transform 0.5s var(--ease-apple);
}

.view-toggle[data-active="carousel"]::before {
  transform: translateX(100%);
}

.view-toggle-btn {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  cursor: pointer;
  min-width: 108px;
  padding: 9px 20px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: 600 0.95rem/1.2 var(--font);
  letter-spacing: -0.005em;
  transition: color 0.4s var(--ease-apple);
}

.view-toggle-btn:hover {
  color: var(--ink);
}

.view-toggle-btn[aria-pressed="true"] {
  color: #1d1d1f;
}

.view-toggle-btn:active {
  transform: scale(0.97);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- View switching (grid is always the opening view) ---- */

#carouselView {
  display: none;
}

html[data-view="carousel"] #carouselView {
  display: block;
}

html[data-view="carousel"] #gridView {
  display: none;
}

/* ---- Grid ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 22px);
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Liquid glass material
   `.glass` is an absolutely positioned layer inside any positioned host:
   fill + blur + depth on the layer, a lit rim on ::after, a pointer-tracked
   specular highlight on ::before (JS feeds --mx / --my on the host).
   ========================================================================== */

.glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 85% at 0% 0%, color-mix(in srgb, var(--accent, #fff) 32%, transparent), transparent 60%),
    radial-gradient(90% 60% at 100% 112%, color-mix(in srgb, var(--accent, #fff) 15%, transparent), transparent 70%),
    linear-gradient(180deg, var(--glass-fill-top), var(--glass-fill-bottom));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  transition: opacity 0.35s var(--ease-apple), box-shadow 0.5s var(--ease-apple), background-color 0.5s var(--ease-apple);
}

/* Lit rim: bright where light hits (top-left), almost gone at the sides,
   a softer return along the bottom — a 1px gradient border via mask. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.62),
    rgba(255, 255, 255, 0.14) 28%,
    rgba(255, 255, 255, 0.04) 55%,
    color-mix(in srgb, var(--accent, #fff) 45%, rgba(255, 255, 255, 0.2)) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: opacity 0.5s var(--ease-apple);
}

/* Specular: light catching the glass where the pointer is */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    320px circle at var(--mx, 20%) var(--my, 0%),
    rgba(255, 255, 255, 0.16),
    color-mix(in srgb, var(--accent, #fff) 8%, transparent) 40%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.5s var(--ease-apple);
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  position: relative;
  display: block;
  min-height: 236px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.card-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100%;
  min-height: inherit;
  padding: 22px 22px 18px;
  transition: opacity 0.4s var(--ease-apple), transform 0.6s var(--ease-apple), filter 0.4s var(--ease-apple);
}

.card:hover .glass,
.card:focus-visible .glass {
  box-shadow: var(--glass-shadow-lift);
}

.card:hover .glass::before,
.card:focus-within .glass::before {
  opacity: 1;
}

.card:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* App icon — an iOS-style tile in the app's own hue: gradient body,
   glossy top light, authored white/ink glyph (--on-accent) */
.card-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 15px;
  overflow: hidden;
  color: var(--on-accent, #fff);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--accent) 78%, white) 0%,
    var(--accent) 48%,
    color-mix(in srgb, var(--accent) 74%, black) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 0 0 0.5px rgba(0, 0, 0, 0.3), 0 12px 24px -10px rgba(0, 0, 0, 0.7),
    0 8px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 0.6s var(--ease-apple);
}

/* Gloss: light falling on the upper half of the tile */
.card-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 52%);
  pointer-events: none;
}

.card-icon svg {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.card:hover .card-icon {
  transform: scale(1.06) rotate(-3deg);
}

/* Three zones, App Store–style: identity (icon + name) on one row,
   the one-line job below it, the action alone at bottom-right behind a
   hairline. Reading runs top-left to bottom-right and ends on the press. */
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-name {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.card-desc {
  margin: 14px 0 18px; /* bottom margin = least air above the action zone */
  color: var(--ink-2);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.003em;
  text-wrap: pretty;
}

.card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 16px;
  position: relative;
}

/* Hairline that divides the action zone from the content */
.card-foot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
}

/* ==========================================================================
   "Vezi app" — tinted glass pill with a shine pass
   ========================================================================== */

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  margin-top: auto;
  padding: 0 6px 0 18px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  color: #fff;
  font: 700 0.97rem/1 var(--font);
  letter-spacing: -0.01em;
  background: color-mix(in srgb, var(--accent) 24%, rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent),
    0 10px 24px -12px color-mix(in srgb, var(--accent) 80%, black);
  transition: background-color 0.4s var(--ease-apple), box-shadow 0.4s var(--ease-apple), transform 0.25s var(--ease-apple);
}

.cta-label {
  position: relative;
  z-index: 2;
}

.cta-arrow {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent, #fff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.5s var(--ease-apple);
}

.cta-arrow svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The shine: a skewed streak of light crossing the pill. Idle, it rolls
   across the grid as a slow cascading wave (per-card delay via --i);
   on hover/focus it fires immediately. */
.cta::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 46%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 25%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.08) 75%,
    transparent 100%
  );
  transform: translateX(-130%) skewX(-18deg);
  animation: cta-shine-idle 7s var(--ease-out) infinite;
  animation-delay: calc(1.2s + var(--i, 0) * 0.18s);
  pointer-events: none;
}

@keyframes cta-shine-idle {
  0% {
    transform: translateX(-130%) skewX(-18deg);
  }
  16%,
  100% {
    transform: translateX(260%) skewX(-18deg);
  }
}

@keyframes cta-shine-now {
  from {
    transform: translateX(-130%) skewX(-18deg);
  }
  to {
    transform: translateX(260%) skewX(-18deg);
  }
}

.card:hover .card-foot > .cta::after,
.card:focus-visible .card-foot > .cta::after,
.cta:focus-visible::after,
.split-pane:hover .cta::after,
.split-pane:focus-visible .cta::after,
.carousel-item.just-arrived .card-foot > .cta::after {
  animation: cta-shine-now 0.9s var(--ease-out) 1 both;
}

.card:hover .card-foot > .cta,
.card:focus-visible .card-foot > .cta,
.split-pane:hover .cta,
.split-pane:focus-visible .cta {
  background: color-mix(in srgb, var(--accent) 40%, rgba(255, 255, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 0 0 1px color-mix(in srgb, var(--accent) 80%, transparent),
    0 14px 30px -12px var(--accent);
}

.card:hover .card-foot > .cta .cta-arrow,
.card:focus-visible .card-foot > .cta .cta-arrow,
.split-pane:hover .cta-arrow,
.split-pane:focus-visible .cta-arrow {
  transform: translate(2px, -2px) rotate(0deg);
}

/* Instant press feedback, on pointer-down */
.card:active .card-foot > .cta,
.cta:active,
.split-pane:active .cta {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

.cta--sm {
  height: 38px;
  gap: 9px;
  padding: 0 5px 0 14px;
  font-size: 0.9rem;
}

.cta--sm .cta-arrow {
  width: 28px;
  height: 28px;
}

/* ==========================================================================
   Split card (Onboarding): the glass cracks into two panes
   ========================================================================== */

/* The whole closed card is the press target, not only its pill */
.card--split:not(.is-split) .card-main {
  cursor: pointer;
}

.card--split:active:not(.is-split) {
  transform: scale(0.99);
}

.split {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
}

.split-pane {
  --pane-gap: 6px;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 18px 18px;
  color: inherit;
  text-decoration: none;
  isolation: isolate;
  opacity: 0;
  transition: opacity 0.3s var(--ease-apple), width 0.75s var(--ease-apple), border-radius 0.75s var(--ease-apple),
    transform 0.25s var(--ease-apple);
  -webkit-tap-highlight-color: transparent;
}

.split-pane--a {
  left: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.split-pane--b {
  right: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.split-pane > :not(.glass) {
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  filter: blur(6px);
  transition: opacity 0.25s var(--ease-apple), transform 0.5s var(--ease-apple), filter 0.35s var(--ease-apple);
}

.split-glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  color: var(--on-accent, #fff);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--accent) 78%, white) 0%,
    var(--accent) 48%,
    color-mix(in srgb, var(--accent) 74%, black) 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(0, 0, 0, 0.22),
    0 0 0 0.5px rgba(0, 0, 0, 0.3), 0 10px 20px -10px rgba(0, 0, 0, 0.7);
}

.split-glyph::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 52%);
}

.split-glyph svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.split-title {
  margin-top: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.split-sub {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  text-wrap: balance;
}

.split-pane .cta {
  margin-top: auto;
  align-self: flex-end;
}

.split-pane:hover .glass::before,
.split-pane:focus-visible .glass::before {
  opacity: 1;
}

.split-pane:hover .glass,
.split-pane:focus-visible .glass {
  box-shadow: var(--glass-shadow-lift);
}

.split-pane:focus-visible {
  outline-offset: 2px;
}

.split-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  background: rgba(40, 40, 46, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 6px 16px -6px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  opacity: 0;
  transform: translateX(-50%) scale(0.5);
  transition: opacity 0.25s var(--ease-apple), transform 0.5s var(--ease-apple), background-color 0.3s var(--ease-apple);
}

.split-close::before {
  /* 44px hit area around the 34px visual */
  content: "";
  position: absolute;
  inset: -5px;
}

.split-close:hover {
  background: rgba(70, 70, 78, 0.85);
}

.split-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

/* -- open state -- */

.card.is-split > .glass {
  opacity: 0;
}

.card.is-split .card-main {
  opacity: 0;
  transform: scale(0.96);
  filter: blur(8px);
  pointer-events: none;
}

.card.is-split .split {
  pointer-events: auto;
}

.card.is-split .split-pane {
  opacity: 1;
  width: calc(50% - var(--pane-gap));
}

.card.is-split .split-pane--a {
  border-radius: var(--radius) var(--radius-inner) var(--radius-inner) var(--radius);
}

.card.is-split .split-pane--b {
  border-radius: var(--radius-inner) var(--radius) var(--radius) var(--radius-inner);
}

.card.is-split .split-pane > :not(.glass) {
  opacity: 1;
  transform: none;
  filter: none;
}

.card.is-split .split-pane > :nth-child(2) { transition-delay: 0.12s; }
.card.is-split .split-pane > :nth-child(3) { transition-delay: 0.17s; }
.card.is-split .split-pane > :nth-child(4) { transition-delay: 0.21s; }
.card.is-split .split-pane > :nth-child(5) { transition-delay: 0.25s; }
.card.is-split .split-pane--b > :nth-child(2) { transition-delay: 0.18s; }
.card.is-split .split-pane--b > :nth-child(3) { transition-delay: 0.23s; }
.card.is-split .split-pane--b > :nth-child(4) { transition-delay: 0.27s; }
.card.is-split .split-pane--b > :nth-child(5) { transition-delay: 0.31s; }

.card.is-split .split-close {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  transition-delay: 0.22s;
}

.split-pane:active {
  transform: scale(0.985);
}

/* ==========================================================================
   Carousel (coverflow of the same glass cards)
   ========================================================================== */

.carousel-stage {
  position: relative;
  /* Full-bleed: side cards fade out at the viewport edge, not at the
     content column, so nothing is visibly cut off mid-card. */
  margin-inline: calc(50% - 50vw);
  height: clamp(330px, min(44vh, 44vw), 440px);
  overflow: hidden;
  touch-action: pan-y;
}

/* Carousel must fit one viewport: the header tightens around it */
html[data-view="carousel"] .wrap {
  padding-top: clamp(20px, 4vh, 48px);
}

html[data-view="carousel"] .header {
  padding-bottom: clamp(4px, 1.5vh, 20px);
}

html[data-view="carousel"] .logo {
  margin-bottom: clamp(12px, 2vh, 24px);
}

.carousel-track {
  position: absolute;
  inset: 0;
}

.carousel-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(290px, min(30vw, 44vh), 380px);
  min-height: 250px;
  cursor: pointer;
}

/* Depth fade on the layers (JS sets --o per position), not on the card:
   keeps backdrop-filter alive so side cards are real glass too and the
   centred one is fully liquid the moment it lands. */
.carousel-item > .glass,
.carousel-item > .card-main {
  opacity: var(--o, 1);
}

.carousel-item .glass {
  transition: opacity 0.45s var(--ease-apple), box-shadow 0.6s var(--ease-apple);
}

.carousel-item.is-active .glass {
  box-shadow: var(--glass-shadow-lift);
}

.carousel-item:not(.is-active) .cta::after {
  animation: none;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: clamp(14px, 2.4vh, 26px);
}

.carousel-arrow {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.3s var(--ease-apple), transform 0.2s var(--ease-apple);
}

.carousel-arrow:hover {
  background: rgba(255, 255, 255, 0.16);
}

.carousel-arrow:active {
  transform: scale(0.92);
  transition-duration: 0.1s;
}

.carousel-arrow svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.carousel-dot {
  position: relative;
  appearance: none;
  padding: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: width 0.5s var(--ease-apple), background-color 0.4s var(--ease-apple);
}

.carousel-dot::before {
  content: "";
  position: absolute;
  inset: -12px -5px;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.carousel-dot[aria-current="true"] {
  width: 26px;
  background: var(--ink);
}

.swipe-hint {
  display: none;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin: 12px 0 0;
  color: var(--ink-3);
  font-size: 0.82rem;
  font-weight: 600;
}

.swipe-hint svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: swipe-nudge 1.8s ease-in-out infinite;
}

@keyframes swipe-nudge {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.7;
  }
  50% {
    transform: translateX(4px);
    opacity: 1;
  }
}

/* ---- Footer ---- */

.footer {
  margin-top: clamp(48px, 8vw, 88px);
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 0.82rem;
  font-weight: 500;
}

.footer a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.3s var(--ease-apple);
}

.footer a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* No-JS / no-GSAP fallback hover lift */
.no-js .card {
  transition: transform 0.5s var(--ease-apple);
}

.no-js .card:hover {
  transform: translateY(-4px);
}

.no-js .carousel-item {
  transition: transform 0.6s var(--ease-apple);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
  .card {
    min-height: 0;
  }

  .card-main {
    padding: 20px 20px 16px;
  }

  .split-pane {
    padding: 20px 14px 14px;
  }

  .carousel-stage {
    height: clamp(320px, min(56vh, 96vw), 420px);
  }

  .carousel-item {
    width: clamp(260px, 80vw, 320px);
    min-height: 236px;
  }

  .carousel-arrow {
    display: none;
  }

  .swipe-hint {
    display: flex;
  }

  /* Lighter blur on phones: many glass layers over a playing video */
  .glass {
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
  }

  .wrap {
    padding-top: max(28px, env(safe-area-inset-top));
  }

  .footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

@media (max-height: 640px) {
  .carousel-stage {
    height: clamp(300px, 52vh, 360px);
  }
}

/* ==========================================================================
   Accessibility preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .cta::after,
  .swipe-hint svg {
    animation: none !important;
  }

  .card-main,
  .split-pane,
  .split-pane > *,
  .split-close,
  .glass,
  .card-icon,
  .cta,
  .cta-arrow,
  .view-toggle::before {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .card.is-split .card-main {
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass,
  .view-toggle,
  .carousel-arrow,
  .split-close {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .glass {
    background: radial-gradient(120% 85% at 0% 0%, color-mix(in srgb, var(--accent, #fff) 16%, transparent), transparent 58%),
      #1c1c1e;
  }

  .view-toggle {
    background: #1c1c1e;
  }
}

@media (prefers-contrast: more) {
  .glass::after {
    background: rgba(255, 255, 255, 0.7);
  }

  .card-desc,
  .split-sub,
  .sub {
    color: var(--ink);
  }
}
