:root {
  --paper: #efefed;
  --ink: #101010;
  --footer-h: 74px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.98) 0 18%, rgba(255,255,255,.42) 42%, transparent 66%),
    linear-gradient(115deg, rgba(0,0,0,.018) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 22px 22px, auto;
}

button, a { -webkit-tap-highlight-color: transparent; }

.gallery-shell {
  height: calc(100svh - var(--footer-h));
  min-height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wordmark {
  height: clamp(58px, 9vh, 86px);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-family: "Manrope", sans-serif;
  font-size: 12px;
  letter-spacing: .19em;
  color: #858583;
}

.wordmark strong { color: var(--ink); font-size: 19px; letter-spacing: -.02em; }

.gallery {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 0 clamp(18px, 4vw, 70px) clamp(20px, 5vh, 48px);
  perspective: 1500px;
}

.device-scene {
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  width: min(1180px, 92vw, calc((100svh - var(--footer-h) - 116px) * 1.709));
  aspect-ratio: 1639 / 959;
  filter: drop-shadow(0 30px 26px rgba(0,0,0,.17));
}

.device-shell {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .18s ease-out;
  will-change: transform;
}

.device-shadow {
  position: absolute;
  left: 17%;
  right: 17%;
  bottom: -2%;
  height: 8%;
  border-radius: 50%;
  background: rgba(0,0,0,.2);
  filter: blur(24px);
  transform: translateZ(-40px);
}

.duo-frame {
  position: absolute;
  inset: 0;
  z-index: 12;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: translateZ(24px);
  filter: drop-shadow(0 4px 5px rgba(0,0,0,.23));
}

.screen-panel {
  position: absolute;
  top: 5.6%;
  bottom: 5.6%;
  z-index: 2;
  overflow: hidden;
  background: #111;
  transform: translateZ(3px);
}

.screen-left {
  left: 15.8%;
  width: 34.3%;
  clip-path: polygon(0 0, 100% 6.1%, 100% 93.9%, 0 100%);
  border-radius: 7.5% 0 0 7.5% / 5.5% 0 0 5.5%;
}

.screen-right {
  right: 15.8%;
  width: 34.3%;
  clip-path: polygon(0 6.1%, 100% 0, 100% 100%, 0 93.9%);
  border-radius: 0 7.5% 7.5% 0 / 0 5.5% 5.5% 0;
}

.screen-content { position: absolute; inset: 0; overflow: hidden; background: #101010; }
.card-stage, .media-card { position: absolute; inset: 0; }

.media-card {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #121212;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: transform .52s cubic-bezier(.18,.84,.23,1), opacity .34s ease, filter .34s ease;
  will-change: transform, opacity;
}

.media-card.is-leaving-up { transform: translateY(-28%) scale(.94); opacity: 0; filter: blur(4px); }
.media-card.is-leaving-down { transform: translateY(28%) scale(.94); opacity: 0; filter: blur(4px); }
.media-card.is-entering-up { animation: enter-up .52s cubic-bezier(.18,.84,.23,1) both; }
.media-card.is-entering-down { animation: enter-down .52s cubic-bezier(.18,.84,.23,1) both; }

@keyframes enter-up {
  from { transform: translateY(30%) scale(.94); opacity: 0; filter: blur(4px); }
  to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}

@keyframes enter-down {
  from { transform: translateY(-30%) scale(.94); opacity: 0; filter: blur(4px); }
  to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}

.media-backdrop {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  object-fit: cover;
  filter: blur(24px) saturate(.82) brightness(.62);
  transform: scale(1.08);
  opacity: .94;
}

.media-main {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.3));
}

.empty-card {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.08), transparent 44%), linear-gradient(145deg, #1a1a1a, #090909);
  color: #6e6e6b;
  font: 600 clamp(9px, 1vw, 12px)/1 "Manrope", sans-serif;
  letter-spacing: .16em;
}

.screen-shade {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent 19%, transparent 79%, rgba(0,0,0,.55)), linear-gradient(105deg, rgba(255,255,255,.10), transparent 18%, transparent 72%, rgba(0,0,0,.15));
}

.screen-left .screen-shade { box-shadow: inset -18px 0 30px rgba(0,0,0,.2); }
.screen-right .screen-shade { box-shadow: inset 18px 0 30px rgba(0,0,0,.2); }

.screen-label {
  position: absolute;
  z-index: 7;
  top: 9%;
  left: 8%;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,.94);
  font: 700 clamp(8px, .85vw, 12px)/1 "Manrope", sans-serif;
  letter-spacing: .13em;
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
  pointer-events: none;
}

.screen-label span { color: rgba(255,255,255,.5); font-weight: 500; }

.nav-arrow {
  position: absolute;
  z-index: 8;
  left: 50%;
  width: clamp(34px, 3.1vw, 46px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  background: rgba(8,8,8,.44);
  color: #fff;
  backdrop-filter: blur(9px);
  transform: translateX(-50%);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, opacity .18s ease, transform .18s ease;
}

.nav-up { top: 7.5%; }
.nav-down { bottom: 7.5%; }
.nav-arrow:hover:not(:disabled) { background: rgba(8,8,8,.78); border-color: rgba(255,255,255,.58); }
.nav-up:hover:not(:disabled) { transform: translate(-50%, -3px); }
.nav-down:hover:not(:disabled) { transform: translate(-50%, 3px); }
.nav-arrow:disabled { opacity: .22; cursor: default; }
.nav-arrow svg { width: 52%; height: 52%; fill: none; stroke: currentColor; stroke-width: 1.7; }

.rail-counter {
  position: absolute;
  z-index: 7;
  right: 8%;
  bottom: 10%;
  color: rgba(255,255,255,.68);
  font-size: clamp(8px, .8vw, 11px);
  font-variant-numeric: tabular-nums;
  letter-spacing: .11em;
  text-shadow: 0 1px 7px rgba(0,0,0,.85);
}

.center-fold {
  position: absolute;
  z-index: 9;
  top: 10%;
  bottom: 10%;
  left: 50%;
  width: 1.6%;
  transform: translateX(-50%) translateZ(12px);
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.34), rgba(255,255,255,.13) 47%, rgba(0,0,0,.32));
  filter: blur(2.5px);
  opacity: .72;
}

