/* ==========================================================================
   /ipod: the work on an iPod Classic, drawn in CSS and SVG after Tanner
   Villarete's iPod.js (github.com/tvillarete/ipod-classic-js, MIT): its body,
   screen, wheel and screen interface, measured on a body 370 × 592, with our
   grain on the aluminium, the steel edge and back, and the light that follows
   the pointer. Every size is in those units (--u, a 370th of the iPod's
   width), so it's the same object at any size.
   ========================================================================== */

/* No dock here, so none of the room pocket.css keeps for it at the bottom. */
.ip-page { --strong: 500; padding: 0; overflow-x: hidden; }

/* The iPod in the middle, 370 wide at most, as Tanner's. On a computer: at most 70% of the screen's height, "Hi, I'm Pablo" on its
   left and the way to the studio on its right. On a phone: the hello and the pill in a row above it,
   all in one screen, no scrolling. */
.ip-stage {
  --ip-pad: 20px;
  --ip-gap: 14px;
  --ip-hello: 40px;
  --ip-w: min(370px, calc((100svh - var(--ip-pad) * 2 - var(--ip-gap) * 3 - var(--pill-h) - var(--ip-hello)) * 0.625), calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ip-gap);
  height: 100svh;
  padding: var(--ip-pad) 16px;
  overflow: hidden;
}

.ip-device {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--ip-gap);
}

.ip-pills { display: flex; gap: 8px; }

