/* Shared CSS illustrations. Each page must define:
   --panel --panel-ink --card --line --muted --bg --serif --mono            */

.preview {
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 0.75em;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--panel-ink);
  container-type: inline-size;
}
/* Scale the whole illustration with the panel width. */
.pv { font-size: clamp(7px, 4.2cqw, 20px); }
.preview--sm { border-radius: 0.6em; }

.pv {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 8%;
}

/* waveform */
.pv-pill {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.3em 0.8em; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-family: var(--mono); font-size: 0.7em; letter-spacing: 0.02em;
  margin-bottom: 1.5em;
}
.pv-dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; animation: pv-blink 1.6s ease-in-out infinite; }
.wave { display: flex; align-items: center; gap: 0.25em; height: 36%; width: 70%; }
.wave i {
  flex: 1; height: 100%; border-radius: 0.2em; background: currentColor; opacity: 0.85;
  animation: pv-wave 1.4s ease-in-out infinite; animation-delay: calc(var(--i) * -0.09s);
}
.pv-typed { margin-top: 1.5em; font-family: var(--serif); font-size: 1.2em; white-space: nowrap; max-width: 100%; overflow: hidden; }
.caret { display: inline-block; width: 1px; height: 0.95em; margin-left: 2px; background: currentColor; vertical-align: -0.15em; animation: pv-blink 1s steps(2) infinite; }

/* notes */
.pv-notes { display: block; }
.note {
  position: absolute; width: 44%; aspect-ratio: 1; padding: 7% 6%; border-radius: 0.4em;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 0.75em 1.9em -0.9em rgb(0 0 0 / 0.35);
  display: flex; flex-direction: column; gap: 8%;
}
.note b { font-family: var(--serif); font-weight: 400; font-size: 1.05em; line-height: 1.1; margin-bottom: 2%; }
.note span { display: block; height: 0.2em; width: 100%; border-radius: 2px; background: currentColor; opacity: 0.18; }
.note span.short { width: 55%; }
.note-a { left: 10%; top: 14%; transform: rotate(-5deg); }
.note-b { left: 44%; top: 26%; transform: rotate(2deg); z-index: 2; }
.note-c { left: 16%; top: 54%; transform: rotate(-1deg); width: 36%; z-index: 3; }

