/* Device frame chrome — laptop, tablet, phone for web app embeds */

.device-frame {
  --device-bezel: #2a2e36;
  --device-bezel-mid: #1c1f24;
  --device-bezel-dark: #0e1014;
  --device-accent: rgba(196, 181, 160, 0.45);
  --device-glass: #f7f6f3;
  margin: 0 auto;
}

.device-frame__shell {
  position: relative;
  border-radius: 16px;
  background: linear-gradient(
    165deg,
    #3a4049 0%,
    var(--device-bezel) 22%,
    var(--device-bezel-mid) 55%,
    var(--device-bezel-dark) 100%
  );
  padding: 12px 12px 10px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 -1px 0 rgba(0, 0, 0, 0.4) inset,
    0 24px 64px -12px rgba(0, 0, 0, 0.7),
    0 8px 24px -8px rgba(0, 0, 0, 0.45);
}

.device-frame__chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.device-frame__brand {
  color: rgba(255, 255, 255, 0.68);
}

.device-frame__meta {
  margin-left: auto;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.28);
}

.device-frame__viewport {
  position: relative;
  padding: 2px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, #050607 0%, #0a0c0e 100%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.85),
    inset 0 2px 8px rgba(0, 0, 0, 0.55);
}

.device-frame__viewport::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 2px;
  border-radius: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 38%,
    transparent 100%
  );
  z-index: 2;
}

/* ── Laptop ── */

.device-frame--laptop {
  max-width: min(100%, 1200px);
}

.device-frame--laptop-finale {
  max-width: none;
  width: 100%;
}

.device-frame--laptop .device-frame__shell {
  border-radius: 14px 14px 0 0;
  padding: 10px 10px 0;
}

.device-frame--laptop .device-frame__viewport {
  border-radius: 6px 6px 0 0;
}

.device-frame--laptop .device-frame__camera {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a1c20;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.device-frame--laptop .device-frame__base {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -1px;
}

.device-frame--laptop .device-frame__hinge {
  display: block;
  width: 100%;
  height: 6px;
  background: linear-gradient(180deg, #141619 0%, #1c1f24 100%);
  border-radius: 0 0 2px 2px;
}

.device-frame--laptop .device-frame__keyboard {
  display: block;
  width: calc(100% + 48px);
  height: 14px;
  margin-top: -1px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(
    180deg,
    #252830 0%,
    #141619 100%
  );
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.55);
}

/* ── Tablet (iPad) ── */

.device-frame--tablet {
  max-width: min(100%, 640px);
}

.device-frame--tablet .device-frame__shell {
  border-radius: 22px;
  padding: 14px;
}

.device-frame--tablet .device-frame__viewport {
  border-radius: 12px;
}

.device-frame--tablet .device-frame__camera {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a1c20;
  margin: 0 auto 6px;
}

.device-frame--tablet .device-frame__home {
  display: block;
  width: 100px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

/* ── Phone ── */

.device-frame--phone {
  max-width: min(100%, 320px);
  margin-left: auto;
  margin-right: auto;
}

.device-frame--phone .device-frame__shell {
  border-radius: 36px;
  padding: 12px 10px 10px;
}

.device-frame--phone .device-frame__viewport {
  border-radius: 28px;
}

.device-frame--phone .device-frame__notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 24px;
  border-radius: 0 0 14px 14px;
  background: var(--device-bezel-dark);
  z-index: 3;
  pointer-events: none;
}

.device-frame--phone .device-frame__home {
  display: block;
  width: 96px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

/* ── Iframe viewport (inside device recess) ── */

.device-embed-frame {
  --demo-native-w: 1440;
  --demo-native-h: 900;
  container-type: inline-size;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(var(--demo-native-w) * 1px);
  margin: 0 auto;
  border-radius: inherit;
  overflow: clip;
  background: var(--device-glass);
}

.device-frame--tablet .device-embed-frame:not([class*="device-embed-frame--"]) {
  --demo-native-w: 820;
  --demo-native-h: 1180;
}

.device-frame--phone .device-embed-frame:not([class*="device-embed-frame--"]) {
  --demo-native-w: 390;
  --demo-native-h: 844;
}

/* Laptop — shared viewport (matches “Gather around the problem”) */
.device-embed-frame--workspace {
  --demo-native-w: 1440;
  --demo-native-h: 1024;
}

/* Tablet comps — must beat .device-frame--tablet defaults */
.device-frame--tablet .device-embed-frame.device-embed-frame--inbox-tablet {
  --demo-native-w: 860;
  --demo-native-h: 1100;
}

.device-frame--tablet .device-embed-frame.device-embed-frame--posture-tablet {
  --demo-native-w: 768;
  --demo-native-h: 1000;
}

/* Phone comps — must beat .device-frame--phone defaults */
.device-frame--phone .device-embed-frame.device-embed-frame--mobile {
  --demo-native-w: 448;
  --demo-native-h: 920;
}

.device-frame--phone .device-embed-frame.device-embed-frame--posture-phone {
  --demo-native-w: 390;
  --demo-native-h: 780;
}

.device-embed-scaler {
  width: calc(var(--demo-native-w) * 1px);
  height: calc(var(--demo-native-h) * 1px);
  transform-origin: top left;
  will-change: transform;
}

.device-embed-scaler iframe {
  display: block;
  width: calc(var(--demo-native-w) * 1px);
  height: calc(var(--demo-native-h) * 1px);
  border: 0;
  overflow: hidden;
  background: var(--device-glass);
}

/* Lazy-load shimmer */
[data-embed-lazy]:not(.is-loaded) .device-embed-frame {
  background:
    linear-gradient(
      110deg,
      #f0efec 8%,
      #ffffff 18%,
      #f0efec 33%
    );
  background-size: 200% 100%;
}

[data-embed-lazy]:not(.is-loaded) .device-embed-scaler iframe {
  visibility: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  [data-embed-lazy]:not(.is-loaded) .device-embed-frame {
    animation: device-shimmer 1.6s ease-in-out infinite;
  }
}

@keyframes device-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Tri-device responsive showcase row */
.case-devices {
  display: grid;
  gap: var(--space-lg);
  align-items: end;
  margin-top: var(--space-lg);
}

@media (min-width: 900px) {
  .case-devices {
    grid-template-columns: 1fr minmax(200px, 0.55fr) minmax(140px, 0.32fr);
    gap: var(--space-md);
  }
}

.case-devices__label {
  display: block;
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
  text-align: center;
}

@media (max-width: 640px) {
  .device-frame--laptop .device-frame__shell {
    padding: 8px 8px 0;
    border-radius: 12px 12px 0 0;
  }

  .device-frame--tablet .device-frame__shell {
    border-radius: 18px;
    padding: 10px;
  }

  .device-frame--phone .device-frame__shell {
    border-radius: 28px;
    padding: 10px 8px 8px;
  }
}