/* The hello in display type, Helvetica Now Medium: big enough to greet, not to shout. */
.ip-hello {
  font-size: clamp(26px, 2.2vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}

/* On a phone: the hello and the way to the studio side by side on top, and the iPod under them, as
   wide as 90% of the screen (less only where the screen is too short for it). */
@media (max-width: 999px) {
  .ip-stage {
    --ip-head: var(--pill-h);
    --ip-w: min(90vw, 440px, calc((100svh - var(--ip-pad) * 2 - var(--ip-head) - 28px) * 0.625));
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas: "hello studio" "ipod ipod";
    justify-content: space-between;
    align-content: center;
    row-gap: 28px;
    /* The whole screen wide, the iPod's width kept by the padding, so nothing of it (its edge, its
       light, its reflection) is ever cut at the sides. */
    width: 100%;
    padding: var(--ip-pad) calc((100% - var(--ip-w)) / 2);
  }
  .ip-device { display: contents; }
  .ip-stage > .ip-hello { grid-area: hello; align-self: center; justify-content: flex-start; text-align: left; font-size: clamp(24px, 6.4vw, 30px); }
  .ip-pills { grid-area: studio; align-self: center; justify-self: end; }
  .ipod { grid-area: ipod; }
}

/* The way to the studio: a button beside the iPod on a computer, above it on a phone. */
.ip-side { display: none; }
.ip-pills .ip-studio { display: inline-flex; }

/* The words rise in once, as the page appears. */
.ip-hello,
.ip-studio { animation: ip-rise 900ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ip-studio { animation-delay: 150ms; }

@keyframes ip-rise { from { opacity: 0; transform: translateY(0.35em); } }

/* The hand that says hi, the site's own: it waves as the page opens, again every few seconds, and
   when the pointer comes to it. */
.ip-hand { display: inline-block; margin-left: 0.22em; }

.ip-hand svg {
  display: block;
  width: 0.78em;
  height: 0.78em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-origin: 70% 85%;
  animation: ip-wave 5s cubic-bezier(0.37, 0, 0.63, 1) 700ms infinite;
}

.ip-hello { display: flex; align-items: center; justify-content: center; }

@media (hover: hover) and (pointer: fine) {
  .ip-hello:hover .ip-hand svg { animation: ip-wave-once 0.6s cubic-bezier(0.37, 0, 0.63, 1); }
}

@keyframes ip-wave {
  0%, 18%, 100% { transform: rotate(-8deg); }
  4% { transform: rotate(10deg); }
  9% { transform: rotate(-14deg); }
  13.5% { transform: rotate(8deg); }
}

@keyframes ip-wave-once {
  0%, 100% { transform: rotate(-8deg); }
  30% { transform: rotate(10deg); }
  65% { transform: rotate(-14deg); }
}

@media (min-width: 1000px) {
  .ip-stage {
    --ip-w: min(370px, calc(70svh * 0.625), calc((100vw - 2 * 300px - 2 * 64px)));
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: clamp(40px, 5vw, 96px);
    padding: var(--ip-pad) clamp(24px, 4vw, 64px);
  }
  .ip-stage { align-items: center; }
  .ip-device { position: relative; }
  .ip-hello { justify-self: end; justify-content: flex-end; text-align: right; }
  /* The button sits in the middle of a twin of the hello, hidden, mirrored on the other side: so its
     centre is as far from the iPod as the hello's, and the two balance whatever the hello's length. */
  .ip-side { display: grid; justify-self: start; align-items: center; }
  .ip-side > * { grid-area: 1 / 1; }
  .ip-side__twin, .ip-side__twin svg { visibility: hidden; animation: none; }
  .ip-side .ip-studio { justify-self: center; }
  .ip-pills { display: none; }
}

/* --- The body ------------------------------------------------------------ */

/* Tanner's 370 × 592. Under it, the iPod mirrored on the floor, fading out, as his is: each face
   mirrors itself (.ip-front, .ip-back), so turning, the reflection turns with it and hides with its
   face. Mirroring the whole iPod at once, Safari drew the front and the back over each other. */
.ipod {
  --u: calc(100cqw / 370);
  --reflect: below 0 linear-gradient(transparent, transparent 50%, rgb(250 250 250 / 0.3));
  position: relative;
  width: var(--ip-w);
  aspect-ratio: 370 / 592;
  container: ipod / inline-size;
  perspective: 2600px;
  transition: width 400ms cubic-bezier(0.3, 0.7, 0.2, 1);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* The body has depth: 24 layers of its outline stacked through its thickness, front to back, so
   that turned, its edge is solid steel that follows the rounded corners. 40 units thick, about the
   real one's 10.5 mm against its 61.8 mm width, a little slimmer. */
.ipod {
  --thick: calc(40 * var(--u));
}

/* The straight stretch of each side, one panel each, so edge-on the steel reads as one surface. They
   stop where the corners start, so they never stick out past the outline. */
.ip-card::before,
.ip-card::after,
.ip-slice {
  visibility: hidden;
}

.ip-card.is-turning::before,
.ip-card.is-turning::after,
.ip-card.is-turning .ip-slice {
  visibility: visible;
}

.ip-card::before,
.ip-card::after {
  content: "";
  position: absolute;
  top: calc(30 * var(--u));
  bottom: calc(30 * var(--u));
  left: 50%;
  width: var(--thick);
  margin-left: calc(var(--thick) / -2);
  background: linear-gradient(90deg, #8a8e93, #f2f3f5 30%, #c9ccd0 55%, #f6f7f8 75%, #9a9ea3);
}

.ip-card::before { transform: rotateY(90deg) translateZ(calc(50cqw + 0.5px)); }
.ip-card::after { transform: rotateY(-90deg) translateZ(calc(50cqw + 0.5px)); }

.ip-slice {
  position: absolute;
  inset: 0;
  border-radius: calc(30 * var(--u));
  background: linear-gradient(90deg, #8a8e93, #f2f3f5 30%, #c9ccd0 55%, #f6f7f8 75%, #9a9ea3);
  transform: translateZ(calc((var(--z) / 23 - 0.5) * var(--thick)));
}

.ip-card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(var(--turn, 0deg));
  transition: transform 700ms cubic-bezier(0.6, 0, 0.2, 1), rotate 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}


.ip-front,
.ip-back {
  position: absolute;
  inset: 0;
  border-radius: calc(30 * var(--u));
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-box-reflect: var(--reflect);
}

/* Aluminium: Tanner's light grey, darker where the front curves into the steel, and our grain on it. */
.ip-front {
  transform: translateZ(calc(var(--thick) / 2 + 0.5px));
  overflow: hidden;
  background: linear-gradient(#e3e3e3, #d6d6d6);
  box-shadow: inset 0 0 calc(38.4 * var(--u)) #555;
}

/* The light the aluminium catches where the iPod leans toward the pointer (ipod-body.js). */
.ip-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at var(--hx, 50%) var(--hy, 30%), rgb(255 255 255 / 0.35), transparent 70%);
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.ip-noise {
  position: absolute;
  inset: 0;
  background: url("/assets/ipod/body/noise.png") 0 0 / 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.12;
  pointer-events: none;
}

/* The back, as the iPod Classic's: polished stainless steel, a mirror. Bright at the top where it
   catches the room, greying down towards the floor it reflects, a soft band of light that drifts with
   the pointer (--mx, --my and --sx, ipod-body.js). */
.ip-back {
  --mx: 50%;
  --my: 20%;
  transform: rotateY(180deg) translateZ(calc(var(--thick) / 2 + 0.5px));
  overflow: hidden;
  background:
    linear-gradient(100deg, transparent 38%, rgb(255 255 255 / 0.22) 47%, rgb(255 255 255 / 0.32) 50%, rgb(255 255 255 / 0.18) 53%, transparent 62%) var(--sx, 50%) 0 / 300% 100% no-repeat,
    radial-gradient(80% 45% at var(--mx) var(--my), rgb(255 255 255 / 0.55), transparent 75%),
    linear-gradient(#eef0f2 0%, #dadde0 30%, #c3c6ca 62%, #aeb1b6 85%, #b9bcc0 100%);
}

/* The edge curving away, as the photographs show it: a fine bright rim, then a dark band where the
   chrome turns away and mirrors the shade, then the light again on the flat. */
.ip-back::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 calc(1 * var(--u)) rgb(255 255 255 / 0.85),
    inset 0 0 0 calc(3 * var(--u)) #6e7277,
    inset 0 0 calc(8 * var(--u)) calc(5 * var(--u)) rgb(40 43 48 / 0.55),
    inset 0 0 calc(18 * var(--u)) calc(9 * var(--u)) rgb(255 255 255 / 0.3);
  pointer-events: none;
}

/* Its scratches, from the photographed steel: only the bright ones, faint, so the chrome stays a
   mirror and the wear shows as the light catches it. */
.ip-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/ipod/body/back-rough.webp") center / cover;
  mix-blend-mode: screen;
  opacity: 0.22;
  pointer-events: none;
}

/* Laser-etched, as Apple's: lighter than the steel around it, a pale matte grey. */
.ip-engraving {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: rgb(245 246 247 / 0.9);
  stroke: rgb(245 246 247 / 0.9);
  stroke-width: 0;
  pointer-events: none;
}

.ip-engraving text { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; font-weight: 500; stroke: none; }
.ip-engraving rect { stroke-width: 0.4; }

/* --- The screen ------------------------------------------------------------ */

/* The screen in its black frame, as Tanner's. */
.ip-window {
  position: absolute;
  top: calc(24 * var(--u));
  left: calc(24 * var(--u));
  width: calc(322 * var(--u));
  height: calc(260 * var(--u));
  overflow: hidden;
  border: calc(4 * var(--u)) solid #000;
  border-radius: calc(8 * var(--u));
  background: #fff;
  cursor: default;
}

.ip-window:has(:focus-visible) { outline: 2px solid var(--fg); outline-offset: calc(4 * var(--u)); }

/* Brightness (Settings, ipod.js). */
.ip-lcd {
  filter: brightness(var(--lit, 1));
  transition: filter 500ms ease;
}

.ip-window { --lit: var(--level, 1); }

/* The light on the glass: a soft glow where the room's light falls, moving with the pointer
   (--gx and --gy, ipod-body.js), the other way round from it, as a reflection does. */
.ip-glare {
  position: absolute;
  z-index: 2;
  inset: 0;
  background: radial-gradient(55% 75% at var(--gx, 70%) var(--gy, 15%), rgb(255 255 255 / 0.2), rgb(255 255 255 / 0.05) 50%, transparent 75%);
  border-radius: inherit;
  pointer-events: none;
}

/* The screen keeps the iPod's own type, not the studio's: Helvetica in bold, as the iPod Classic
   drew it, sized to the screen as on the real one (a 320-pixel-wide screen, menu text about 15).
   It's marked data-own-type, so the type check leaves it alone. */
.ip-lcd {
  --ip-font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ip-grey: rgb(100 100 100);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: calc(2 * var(--u));
  background: #fff;
  color: #000;
  isolation: isolate; /* all of the screen under its pixels and the glass, whatever sits on top inside */
  font-family: var(--ip-font);
  font-weight: 700;
  font-size: calc(14 * var(--u));
  letter-spacing: 0;
  line-height: 1.15;
  font-synthesis: weight;
}

.ip-lcd .muted { color: var(--ip-grey); }

/* The title bar: small, the title on the left, play and the battery on the right. */
.ip-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: calc(4 * var(--u));
  flex: none;
  height: calc(20 * var(--u));
  padding: 0 calc(6 * var(--u));
  border-bottom: 1px solid #7995a3;
  background: linear-gradient(#feffff, #b1b6b9);
  font-size: calc(13 * var(--u));
}

.ip-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ip-lcd.is-full .ip-bar { display: none; }

/* Coming back to the main menu, the bar gives back its right half as the list slides in. */
.ip-bar { transition: width 300ms cubic-bezier(0.25, 0.8, 0.3, 1); }

/* By the battery while a song is on, as on the real one: play while it plays, pause once it's paused. */
.ip-playing {
  order: 2;
  width: calc(10 * var(--u));
  height: auto;
  display: none;
}

.ip-lcd.has-tune .ip-playing { display: block; }
.ip-playing__pause { display: none; }
.ip-lcd:not(.is-playing) .ip-playing__play { display: none; }
.ip-lcd:not(.is-playing) .ip-playing__pause { display: inline; }

.ip-battery { order: 3; flex: none; position: relative; width: calc(24 * var(--u)); height: calc(12 * var(--u)); margin-right: calc(2 * var(--u)); border: 1px solid #626262; background: #54585b linear-gradient(transparent 25%, rgb(255 255 255 / 0.5) 65%); }
.ip-battery__level { position: absolute; inset: 0 auto 0 0; width: var(--level, 100%); background: #5fe33a linear-gradient(transparent 10%, rgb(255 255 255 / 0.5) 20%, rgb(255 255 255 / 0.25) 35%, transparent 40%, rgb(0 0 0 / 0.2) 55%, rgb(0 0 0 / 0.3) 65%, rgb(0 0 0 / 0.4) 80%); }
.ip-battery.is-low .ip-battery__level { background-color: #ff4b3e; }
.ip-battery__bolt { position: absolute; top: 50%; left: 50%; width: 42%; height: 92%; translate: -50% -50%; fill: #fff; stroke: #3c3f42; stroke-width: 0.7; paint-order: stroke; display: none; }
.ip-battery.is-charging .ip-battery__bolt { display: block; }
.ip-battery__cap { position: absolute; top: 50%; left: 100%; width: calc(3 * var(--u)); height: calc(5 * var(--u)); translate: 0 -50%; border: 1px solid #626262; border-left: 0; border-radius: 0 1.5px 1.5px 0; background: #c4c4c4; }

.ip-views { position: relative; flex: 1; overflow: hidden; }

/* The main menu: the list and its bar on the left half; the work passes by on the whole right half,
   up to the top. */
.ip-lcd.is-split .ip-bar { width: 50%; }
.ip-lcd.is-split .ip-views { position: absolute; inset: 0; }
.ip-lcd.is-split .ip-view--split .ip-list { padding-top: calc(20 * var(--u)); }

.ip-view { position: absolute; inset: 0; background: #fff; }
.ip-view:focus { outline: none; }

/* Lists: as many whole rows as fit (ipod.js sets --row). */
.ip-list {
  height: 100%;
  overflow: hidden;
  outline: none;
}

.ip-row {
  display: flex;
  align-items: center;
  gap: 0.4em;
  height: var(--row, 1.5em);
  padding: 0 0 0 calc(4 * var(--u));
  white-space: nowrap;
  cursor: default;
}

.ip-row > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ip-row__value { flex: none; color: var(--ip-grey); }

.ip-row[aria-selected="true"] {
  /* A lively blue that moves with the viewer's hour (--sel-top and --sel-bottom, ipod.js), with a fine
     darker line at its foot to set it apart. */
  background: linear-gradient(var(--sel-top, #12b0f2), var(--sel-bottom, #0476d6));
  box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.18);
  color: #fff;
}

.ip-row[aria-selected="true"] .ip-row__value { color: rgb(255 255 255 / 0.85); }
.ip-row__value:last-child { margin-right: calc(6 * var(--u)); }
.ip-row__value.is-reveal { display: none; }
.ip-row[aria-selected="true"] .ip-row__value.is-reveal { display: inline; }

/* The chevron only shows on the row you're on, in white. */
.ip-go { flex: none; display: none; width: calc(24 * var(--u)); height: calc(24 * var(--u)); fill: #fff; }
.ip-row[aria-selected="true"] .ip-go { display: block; }

.ip-view--split { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 100%; }
.ip-half { position: relative; z-index: 1; min-width: 0; min-height: 0; background: #fff; box-shadow: 0 0 calc(24 * var(--u)) #000; }
.ip-half.is-long .ip-list { margin-right: 0.55em; }
.ip-lcd.is-split .ip-half .ip-sb { top: calc(20 * var(--u)); }

.ip-cover {
  position: relative;
  overflow: hidden;
  background: #000;
  box-shadow: inset 1px 0 0 rgb(0 0 0 / 0.3);
}

.ip-cover__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 2s ease;
}

.ip-cover__slide.is-on { opacity: 1; }

.ip-cover__slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ip-cover__fill { object-fit: cover; filter: blur(14px) brightness(0.7); transform: scale(1.2); }
.ip-cover__photo { object-fit: contain; animation: ip-drift 20s linear infinite alternate; }

/* A slow breath in, small enough that nothing of the photo leaves the frame. */
@keyframes ip-drift {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* The scroll bar, when there's more than fits. */
.ip-view.is-long .ip-list,
.ip-view.is-long .ip-text__body { margin-right: 0.55em; }

.ip-sb {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0.55em;
  border-left: 1px solid #9d9d9d;
  background: #fff;
}

.ip-sb > span {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, #8fb9ea, #4c86d3);
}

/* A progress bar, the iPod's: a thin frame, filled in glossy blue. */
.ip-progress {
  position: relative;
  height: 0.55em;
  border: 1px solid #8f8f8f;
  background: linear-gradient(#f4f4f4, #dcdcdc);
}

.ip-progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(var(--sel-top, #12b0f2), var(--sel-bottom, #0476d6));
}

.ip-progress--dark { border-color: rgb(255 255 255 / 0.45); background: rgb(255 255 255 / 0.12); }

/* Cover Flow: the album in front flat, the rest turned away on both sides, mirrored on the floor. */
.ip-cf { overflow: hidden; background: linear-gradient(#fff 55%, #ececec); }

.ip-cf__stage {
  position: absolute;
  top: 7%;
  left: 0;
  right: 0;
  height: 60%;
  perspective: 22em;
  transform-style: preserve-3d;
  outline: none;
}

.ip-cf__item {
  position: absolute;
  top: 0;
  left: 50%;
  width: calc(124.4 * var(--u));
  aspect-ratio: 1;
  margin-left: calc(-62.2 * var(--u));
  transition: transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
}

.ip-cf__item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #eee;
}

/* A hairline round each cover, so a white one still has an edge against the white. */
.ip-cf__item:not(.is-whole) img:not(.ip-cf__mirror) { box-shadow: 0 0 0 1px rgb(0 0 0 / 0.1); }

.ip-cf__item.is-whole img { object-fit: contain; background: none; }

.ip-cf__mirror {
  position: absolute;
  top: 100%;
  left: 0;
  transform: scaleY(-1);
  opacity: 0.45;
  /* A touch darker than the cover, so even a white one leaves its reflection on the white floor. */
  filter: brightness(0.86);
  -webkit-mask-image: linear-gradient(transparent 62%, #000);
  mask-image: linear-gradient(transparent 62%, #000);
  pointer-events: none;
}

/* Pressing the centre turns the cover over: its list, the album's name on top, to choose from. */
.ip-cf__menu {
  position: absolute;
  z-index: 200;
  top: 5%;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: 78%;
  height: 86%;
  translate: -50% 0;
  border: 1px solid #000;
  background: #fff;
}

.ip-cf__menu[hidden] { display: none; }
.ip-cf.is-flipped .ip-cf__caption { visibility: hidden; }

.ip-cf__head {
  flex: none;
  padding: 0.35em 0.5em;
  border-bottom: 1px solid #4d6a8e;
  background: linear-gradient(#6585ad, #789ab3);
  color: #fff;
  line-height: 1.2;
}

.ip-cf__head .ip-line + .ip-line,
.ip-cf__caption .ip-line + .ip-line { margin-top: 0; }
.ip-cf__head .muted { color: rgb(255 255 255 / 0.85); font-size: 0.875em; }
/* Its list as the iPod's: rows striped white and pale blue all the way down, empty ones too, so a short
   list still fills the cover; a soft shade under the head where the first row starts. The stripes
   move with the rows. */
.ip-cf__menu .ip-list {
  flex: 1;
  height: auto;
  background:
    linear-gradient(rgb(0 0 0 / 0.22), rgb(0 0 0 / 0.06) 0.35em, transparent 0.7em),
    repeating-linear-gradient(#fff 0 var(--row, 1.5em), #e8f0fb var(--row, 1.5em) calc(2 * var(--row, 1.5em)));
  background-attachment: scroll, local;
}

.ip-cf__note {
  flex: none;
  padding: 0.5em 0.6em;
  border-bottom: 1px solid #d6d6d6;
  font-weight: 500;
  line-height: 1.3;
}

.ip-cf__note[hidden] { display: none; }

.ip-cf__caption {
  position: absolute;
  /* Inside the screen's margins: a long name slides within them, never edge to edge. */
  left: 0.9em;
  right: 0.9em;
  bottom: 0.5em;
  text-align: center;
  white-space: nowrap;
}


/* The work full screen: on black like a video, the cut-outs on white as on the site. */
.ip-player { background: #000; color: #fff; cursor: pointer; }

.ip-player__media,
.ip-player__frame {
  position: absolute;
  inset: 0;
}

.ip-player__frame { display: grid; place-items: center; background: #000; }
.ip-player__frame.is-cut { background: #fff; }

/* A photo with a caption fills the screen, set a little high, so what matters stays above the caption
   at the bottom; its edges may go. */
.ip-player__frame.is-captioned img { object-fit: cover; object-position: 50% 28%; }

.ip-player__frame img,
.ip-player__frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* A piece made at 4:3 (npm run ipod) fills the screen, as the iPod's own photos did. */
.ip-player__frame.is-fill img,
.ip-player__frame.is-fill video { object-fit: cover; }

.ip-player__text { padding: 0 1em; font-weight: 500; line-height: 1.35; text-wrap: pretty; }
.ip-player__text.is-big { font-size: 1.5em; font-weight: 700; line-height: 1.12; text-wrap: balance; }

.ip-player__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 0.35em;
  padding: 0.55em 0.6em 0.6em;
  background: rgb(0 0 0 / 0.78);
  opacity: 0;
  transition: opacity 260ms ease;
}

.ip-player__bar.is-shown { opacity: 1; }

.ip-player__head { display: flex; gap: 0.5em; align-items: baseline; white-space: nowrap; }
.ip-player__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ip-player__count,
.ip-player__sub { color: #a3a3a3; }
.ip-player__state { width: 1em; color: #6fb1f4; }

/* A song only on YouTube: its player fills the screen. */
.ip-yt { background: #000; }
.ip-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Now Playing, and a book or a film: the cover turned a little in space with its reflection under
   it, the lines beside it (song in black, the rest in grey), and the progress at the bottom. */
.ip-song {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  padding: 0.5em 0.6em 0.55em;
}

.ip-song__top {
  display: grid;
  grid-template-columns: 44% 1fr;
  gap: 0.75em;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.ip-art { position: relative; perspective: 14em; }

.ip-art__img,
.ip-art__mirror {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transform: rotateY(35deg);
  transform-origin: 0 50%;
}

.ip-art__img { box-shadow: 0 1px 2px rgb(0 0 0 / 0.3); }

.ip-art__mirror {
  position: absolute;
  top: 100%;
  left: 0;
  transform: rotateY(35deg) scaleY(-1);
  opacity: 0.4;
  /* A touch darker than the cover, so even a white one leaves its reflection on the white floor. */
  filter: brightness(0.86);
  -webkit-mask-image: linear-gradient(transparent 70%, #000);
  mask-image: linear-gradient(transparent 70%, #000);
}


.ip-song__meta { min-width: 0; }

.ip-line { overflow: hidden; white-space: nowrap; }
.ip-line + .ip-line { margin-top: 0.3em; }
.ip-line > span { display: inline-block; }

/* A line too long slides along to show the rest, waits, and slides back. */
.ip-line.is-long > span { animation: ip-marquee var(--span, 8s) ease-in-out infinite alternate; }
/* A line that slides fades out at its ends, so it never looks cut. */
.ip-line.is-long { -webkit-mask-image: linear-gradient(90deg, transparent, #000 0.6em, #000 calc(100% - 0.6em), transparent); mask-image: linear-gradient(90deg, transparent, #000 0.6em, #000 calc(100% - 0.6em), transparent); }

@keyframes ip-marquee {
  0%, 18% { transform: none; }
  82%, 100% { transform: translateX(var(--shift)); }
}

.ip-song__bar,
.ip-song__volume {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5em;
  align-items: center;
}

.ip-song__volume { display: none; }
.ip-song.is-volume .ip-song__bar { display: none; }
.ip-song.is-volume .ip-song__volume { display: grid; }

.ip-song__volume svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

/* Reading: About, a principle. A bold heading for each part, the words in the iPod's regular. */
.ip-text { padding: 0.55em 0 0.55em 0.65em; }

.ip-text__body {
  height: 100%;
  overflow: hidden;
  padding-right: 0.65em;
  font-weight: 500;
  line-height: 1.35;
  text-wrap: pretty;
}

.ip-text__body h3 { font-weight: 700; }
.ip-text__body h3:not(:first-child) { margin-top: 0.9em; }
.ip-text__body h3 + p { margin-top: 0.25em; }
.ip-text__body p + p { margin-top: 0.5em; }
.ip-text__body .muted { color: var(--ip-grey); }

/* Brightness: the bar between a small sun and a big one, in the middle of the screen. */
.ip-level { display: grid; place-items: center; padding: 0 0.8em; }
.ip-level__row { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5em; align-items: center; width: 100%; }
.ip-sun { width: 1.3em; height: 1.3em; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ip-level .ip-progress { height: 0.8em; }

/* About: the iPod and its name, then what's on it, each with its count. */
.ip-about__head { display: flex; gap: 0.6em; align-items: center; padding-bottom: 0.5em; margin-bottom: 0.3em; border-bottom: 1px solid #d6d6d6; }
.ip-about__icon { width: 1.6em; height: auto; flex: none; }
.ip-about__head p:first-child { font-weight: 700; }
.ip-about__row { display: flex; justify-content: space-between; font-weight: 700; }
.ip-text__body .ip-about__row + .ip-about__row { margin-top: 0.25em; }

/* A message over the screen, the way the iPod shows a setting. */
.ip-hud {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45em;
  padding: 0.8em 1em;
  border-radius: 0.6em;
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  white-space: nowrap;
  translate: -50% -40%;
  animation: ip-hud 180ms ease-out;
}

.ip-hud[hidden] { display: none; }
.ip-hud [data-hud-text]:empty { display: none; }
.ip-hud [data-hud-icon]:empty { display: none; }

.ip-hud svg {
  display: block;
  width: 1.6em;
  height: 1.6em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes ip-hud { from { opacity: 0; scale: 0.94; } }

/* --- The wheel ----------------------------------------------------------- */

.ip-wheel {
  position: absolute;
  top: calc(328 * var(--u));
  left: calc(75 * var(--u));
  width: calc(220 * var(--u));
  height: calc(220 * var(--u));
  border: 1px solid #b9b9b9;
  border-radius: 50%;
  background: #fff;
  touch-action: none;
  cursor: grab;
}

.ip-wheel.is-turning { cursor: grabbing; }

/* The marks, where Tanner prints them. */
.ip-mark { position: absolute; fill: #afafaf; pointer-events: none; }
.ip-mark--menu { top: calc(13 * var(--u)); left: calc(88 * var(--u)); width: calc(45 * var(--u)); height: calc(17 * var(--u)); }
.ip-mark--last { top: calc(101 * var(--u)); left: calc(13 * var(--u)); width: calc(25 * var(--u)); height: calc(16 * var(--u)); }
.ip-mark--next { top: calc(101 * var(--u)); left: calc(182 * var(--u)); width: calc(25 * var(--u)); height: calc(16 * var(--u)); }
.ip-mark--play { top: calc(189 * var(--u)); left: calc(97 * var(--u)); width: calc(27 * var(--u)); height: calc(15 * var(--u)); }

/* The four marks press the ring; the wheel itself decides between a press and a turn (ipod.js). */
.ip-key {
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
}

.ip-key--menu { top: 1%; left: 35%; }
.ip-key--next { top: 35%; right: 1%; }
.ip-key--play { bottom: 1%; left: 35%; }
.ip-key--prev { top: 35%; left: 1%; }

/* The centre button: white, sunk with a soft shade from the top, as Tanner's, with our grain. */
.ip-center {
  position: absolute;
  top: calc(64 * var(--u));
  left: calc(64 * var(--u));
  width: calc(90 * var(--u));
  height: calc(90 * var(--u));
  border: 1px solid #b9b9b9;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 calc(16 * var(--u)) calc(48 * var(--u)) rgb(191 191 191);
  cursor: pointer;
  transition: filter 120ms ease-out;
}

.ip-center::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: url("/assets/ipod/body/noise-center.png") 0 0 / 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.2;
}

.ip-center:active { filter: brightness(0.95); }

/* --- Black ------------------------------------------------------------------ */

/* Settings › Colour › Black: the iPod Classic in black, anodised front, black wheel and centre button,
   the same steel back, on a black page. */
[data-theme="black"] {
  --bg: #0a0a0a;
  --fg: #fff;
  /* The loader's pill, inverted: white at a whisper over the black, a grey, under white letters. */
  --surface: rgb(255 255 255 / 0.12);
  color-scheme: dark;
}

[data-theme="black"] .ip-page { background: var(--bg); color: var(--fg); }

/* Anodised, as the real one: smooth, a graphite that catches the light at the top, barely any grain. */
[data-theme="black"] .ip-front {
  background: linear-gradient(#58585b, #2e2e30 45%, #222224);
  box-shadow: inset 0 0 calc(38.4 * var(--u)) #0a0a0a;
}

[data-theme="black"] .ip-front::after { opacity: 0.7; }
[data-theme="black"] .ip-noise { opacity: 0.05; }

[data-theme="black"] .ip-wheel { border-color: #141415; background: #2a2a2c; }
[data-theme="black"] .ip-mark { fill: #e8e8e8; }

[data-theme="black"] .ip-center {
  border-color: #0d0d0d;
  background: #2e2e30;
  box-shadow: inset 0 calc(16 * var(--u)) calc(48 * var(--u)) rgb(0 0 0 / 0.5);
}

[data-theme="black"] .ip-center:active { filter: brightness(1.2); }

/* Its reflection on a black floor, quieter. */
[data-theme="black"] .ipod { --reflect: below 0 linear-gradient(transparent, transparent 50%, rgb(0 0 0 / 0.28)); }
[data-theme="black"] .ip-center::after { opacity: 0.05; }

[data-theme="black"] .ip-page .o-pill--dark { background: rgb(255 255 255 / 0.92); color: #0a0a0a; }

@media (hover: hover) {
  [data-theme="black"] .ip-page .o-pill--dark:hover { background: #fff; }
}

/* --- /ipod-3d ------------------------------------------------------------------ */

/* The body is drawn in WebGL and the front rides on it (ipod-3d.js): the 2D card goes, and the front
   keeps the model's own size, 370 × 592, scaled by the camera to the iPod's size on the page. */
.ip-three .ip-card { display: none; }

/* Its reflection is drawn in 3D with it, not mirrored flat. */
.ip-three .ipod { --reflect: none; }

.ip-3d {
  position: absolute;
  inset: -25%;
  pointer-events: none;
}

.ip-3d > * { position: absolute !important; inset: 0; pointer-events: none; }

/* The reflection under it fades out: the layer runs from a quarter above the iPod to a quarter below
   (so the iPod's foot is at 5/6 of it); from there down, it fades out smoothly, with no step. */
.ip-3d > canvas {
  -webkit-mask-image: linear-gradient(#000 80%, rgb(0 0 0 / 0.45) 84%, rgb(0 0 0 / 0.12) 90%, transparent 96%);
  mask-image: linear-gradient(#000 80%, rgb(0 0 0 / 0.45) 84%, rgb(0 0 0 / 0.12) 90%, transparent 96%);
}
.ip-3d .ip-front { pointer-events: auto; }

/* As it turns, the light on the front changes (ipod-3d.js): it darkens towards the edge turning away,
   and all over the further it turns, over the screen and the wheel too. */
.ip-front.is-3d::before {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgb(0 0 0 / var(--shade-l, 0)), transparent 70%),
    linear-gradient(270deg, rgb(0 0 0 / var(--shade-r, 0)), transparent 70%),
    rgb(0 0 0 / var(--shade-all, 0));
  pointer-events: none;
}

.ip-front.is-3d {
  --u: 1px;
  width: 370px;
  height: 592px;
  inset: auto;
  border-radius: 30px;
  cursor: grab;
}

@media (prefers-reduced-motion: reduce) {
  .ip-cover__photo, .ip-cover__slide { animation: none; transition: none; }
  .ip-hud, .ip-line.is-long > span { animation: none; }
  .ip-card, .ip-cf__item, .ip-stage, .ipod { transition: none; }
  .ip-hello, .ip-studio, .ip-hand svg { animation: none; }
}