/* new tab */
.pv-tab { padding: 8% 8% 0; justify-content: flex-end; }
.chrome {
  width: 100%; display: flex; align-items: center; gap: 0.3em; padding: 0.5em 0.6em;
  border: 1px solid var(--line); border-bottom: 0; border-radius: 0.6em 0.6em 0 0; background: var(--card);
}
.chrome i { width: 0.45em; height: 0.45em; border-radius: 50%; background: currentColor; opacity: 0.25; }
.chrome .url { flex: 1; height: 0.5em; margin-left: 0.5em; border-radius: 0.25em; background: currentColor; opacity: 0.08; }
.tab-body { width: 100%; flex: 1; padding: 6% 7%; border: 1px solid var(--line); border-bottom: 0; background: var(--bg); }
.clock { font-family: var(--serif); font-size: 2.4em; line-height: 1; letter-spacing: -0.02em; margin-bottom: 8%; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; font-size: 0.65em; }
.cols small { display: block; font-family: var(--mono); font-size: 0.85em; color: var(--muted); margin-bottom: 0.8em; }
.ev, .tk { padding: 0.4em 0; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev em { font-style: normal; font-family: var(--mono); font-size: 0.85em; color: var(--muted); margin-right: 0.8em; }
.tk::before {
  content: ""; display: inline-block; width: 0.9em; height: 0.9em; margin-right: 0.6em;
  border-radius: 0.2em; border: 1px solid currentColor; vertical-align: -0.15em; opacity: 0.6;
}
.tk.done { color: var(--muted); text-decoration: line-through; }
.tk.done::before { background: currentColor; }

/* agent pet */
.pv-pet { gap: 1.2em; }
.pet-stack { display: flex; flex-direction: column; align-items: center; gap: 0.5em; }
.pet-pill {
  display: inline-flex; align-items: center; gap: 0.5em; white-space: nowrap;
  padding: 0.3em 0.8em; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-family: var(--mono); font-size: 0.7em;
}
.pet-wait { color: var(--muted); }
.pet-wait b { font-weight: 500; color: var(--panel-ink); padding: 0.1em 0.55em; border: 1px solid var(--line); border-radius: 0.4em; }
.pet-wait b + b { margin-left: -0.2em; }
.robot { position: relative; width: 7em; height: 6.2em; }
.robot .antenna {
  position: absolute; left: 50%; top: 0; width: 0.7em; height: 0.7em; margin-left: -0.35em;
  border-radius: 50%; background: currentColor;
  animation: pv-blink 1.6s ease-in-out infinite;
}
.robot .antenna::after { content: ""; position: absolute; left: 50%; top: 0.65em; width: 1px; height: 0.8em; background: currentColor; }
.robot .face {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4.8em;
  display: flex; justify-content: center; align-items: center; gap: 1.4em;
  border-radius: 1.4em; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 0.8em 1.8em -1em rgb(0 0 0 / 0.4);
}
.robot .eye { width: 0.85em; height: 1.25em; border-radius: 0.45em; background: currentColor; animation: pv-look 4s ease-in-out infinite; }

/* dim */
.pv-dim { padding: 0; justify-content: flex-start; align-items: center; }
.dim-win {
  position: absolute; border-radius: 0.35em;
  background: var(--card); border: 1px solid var(--line);
}
.dim-win-a { left: 8%; top: 28%; width: 46%; height: 52%; }
.dim-win-b { right: 10%; top: 18%; width: 30%; height: 26%; }
.dim-veil {
  position: absolute; inset: 0; background: #000; z-index: 1;
  animation: pv-dim 3.2s ease-in-out infinite; pointer-events: none;
}
.notch {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 0.5em;
  height: 1.85em; padding: 0 0.7em 0 0.6em;
  background: #111; color: #e7f4fb;
  border-radius: 0 0 0.75em 0.75em;
  border: 1px solid rgb(255 255 255 / 0.14); border-top: 0;
}
.notch .sun {
  width: 0.62em; height: 0.62em; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1.5px currentColor;
}
.notch .track {
  position: relative; width: 4.4em; height: 0.28em; border-radius: 99px;
  background: rgb(226 241 249 / 0.28);
}
.notch .track i {
  position: absolute; left: 38%; top: 50%;
  width: 0.72em; height: 0.72em; margin: -0.36em 0 0 -0.36em;
  border-radius: 50%; background: #96cbe3;
}
.notch b { font-family: var(--mono); font-size: 0.62em; font-weight: 600; }

/* email */
.pv-email { flex-direction: row; align-items: stretch; gap: 1em; padding: 10% 9%; }
.chat { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 0.6em; min-width: 0; }
.bub {
  font-size: 0.72em; line-height: 1.35; padding: 0.55em 0.8em; border-radius: 0.9em;
  max-width: 92%; border: 1px solid var(--line); background: var(--card);
}
.bub.me { align-self: flex-end; border-bottom-right-radius: 0.25em; }
.bub.ai { align-self: flex-start; color: var(--muted); border-bottom-left-radius: 0.25em; }
.mail {
  width: 44%; display: flex; flex-direction: column; gap: 0.45em; padding: 0.7em;
  border-radius: 0.5em; background: var(--card); border: 1px solid var(--line);
}
.mail-top { display: flex; align-items: center; gap: 0.4em; margin-bottom: 0.2em; }
.mail-top i { width: 0.8em; height: 0.8em; border-radius: 50%; background: currentColor; opacity: 0.7; }
.mail-top span { flex: 1; height: 0.25em; border-radius: 2px; background: currentColor; opacity: 0.15; }
.mail-hero { height: 30%; border-radius: 0.3em; background: currentColor; opacity: 0.12; }
.mail .ln { display: block; height: 0.22em; border-radius: 2px; background: currentColor; opacity: 0.18; }
.mail .ln.short { width: 60%; }
.mail-btn { align-self: flex-start; width: 45%; height: 0.9em; margin-top: 0.2em; border-radius: 0.25em; background: currentColor; opacity: 0.85; }

/* fallback: big initial */
.pv-mark span { font-family: var(--serif); font-size: 7em; line-height: 1; opacity: 0.9; }

@keyframes pv-wave { 0%, 100% { transform: scaleY(0.18); } 50% { transform: scaleY(1); } }
@keyframes pv-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes pv-look { 0%, 40%, 100% { transform: translateX(0); } 50%, 90% { transform: translateX(0.25em); } }
@keyframes pv-dim { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.42; } }

@media (prefers-reduced-motion: reduce) {
  .wave i { animation: none; transform: scaleY(calc(0.2 + 0.8 * abs(sin(var(--i) * 0.9)))); }
  .pv-dot, .caret { animation: none; }
  .dim-veil { animation: none; opacity: 0.28; }
}
