/* The iPod: a photo of a click-wheel music player lying on the felt desktop, with a working colour screen laid over
   the photo's blank one and the wheel and centre button live underneath. Drag it about by its body. */
.ipod {
  position: absolute; left: 0; top: 0; z-index: 2;
  --tilt: -3deg;                                                         /* put down casually, at a slight angle */
  width: min(var(--ipw, 300px), calc((100vh - 150px) * .624)); aspect-ratio: 617 / 989;
  touch-action: none; user-select: none; -webkit-user-select: none; outline: none; cursor: grab;
  /* sitting on the cloth: a tight contact shadow, then a softer, wider one */
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)) drop-shadow(3px 9px 8px rgba(0,0,0,.3)) drop-shadow(8px 22px 24px rgba(0,0,0,.22));
}
@media (max-width: 600px) { .ipod { --ipw: 200px; } }
.ipod-tilt { position: absolute; inset: 0; transform: rotate(var(--tilt)); }   /* the shadow (on .ipod) stays falling down-right */
.ipod.drag { cursor: grabbing; }
.ipod:focus-visible .ipod-tilt { outline: 2px dashed #fff; outline-offset: 4px; border-radius: 14px; }
.ipod-body { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }   /* the felt, with a window cut in it */

/* the screen sits behind the felt, showing through the window cut in it (the felt's stitched rim overlaps its edges,
   so no square corners ever poke out) */
.ipod-screen { position: absolute; left: 11.18%; top: 8.7%; width: 76.99%; height: 34.88%; overflow: hidden; background: #000; z-index: 1; cursor: default; }
.ipod-lcd {
  position: absolute; left: 0; top: 0; width: 240px; height: 176px; transform-origin: 0 0;
  background: #fff; color: #000; overflow: hidden; transition: filter .8s;
  font: bold 13px/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
.ipod-lcd.dim { filter: brightness(.42) contrast(.9) saturate(.85) !important; }                 /* backlight off after a while */
/* a real iPod screen: the picture sits back behind a scuffed plastic window. Layers, top to bottom: scratches and pocket
   swirls in the plastic, a soft glare across it, the LCD's pixel grid, and a dark recessed edge where the window meets
   the case. Videos and the menus both play under it. */
.ipod-glass {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background:
    url(/ipod/scratches.webp?v=2) center / cover no-repeat,
    linear-gradient(152deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,.07) 36%, rgba(255,255,255,0) 37%, rgba(255,255,255,0) 74%, rgba(255,255,255,.05) 100%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.075) 0 1px, rgba(0,0,0,0) 1px 3px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.06) 0 1px, rgba(0,0,0,0) 1px 3px);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.8), inset 0 5px 12px rgba(0,0,0,.6), inset 0 -2px 6px rgba(0,0,0,.35), inset 0 -1px 0 rgba(255,255,255,.12);
  border-radius: 3px;
}
.ipod-lcd { filter: saturate(.9) contrast(.96) brightness(.97); }       /* an LCD's slightly muted colour */