.glass-light {
  position: absolute;
  z-index: 10;
  top: 9%;
  left: 20%;
  width: 48%;
  height: 30%;
  transform: rotate(-7deg) translateZ(16px);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,.12), transparent 60%);
  filter: blur(10px);
  pointer-events: none;
  mix-blend-mode: screen;
}

.site-footer {
  height: var(--footer-h);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 0 max(20px, env(safe-area-inset-right)) max(0px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  color: #fff;
  background: #090909;
}

.footer-nav { width: min(720px, 100%); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(18px, 5vw, 60px); }
.footer-side { display: flex; align-items: center; gap: 24px; }
.footer-left { justify-content: flex-end; }
.footer-right { justify-content: flex-start; }

.footer-side a { color: #9d9d9d; font-size: 13px; text-decoration: none; white-space: nowrap; transition: color .18s ease; }
.footer-side a:hover { color: #fff; }

.copy-ca {
  position: relative;
  width: 76px;
  height: 42px;
  border: 1px solid #303030;
  border-radius: 999px;
  color: #fff;
  background: #111;
  cursor: pointer;
  font: 700 13px/1 "Manrope", sans-serif;
  letter-spacing: .08em;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.copy-ca:hover { background: #1a1a1a; border-color: #555; transform: translateY(-1px); }
.copy-ca span { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .2s ease, transform .2s ease; }
.copy-success { opacity: 0; transform: translateY(5px); font-size: 9px; }
.copy-ca.is-copied .copy-default { opacity: 0; transform: translateY(-5px); }
.copy-ca.is-copied .copy-success { opacity: 1; transform: translateY(0); }

@media (max-width: 700px) {
  :root { --footer-h: 68px; }
  .gallery-shell { min-height: 430px; }
  .wordmark { height: 62px; }
  .gallery { padding: 0 6px 24px; }
  .device-scene { width: min(99vw, calc((100svh - var(--footer-h) - 95px) * 1.709)); }
  .screen-panel { top: 5.8%; bottom: 5.8%; }
  .nav-arrow { width: 30px; }
  .screen-label { left: 10%; }
  .rail-counter { right: 10%; }
  .footer-nav { gap: 11px; }
  .footer-side { gap: 10px; }
  .footer-side a { font-size: 11px; }
  .copy-ca { width: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .device-shell { transform: none !important; }
}

/* DUO SCREEN PERSPECTIVE FIX */

/*
  The outer edge stays closer to the viewer.
  The inner edge recedes toward the center hinge.
*/
.screen-panel {
  perspective: 850px;
  transform-style: preserve-3d;
}

.screen-content {
  backface-visibility: hidden;
  will-change: transform;
}

.screen-left .screen-content {
  transform-origin: 0% 50%;
  transform:
    perspective(850px)
    rotateY(12deg)
    scaleX(1.08)
    scaleY(1.015);
}

.screen-right .screen-content {
  transform-origin: 100% 50%;
  transform:
    perspective(850px)
    rotateY(-12deg)
    scaleX(1.08)
    scaleY(1.015);
}

/* Brighter navigation buttons */
.nav-arrow {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  opacity: 1;
}

.nav-arrow svg {
  stroke-width: 2.25;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.65));
}

.nav-arrow:disabled {
  opacity: 0.78;
}

.nav-arrow:hover:not(:disabled) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.95);
}


/* DUO BACKGROUND + SHADOW POLISH */
body {
  background:
    radial-gradient(ellipse 34% 42% at 8% 22%,
      rgba(52, 142, 255, 0.28) 0%,
      rgba(52, 142, 255, 0.13) 42%,
      transparent 72%),
    radial-gradient(ellipse 30% 38% at 94% 24%,
      rgba(125, 82, 255, 0.23) 0%,
      rgba(125, 82, 255, 0.10) 45%,
      transparent 74%),
    radial-gradient(ellipse 36% 30% at 76% 88%,
      rgba(30, 190, 210, 0.18) 0%,
      rgba(30, 190, 210, 0.07) 48%,
      transparent 76%),
    radial-gradient(ellipse 28% 25% at 22% 86%,
      rgba(80, 105, 145, 0.14) 0%,
      rgba(80, 105, 145, 0.05) 50%,
      transparent 78%),
    radial-gradient(circle at 50% 43%,
      rgba(255,255,255,0.78) 0 16%,
      rgba(255,255,255,0.30) 40%,
      transparent 65%),
    var(--paper);
}

.device-shadow {
  left: 23%;
  right: 23%;
  bottom: -0.5%;
  height: 5.5%;
  background: rgba(0, 0, 0, 0.24);
  filter: blur(19px);
  opacity: 0.72;
  transform: translateY(28%) translateZ(-40px);
}
