/* Device frames, demo pointer and scene list for the product demos (js/showcase.js) */

.demo {
  position: relative;
  width: 100%;
}
.demo-fallback {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--faint);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
}

.device {
  position: relative;
  margin-inline: auto;
}

/* Browser */
.device--browser {
  border-radius: 14px;
  background: var(--chrome, #191714);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 70px 120px -40px rgba(0, 0, 0, 0.8),
    0 30px 60px -30px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.device-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
}
.device-bar > i {
  flex: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ff5f57;
}
.device-bar > i:nth-child(2) { background: #febc2e; }
.device-bar > i:nth-child(3) { background: #28c840; }
.device-url {
  position: absolute;
  left: 50%;
  top: 7px;
  transform: translateX(-50%);
  width: min(46%, 340px);
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 7px;
  background: var(--chrome-pill, rgba(255, 255, 255, 0.065));
  color: var(--chrome-ink, rgba(244, 238, 230, 0.62));
  font: 500 11.5px/1 var(--font-sans);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
}
.device-url svg { flex: none; opacity: 0.8; }

.device-viewport {
  position: relative;
  aspect-ratio: var(--dw) / var(--dh);
  overflow: hidden;
  background: #000;
}
.device-screen {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--dw) * 1px);
  height: calc(var(--dh) * 1px);
  transform: scale(var(--s, 1));
  transform-origin: 0 0;
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.demo[data-demo="meeting"] { --chrome: #17120f; }
.demo[data-demo="kuro"] { --chrome: #0c0c1f; }
.demo[data-demo="agent"] { --chrome: #0a0e13; }
.demo[data-demo="video"] { --chrome: #08080a; }
.demo[data-demo="rag"] { --chrome: #e6e9e4; --chrome-ink: #56605a; --chrome-pill: rgba(0, 0, 0, 0.06); }
.demo[data-demo="docai"] { --chrome: #e4e8f0; --chrome-ink: #56627a; --chrome-pill: rgba(0, 0, 0, 0.06); }

/* Phone */
.device--phone {
  width: 100%;
  max-width: 320px;
  padding: 10px;
  border-radius: 52px;
  background: linear-gradient(150deg, #3a352f 0%, #121110 38%, #0b0a09 70%, #26221e 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 0 0 4px #050505,
    0 70px 120px -40px rgba(0, 0, 0, 0.85),
    0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.device--phone::before,
.device--phone::after {
  content: "";
  position: absolute;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #4a443d, #1a1816);
}
.device--phone::before { left: -3px; top: 21%; height: 11%; box-shadow: 0 calc(13% + 46px) 0 #2b2724; }
.device--phone::after { right: -3px; top: 27%; height: 15%; }
.device--phone .device-viewport { border-radius: 42px; }

.phone-status {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: 0;
  height: 48px;
  padding: 2px 28px 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--status, #111);
  font: 600 15px/1 -apple-system, "SF Pro Text", "Segoe UI", "Noto Sans TC", sans-serif;
  letter-spacing: 0.01em;
  pointer-events: none;
  transition: color 0.4s;
}
.phone-icons { display: flex; align-items: center; gap: 6px; }
.phone-island {
  position: absolute;
  z-index: 31;
  top: 11px;
  left: 50%;
  width: 104px;
  height: 30px;
  margin-left: -52px;
  border-radius: 20px;
  background: #000;
}
.phone-home {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 8px;
  width: 124px;
  height: 5px;
  margin-left: -62px;
  border-radius: 3px;
  background: var(--home, rgba(0, 0, 0, 0.32));
  transition: background 0.4s;
}

/* Pointer (design coordinates, inside the scaled screen) */
.demo-pointer {
  position: absolute;
  z-index: 40;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  transition-property: transform, opacity;
  transition-timing-function: cubic-bezier(0.5, 0, 0.15, 1);
}
.demo-pointer.is-on { opacity: 1; }
.demo-pointer svg {
  position: absolute;
  left: -6px;
  top: -3px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}
.demo-pointer i {
  position: absolute;
  left: -20px;
  top: -20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  opacity: 0;
}
.demo-pointer.is-down svg { animation: ptr-press 0.28s ease; }
.demo-pointer.is-down i { animation: ptr-ripple 0.6s ease-out; }
.demo-pointer.is-touch i {
  left: -22px;
  top: -22px;
  width: 44px;
  height: 44px;
  opacity: 1;
  background: rgba(255, 255, 255, 0.38);
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(1px);
}
.demo-pointer.is-touch.is-down i { animation: touch-press 0.5s ease; }

@keyframes ptr-press { 50% { transform: scale(0.84); } }
@keyframes ptr-ripple {
  0% { opacity: 0.95; transform: scale(0.3); }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes touch-press {
  30% { transform: scale(0.76); background: rgba(255, 255, 255, 0.62); }
}

/* Typing caret used by t.type() */
.device-screen .is-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  background: currentColor;
  animation: caret 0.9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* Out of view: freeze CSS loops. Reduced motion: show end states. */
.demo.is-ready:not(.is-playing):not(.is-static) .device-screen *,
.demo.is-ready:not(.is-playing):not(.is-static) .device-screen *::before,
.demo.is-ready:not(.is-playing):not(.is-static) .device-screen *::after {
  animation-play-state: paused !important;
}
.demo.is-static .device-screen *,
.demo.is-static .device-screen *::before,
.demo.is-static .device-screen *::after {
  transition: none !important;
  animation-duration: 1ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
}
.demo.is-static .demo-pointer { display: none; }

/* Phones: browser demos open full screen, turned sideways */
@media (max-width: 720px) {
  .demo--browser.is-ready::before {
    content: "點一下放大";
    position: absolute;
    z-index: 3;
    right: 10px;
    bottom: 10px;
    padding: 4px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(11, 10, 9, 0.8);
    color: var(--ink);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    pointer-events: none;
  }
}
.demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  background: rgba(8, 7, 6, 0.95);
  backdrop-filter: blur(8px);
  animation: overlay-in 0.35s ease both;
}
.demo-overlay .device {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(calc(100dvh - 76px), calc((100vw - 70px) * var(--dw) / var(--dh)));
  margin: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}
@media (orientation: landscape) {
  .demo-overlay .device {
    width: min(calc(100vw - 32px), calc((100dvh - 120px) * var(--dw) / var(--dh)));
    transform: translate(-50%, -50%);
  }
}
.demo-overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.82rem;
}
@keyframes overlay-in { from { opacity: 0; } }

/* Scene list next to each demo */
.scenes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 0 14px 2px;
  color: var(--faint);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}
.demo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}
.demo-toggle:hover { color: var(--ink); border-color: var(--tone-a, var(--gold)); }
.demo-toggle i {
  position: relative;
  width: 8px;
  height: 9px;
}
.demo-toggle i::before,
.demo-toggle i::after {
  content: "";
  position: absolute;
  top: 0;
  width: 3px;
  height: 9px;
  border-radius: 1px;
  background: currentColor;
}
.demo-toggle i::before { left: 0; }
.demo-toggle i::after { right: 0; }
.demo-toggle[aria-pressed="true"] i::before {
  left: 1px;
  width: 0;
  height: 0;
  border-radius: 0;
  background: none;
  border-left: 8px solid currentColor;
  border-top: 4.5px solid transparent;
  border-bottom: 4.5px solid transparent;
}
.demo-toggle[aria-pressed="true"] i::after { display: none; }

.case-scenes {
  display: grid;
  gap: 2px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.scene-tab {
  position: relative;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto 0fr;
  column-gap: 12px;
  width: 100%;
  padding: 11px 14px 13px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, grid-template-rows 0.5s var(--ease, ease);
}
.scene-tab.is-active { grid-template-rows: auto 1fr; }
.scene-tab small { min-height: 0; overflow: hidden; }
.scene-tab:hover { background: rgba(255, 255, 255, 0.03); color: var(--ink); }
.scene-tab.is-active { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
.scene-num {
  grid-row: span 2;
  padding-top: 4px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--tone-a, var(--gold));
  opacity: 0.75;
}
.scene-tab.is-active .scene-num { opacity: 1; }
.scene-tab b { font-weight: 500; font-size: 1rem; line-height: 1.5; }
.scene-tab small {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.4s;
}
.scene-tab.is-active small { opacity: 1; padding-top: 3px; }
.scene-bar {
  position: absolute;
  left: 56px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.scene-bar i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--tone-a, var(--gold));
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}
