/* Scenes around the panel: the hero desktop, Holiday Lights with snow, Dock folders, the
   MacBook notch and iCloud sync. Everything loops only where the real thing does (lights, snow,
   music, sync), and stands still with Reduce Motion. */

/* --- shared desktop -------------------------------------------------------- */
.hero-stage, .desktop, .screen {
  background:
    radial-gradient(120% 80% at 20% 0%, rgb(138 194 187 / 0.45), transparent 60%),
    linear-gradient(170deg, #1f6f72 0%, #134b54 55%, #0c323b 100%);
}
.hero-stage { border-radius: var(--radius); overflow: hidden; padding: 0 0 48px; box-shadow: var(--shadow); align-items: stretch; }
.hero-stage .menubar { border-radius: 0; border-width: 0 0 1px; }
.hero-panel { align-self: flex-end; margin: 8px 150px 0 0; }
.desktop { position: relative; width: min(520px, 100%); aspect-ratio: 16 / 11; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.desktop .menubar.small { height: 24px; border-radius: 0; border-width: 0; font-size: 11px; }
.dock {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; gap: 8px; padding: 7px 9px; border-radius: 16px;
  background: rgb(255 255 255 / 0.22); border: 1px solid rgb(255 255 255 / 0.25);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.dock .app { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 2px 6px rgb(0 0 0 / 0.2); }
.window {
  position: absolute; left: 12%; top: 30%; width: 56%; height: 42%;
  border-radius: 10px; background: rgb(250 250 250 / 0.92); box-shadow: 0 12px 30px rgb(0 0 0 / 0.35);
}
@media (prefers-color-scheme: dark) { .window { background: rgb(44 46 48 / 0.95); } }
.window .dots { display: flex; gap: 6px; padding: 9px 10px; }
.window .dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.window .dots i:nth-child(2) { background: #febc2e; }
.window .dots i:nth-child(3) { background: #28c840; }
.drift { position: absolute; left: 6%; right: 18%; top: -5px; height: 9px; border-radius: 9px 12px 4px 4px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.15); }

/* --- Holiday Lights -------------------------------------------------------- */
.lights-scene { background: linear-gradient(175deg, #10363d 0%, #0a242a 60%, #071a1f 100%); }
.strand {
  display: flex; overflow: hidden; height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='20'%3E%3Cpath d='M0 2Q17 22 34 2' fill='none' stroke='%23163d2c' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 34px 20px;
}
.strand.top { position: absolute; top: 24px; left: 0; right: 0; }
.strand i { flex: 0 0 34px; position: relative; }
.strand i::before { content: ""; position: absolute; left: 13px; top: 10px; width: 8px; height: 12px; border-radius: 50% 50% 46% 46%; background: var(--b); box-shadow: 0 0 10px 2px var(--b), 0 0 22px var(--b); }
.strand i::after { content: ""; position: absolute; left: 14px; top: 8px; width: 6px; height: 4px; border-radius: 1px; background: #2c4a3c; }
.strand i:nth-child(4n+1) { --b: #ff4d4d; }
.strand i:nth-child(4n+2) { --b: #ffd23f; }
.strand i:nth-child(4n+3) { --b: #3ee07a; }
.strand i:nth-child(4n+4) { --b: #4dabff; }
.dockline { position: absolute; left: -6px; right: -6px; top: -16px; height: 24px; }
.snow i { position: absolute; top: -8px; width: 5px; height: 5px; border-radius: 50%; background: #fff; opacity: 0.85; }
.snow i:nth-child(1) { left: 4%; } .snow i:nth-child(2) { left: 11%; width: 3px; height: 3px; } .snow i:nth-child(3) { left: 19%; }
.snow i:nth-child(4) { left: 26%; width: 4px; height: 4px; } .snow i:nth-child(5) { left: 33%; } .snow i:nth-child(6) { left: 41%; width: 3px; height: 3px; }
.snow i:nth-child(7) { left: 48%; } .snow i:nth-child(8) { left: 55%; width: 4px; height: 4px; } .snow i:nth-child(9) { left: 62%; }
.snow i:nth-child(10) { left: 70%; width: 3px; height: 3px; } .snow i:nth-child(11) { left: 77%; } .snow i:nth-child(12) { left: 84%; width: 4px; height: 4px; }
.snow i:nth-child(13) { left: 90%; } .snow i:nth-child(14) { left: 96%; width: 3px; height: 3px; }
@media (prefers-reduced-motion: reduce) {
  .snow i { top: auto; }
  .snow i:nth-child(odd) { top: 38%; } .snow i:nth-child(even) { top: 62%; } .snow i:nth-child(3n) { top: 80%; }
}
@media (prefers-reduced-motion: no-preference) {
  .strand i::before { animation: twinkle 2.4s ease-in-out infinite; }
  .strand i:nth-child(3n)::before { animation-delay: -0.8s; animation-duration: 3.1s; }
  .strand i:nth-child(3n+1)::before { animation-delay: -1.6s; }
  .strand i:nth-child(5n)::before { animation-duration: 1.9s; }
  .snow i { animation: fall 9s linear infinite; }
  .snow i:nth-child(2n) { animation-duration: 12s; animation-delay: -4s; }
  .snow i:nth-child(3n) { animation-duration: 10s; animation-delay: -7s; }
  .snow i:nth-child(5n) { animation-delay: -2s; }
  .snow i:nth-child(7n) { animation-delay: -5.5s; }
}
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; box-shadow: 0 0 4px var(--b); } }
@keyframes fall { from { transform: translate(0, 0); } 50% { transform: translate(12px, 190px); } to { transform: translate(-6px, 400px); } }

/* --- Dock folders ---------------------------------------------------------- */
.folder-scene .dock { gap: 10px; }
.app.folder { display: grid; place-items: center; background: linear-gradient(160deg, #8ac2bb, #3f8f8a); }
.app.folder svg { width: 22px; height: 22px; fill: #fff; }
.fan {
  position: absolute; left: 50%; bottom: 78px; width: min(300px, 84%); transform: translateX(-50%);
  padding: 12px 14px 10px; border-radius: 18px; text-align: center;
  background: rgb(240 240 242 / 0.86); color: #1d1d1f; box-shadow: 0 16px 40px rgb(0 0 0 / 0.35);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transform-origin: 50% 110%;
}
@media (prefers-color-scheme: dark) { .fan { background: rgb(44 46 50 / 0.88); color: #f5f5f7; } }
.fan::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; margin-left: -7px; transform: rotate(45deg); background: inherit; }
.fan p { font: 600 13px var(--font); margin-bottom: 8px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 6px; }
.tiles span { display: grid; justify-items: center; gap: 4px; font: 500 11px var(--font); }
.tiles .app { width: 40px; height: 40px; border-radius: 10px; }
.edit { display: inline-block; margin-top: 10px; font: 500 11px var(--font); color: var(--accent); }

/* --- the Notch: data-state music | device | event | open --------------------- */
.laptop { width: min(560px, 100%); padding: 10px 10px 0; border-radius: 22px 22px 0 0; background: #111; box-shadow: var(--shadow), 0 0 0 1px rgb(255 255 255 / 0.06); }
.laptop::after { content: ""; display: block; height: 14px; margin: 0 -26px; border-radius: 0 0 14px 14px; background: linear-gradient(#c9ccd1, #9a9ea5); }
.screen { position: relative; aspect-ratio: 16 / 10; border-radius: 12px 12px 0 0; overflow: hidden; container-type: inline-size; }
.screen::before { content: "Notes   File   Edit   View"; position: absolute; left: 3cqw; top: 1.3cqw; font: 600 2.1cqw var(--font); color: rgb(255 255 255 / 0.85); white-space: pre; }
.screen::after { content: "9:41 AM"; position: absolute; right: 3cqw; top: 1.3cqw; font: 600 2.1cqw var(--font); color: rgb(255 255 255 / 0.85); }
.notch {
  position: absolute; z-index: 1; left: 50%; top: 0; transform: translateX(-50%);
  width: 18cqw; height: 4.8cqw; border-radius: 0 0 2cqw 2cqw; background: #000; color: #fff;
  box-shadow: 0 0 0 transparent;
  transition: width 0.5s cubic-bezier(0.3, 1.25, 0.5, 1), height 0.5s cubic-bezier(0.3, 1.2, 0.5, 1), border-radius 0.4s, box-shadow 0.4s;
}
[data-state="music"] .notch, [data-state="device"] .notch, [data-state="event"] .notch { width: 32cqw; }
[data-state="open"] .notch { width: 66cqw; height: 34cqw; border-radius: 0 0 5cqw 5cqw; box-shadow: 0 2cqw 5cqw rgb(0 0 0 / 0.45); }
.wing { position: absolute; top: 0; height: 4.8cqw; width: 7cqw; display: grid; place-items: center; opacity: 0; transition: opacity 0.25s; }
.wing.l { left: 0; } .wing.r { right: 0; }
.wing > * { grid-area: 1 / 1; opacity: 0; transition: opacity 0.25s; }
[data-state="music"] .wing, [data-state="device"] .wing, [data-state="event"] .wing { opacity: 1; transition-delay: 0.2s; }
[data-state="music"] .w-music, [data-state="device"] .w-dev, [data-state="event"] .w-ev { opacity: 1; }
.art { width: 3cqw; height: 3cqw; border-radius: 0.7cqw; background: linear-gradient(135deg, #ff9a5a, #d94f7a 60%, #6a3fd1); }
.wave { display: flex; align-items: center; gap: 0.45cqw; height: 2.6cqw; }
.wave i { width: 0.5cqw; height: 40%; border-radius: 1cqw; background: #ff9a6a; }
.wave i:nth-child(2) { height: 90%; } .wave i:nth-child(3) { height: 60%; } .wave i:nth-child(4) { height: 75%; }
.w-dev, .w-ev { width: 2.6cqw; height: 2.6cqw; fill: #fff; }
.batt { width: 2.8cqw; height: 2.8cqw; border-radius: 50%; background: conic-gradient(#32d74b 0 80%, rgb(255 255 255 / 0.2) 0); -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%); mask: radial-gradient(circle, transparent 52%, #000 54%); }
span.w-ev { font: 700 2.2cqw var(--font-round); color: #ff9f0a; }
.open {
  position: absolute; inset: 5.4cqw 3.6cqw 2.6cqw; display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 2.4cqw;
  opacity: 0; filter: blur(6px); transform: scale(0.96); transition: opacity 0.3s, filter 0.3s, transform 0.4s var(--ease);
  pointer-events: none;
}
[data-state="open"] .open { opacity: 1; filter: none; transform: none; transition-delay: 0.18s; }
.o-left { display: grid; align-content: start; }
.o-left small { font: 600 2.2cqw var(--font); color: #ff453a; text-transform: uppercase; letter-spacing: 0.04em; }
.o-left b { font: 700 9cqw/1 var(--font-round); letter-spacing: -0.03em; }
.o-left span { font: 500 2.1cqw var(--font); color: rgb(255 255 255 / 0.7); margin-top: 1cqw; }
.o-right { display: grid; align-content: start; gap: 1.2cqw; }
.o-right .ev { grid-template-columns: 1fr; gap: 0.2cqw; padding: 1cqw 1.6cqw 1cqw 2.4cqw; border-radius: 1.4cqw; background: rgb(255 255 255 / 0.08); }
.o-right .ev::before { top: 1cqw; bottom: 1cqw; width: 0.5cqw; }
.o-right b { font: 600 2.2cqw var(--font); }
.o-right time { font: 500 1.9cqw var(--font); color: rgb(255 255 255 / 0.6); }
.pdots { position: absolute; left: 0; right: 0; bottom: -1.6cqw; display: flex; justify-content: center; gap: 0.9cqw; }
.pdots i { width: 1cqw; height: 1cqw; border-radius: 50%; background: rgb(255 255 255 / 0.3); }
.pdots .on { background: #fff; }
@media (prefers-reduced-motion: no-preference) {
  [data-state="music"] .wave i { animation: eqbar 0.9s ease-in-out infinite alternate; }
  .wave i:nth-child(2) { animation-delay: -0.3s !important; } .wave i:nth-child(3) { animation-delay: -0.6s !important; } .wave i:nth-child(4) { animation-delay: -0.15s !important; }
}
@media (prefers-reduced-motion: reduce) { .notch, .wing, .wing > *, .open { transition: none !important; } }
@keyframes eqbar { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
.demo-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 22px; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.demo-tabs button {
  font: 500 14px/1 var(--font); color: var(--ink-2); background: none; border: 0; cursor: pointer;
  padding: 9px 14px; border-radius: 999px; transition: background 0.2s, color 0.2s;
}
.demo-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
@media (prefers-color-scheme: dark) { .demo-tabs button[aria-pressed="true"] { background: rgb(255 255 255 / 0.14); } }

/* --- iCloud sync ------------------------------------------------------------ */
.sync-scene { position: relative; width: min(540px, 100%); display: grid; grid-template-columns: 1fr 0.8fr 1fr; align-items: center; gap: 4%; }
.mac { display: flex; flex-direction: column; text-align: center; }
.mac .scr {
  aspect-ratio: 16 / 11; border-radius: 10px; border: 6px solid #1b1b1d; padding: 10%;
  display: grid; align-content: center; gap: 8px;
  background: linear-gradient(170deg, #1f6f72, #0c323b); box-shadow: var(--shadow), 0 0 0 1px rgb(255 255 255 / 0.06);
}
.mac::after { content: ""; display: block; width: 24%; height: 14px; margin: 0 auto; background: linear-gradient(#b7bac0, #8e9298); clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); }
.mac p { order: 2; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.chip { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; background: rgb(255 255 255 / 0.9); color: #1d1d1f; font: 600 11px/1.25 var(--font); text-align: left; }
.chip em { font-style: normal; font-weight: 500; color: rgb(60 60 67 / 0.7); }
.cloud { position: relative; z-index: 1; display: grid; justify-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.cloud svg { width: 100%; max-width: 120px; fill: var(--surface); stroke: var(--line); stroke-width: 1.5; filter: drop-shadow(0 8px 16px rgb(14 56 66 / 0.2)); }
.flow { position: absolute; top: 34%; height: 6px; width: 16%; overflow: hidden; }
.flow.f1 { left: 30%; } .flow.f2 { right: 30%; transform: scaleX(-1); }
.flow i { position: absolute; top: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); left: 0; }
.flow i:nth-child(2) { left: 40%; } .flow i:nth-child(3) { left: 80%; }
@media (prefers-reduced-motion: no-preference) {
  .flow i { animation: flow 2.4s linear infinite; }
  .flow i:nth-child(2) { animation-delay: -0.8s; left: 0; } .flow i:nth-child(3) { animation-delay: -1.6s; left: 0; }
  .f2 i { animation-direction: reverse; }
}
@keyframes flow { from { transform: translateX(-8px); opacity: 0; } 20%, 80% { opacity: 1; } to { transform: translateX(80px); opacity: 0; } }

/* --- motion: folder pops open, once, when it comes into view ---------------- */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .fan { transition: transform 0.55s 0.3s cubic-bezier(0.3, 1.3, 0.5, 1), opacity 0.3s 0.3s; }
  .folder-scene:not(.is-in) .fan { opacity: 0; transform: translateX(-50%) scale(0.4); }
}

@media (max-width: 860px) {
  .hero-stage { padding-bottom: 24px; margin-top: 40px; }
  .hero-panel { align-self: center; margin: 8px 12px 0; width: calc(100% - 24px); }
  .demo-tabs button { padding: 8px 10px; font-size: 13px; }
  .laptop::after { margin: 0 -10px; }
  .desktop.folder-scene { aspect-ratio: auto; height: 340px; }
  .chip { font-size: 9px; padding: 4px 5px; }
  .mac .scr { border-width: 4px; gap: 5px; padding: 8%; }
}