/* title bar */
.ipod-bar { position: relative; z-index: 2; height: 17px; display: flex; align-items: center; gap: 5px; padding: 0 5px; background: linear-gradient(#fefefe, #dfe3e8 60%, #cdd2d9); border-bottom: 1px solid #8a9099; font-size: 11px; }
.ipod-bar b { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ipod-st { width: 14px; height: 10px; position: relative; flex: none; }
.ipod-st.play::before { content: ""; position: absolute; left: 3px; top: 0; border: 5px solid transparent; border-left: 8px solid #1d6bd0; border-right: 0; }
.ipod-st.pause::before, .ipod-st.pause::after { content: ""; position: absolute; top: 0; width: 3px; height: 10px; background: #1d6bd0; left: 3px; }
.ipod-st.pause::after { left: 8px; }
.ipod-batt { flex: none; width: 21px; height: 9px; border: 1px solid #555; border-radius: 2px; position: relative; background: linear-gradient(#a8ee9b, #3fae3f) 0 0 / 76% 100% no-repeat, #fff; }
.ipod-batt::after { content: ""; position: absolute; right: -3px; top: 2px; width: 2px; height: 3px; background: #555; }

.ipod-view { position: absolute; top: 18px; left: 0; right: 0; bottom: 0; }

/* lists */
.ipod-row { position: relative; height: 22px; line-height: 22px; padding: 0 18px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ipod-row.sel { color: #fff; background: linear-gradient(#7ab8f5, #3486e0 48%, #1f6fd3 52%, #3b8de6); text-shadow: 0 -1px 0 rgba(0,0,0,.25); }
.ipod-row.more::after { content: "\203A"; position: absolute; right: 7px; top: -1px; font-size: 17px; }
.ipod-row .ipod-sub { font-weight: normal; opacity: .65; margin-left: 5px; font-size: 11px; }
.ipod-row.sel .ipod-sub { opacity: .85; }
.ipod-scroll { position: absolute; right: 0; top: 0; bottom: 0; width: 7px; background: linear-gradient(90deg, #e3e6ea, #f6f7f8); border-left: 1px solid #b9bec5; }
.ipod-scroll i { position: absolute; left: 1px; right: 1px; border-radius: 3px; background: linear-gradient(90deg, #5d9be8, #2d73d2); }
.ipod-view.scrolls .ipod-row { margin-right: 7px; }

/* now playing */
.ipod-np { position: absolute; inset: 0; }
.ipod-np .n { position: absolute; top: 3px; left: 0; right: 0; text-align: center; font-size: 10px; color: #333; }
.ipod-np img { position: absolute; left: 8px; top: 18px; width: 76px; height: 76px; object-fit: cover; box-shadow: 0 1px 3px rgba(0,0,0,.45); -webkit-box-reflect: below 1px linear-gradient(transparent 62%, rgba(255,255,255,.35)); background: #ddd; }
.ipod-np .meta { position: absolute; left: 93px; right: 6px; top: 24px; }
.ipod-np .meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.ipod-np .meta .t { font-size: 13px; }
.ipod-np .meta .a, .ipod-np .meta .al { font-size: 11px; font-weight: normal; color: #333; }
.ipod-np .meta .al { color: #666; }
.ipod-prog { position: absolute; left: 8px; right: 8px; bottom: 21px; height: 8px; border: 1px solid #6e7680; background: linear-gradient(#fff, #dde1e6); }
.ipod-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#8ac1f7, #3486e0 50%, #1f6fd3 51%, #4d9aea); }
.ipod-prog.scrub i::after { content: ""; position: absolute; right: -5px; top: -3px; width: 9px; height: 13px; background: linear-gradient(90deg, #fff, #c9ced5); border: 1px solid #555; transform: rotate(45deg) scale(.8); }
.ipod-times { position: absolute; left: 8px; right: 8px; bottom: 5px; display: flex; justify-content: space-between; font-size: 10px; }
.ipod-volrow { position: absolute; left: 8px; right: 8px; bottom: 4px; height: 28px; display: none; align-items: center; gap: 8px; background: #fff; }
.ipod-np.vol .ipod-volrow { display: flex; }
.ipod-np.vol .ipod-prog, .ipod-np.vol .ipod-times { visibility: hidden; }
.ipod-volrow .bar { flex: 1; height: 9px; border: 1px solid #6e7680; background: linear-gradient(#fff, #dde1e6); position: relative; }
.ipod-volrow .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#8ac1f7, #3486e0 50%, #1f6fd3 51%, #4d9aea); }
.ipod-volrow s { font-size: 12px; text-decoration: none; }

/* about */
.ipod-about { padding: 5px 10px; font-size: 12px; }
.ipod-about div { display: flex; justify-content: space-between; border-bottom: 1px solid #e3e6ea; padding: 4px 0; }
.ipod-about div span { font-weight: normal; color: #444; }

/* video: fills the whole screen; tap it to pause */
.ipod-video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; object-fit: cover; display: none; z-index: 3; }   /* fills the screen edge to edge */
.ipod-video.band { object-fit: cover; }
.ipod-lcd.vid .ipod-video { display: block; }
.ipod-vbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 5px 8px 6px; color: #fff; font-size: 10px; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.75)); opacity: 0; transition: opacity .4s; display: none; }
.ipod-lcd.vid .ipod-vbar { display: block; }
.ipod-vbar.on { opacity: 1; }
.ipod-vbar .ipod-prog { position: relative; left: 0; right: 0; bottom: 0; margin-top: 4px; border-color: rgba(255,255,255,.7); }

/* the click wheel and centre button, live over the photo's own */
.ipod-wheel { position: absolute; z-index: 3; left: 17.83%; top: 50.56%; width: 61.59%; height: 38.42%; border-radius: 50%; cursor: pointer; }
.ipod-wheel::before { content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity .08s;
  background: conic-gradient(from var(--pa, 315deg), rgba(0,0,0,.16) 0 90deg, transparent 90deg 360deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 33%, #000 35%); mask: radial-gradient(circle closest-side, transparent 33%, #000 35%); }
.ipod-wheel.press::before { opacity: 1; }
.ipod-btn { position: absolute; left: 33.4%; top: 33.4%; width: 33.2%; height: 33.2%; border-radius: 50%; transition: background .08s, box-shadow .08s; }
.ipod-btn.press { background: radial-gradient(circle at 50% 40%, rgba(0,0,0,.05), rgba(0,0,0,.16)); box-shadow: inset 0 2px 4px rgba(0,0,0,.25); }

/* zoomed in: the iPod fills the screen at its angle over a close-up of the quilt (both set up in ipod.js) */
.ipod.zoomed { position: fixed; z-index: 98; cursor: default;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)) drop-shadow(6px 18px 18px rgba(0,0,0,.32)) drop-shadow(14px 40px 50px rgba(0,0,0,.25)); }
.ipod-zoomback { position: fixed; inset: 0; z-index: 97; pointer-events: none; opacity: 0; cursor: zoom-out;
  background: url(/icons/quilt/desk.webp) center / cover #13917f;
  transform: scale(1); filter: blur(2px) brightness(.95);
  transition: opacity .45s ease, transform .6s cubic-bezier(.2,.8,.25,1); }
.ipod-zoomback.on { opacity: 1; pointer-events: auto; transform: scale(2.6); }
.ipod-zoomback::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.3) 100%); }   /* a soft vignette, like a lens */
/* the zoom button: a little stitched felt patch in the iPod's top corner */
.ipod-zbtn { position: absolute; z-index: 3; right: 8%; top: 1.6%; width: 8%; aspect-ratio: 1; padding: 0; cursor: zoom-in;
  border: 4px solid transparent; border-image: url(/icons/quilt/button.webp) 45 fill / 4px round; background: none; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); display: grid; place-items: center; }
.ipod-zbtn span { width: 55%; height: 55%; border: 1.5px dashed #6b6560; border-radius: 50%; position: relative; }                  /* an embroidered magnifier */
.ipod-zbtn span::after { content: ""; position: absolute; right: -38%; bottom: -38%; width: 45%; height: 1.5px; background: #6b6560; transform: rotate(45deg); transform-origin: 0 50%; }
.ipod.zoomed .ipod-zbtn { cursor: zoom-out; }
.ipod-zbtn:active { filter: brightness(.9); }
@media (prefers-reduced-motion: reduce) { .ipod-zoomback { transition: opacity .2s; } }
/* a little hop when a folder sends it something to play */
.ipod.nudge .ipod-tilt { animation: ipod-nudge .45s ease-out; }
@keyframes ipod-nudge { 0% { transform: rotate(var(--tilt)); } 35% { transform: rotate(var(--tilt)) translateY(-10px) scale(1.03); } 100% { transform: rotate(var(--tilt)); } }

/* picked up: it lifts off the quilt, a touch bigger, its shadow spreading out below; let go and it settles back down */
.ipod-tilt { transition: transform .22s cubic-bezier(.2,.8,.3,1), filter .22s cubic-bezier(.2,.8,.3,1); }
.ipod.drag .ipod-tilt { transform: rotate(var(--tilt)) translateY(-10px) scale(1.04); filter: drop-shadow(10px 30px 22px rgba(0,0,0,.3)); }
