/*
  CSS cassette for the mixtape claim drawer.
  Ported from ~/Sites/lollipop/display/mixtape/css/cassette.css (codepen.io/manz/pen/qBmWYdo).
  Static presentation only: no deck door, no reel spin, fixed --track-progress.
*/

.manz-cassette-skin {
  --track-progress: .4;
  --left-tape-scale: calc(1 - (var(--track-progress) * .22));
  --right-tape-scale: calc(.54 + (var(--track-progress) * .36));
  display: grid;
  place-items: center;
}

.cassette-shell-stage {
  width: 100%;
  border-radius: 20px;
  padding: clamp(7px, 2vw, 10px);
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #0a0a08, #1b1913 25%, #080807 100%);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow:
    inset 0 2px 8px rgba(255,255,255,.07),
    inset 0 -12px 20px rgba(0,0,0,.45),
    0 16px 28px rgba(0,0,0,.45);
}

.cassette-shell-stage::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 17px;
  z-index: 8;
  pointer-events: none;
  opacity: .72;
  mix-blend-mode: screen;
  border: 1px solid rgba(255,255,255,.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.02) 15%, transparent 40%),
    linear-gradient(100deg, transparent 0 8%, rgba(255,255,255,.18) 11%, transparent 17% 48%, rgba(255,255,255,.10) 51%, transparent 58%);
}

.cassette-shell-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: .20;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 52px);
}

/* ── Main cassette body ── */
.css-cassette {
  --external-notch-shape: polygon(100% 0, 0 5%, 0 95%, 100% 100%);
  --tape-body: #2f2f2f;
  --tape-border: #424242;
  --tape-light: #5a5a5a;
  --tape-dark: #1c1c1c;
  --skin-accent: var(--mixtape-label-color, #6fcdde);
  width: 100%;
  max-width: 520px;
  aspect-ratio: 458 / 287;
  margin-inline: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  border: clamp(2px, .7vw, 3px) solid var(--tape-border);
  border-radius: clamp(11px, 4vw, 15px);
  background:
    linear-gradient(273deg, rgba(255,255,255,.075), transparent),
    repeating-linear-gradient(to bottom, #1c1c1c 0 1px, #2c2c2c 1px 2px);
  box-shadow:
    0 0 10px 2px rgba(34,34,34,.47),
    0 18px 26px rgba(0,0,0,.42),
    inset 0 1px 0 rgba(255,255,255,.07);
  animation: cssCassetteSnap 1.05s cubic-bezier(.18,.9,.14,1.02) both;
  isolation: isolate;
}

.css-cassette::before,
.css-cassette::after {
  content: "";
  display: block;
  position: absolute;
  bottom: 7%;
  width: 1.2%;
  height: 26%;
  background: #333;
  clip-path: var(--external-notch-shape);
}

.css-cassette::before { left: -2%; }
.css-cassette::after  { right: -2%; transform: scaleX(-1); background: #444; }

@keyframes cssCassetteSnap {
  0%   { opacity: 0; transform: perspective(700px) translate3d(0,-84px,130px) rotateX(16deg) scale(1.18); filter: blur(2px) saturate(1.05); }
  58%  { opacity: 1; transform: perspective(700px) translate3d(0,8px,0) rotateX(-2deg) scale(.965); filter: blur(.2px) saturate(1); }
  74%  { transform: perspective(700px) translate3d(0,-4px,0) rotateX(1deg) scale(1.015); }
  100% { opacity: 1; transform: perspective(700px) translate3d(0,0,0) rotateX(0) scale(1); filter: blur(0) saturate(1); }
}

@media (prefers-reduced-motion: reduce) {
  .css-cassette { animation: none; }
}

/* ── Top tape strip ── */
.css-top-tape {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  height: 8.8%;
  padding: 0 5.4%;
}

.arrow-mark-container {
  display: flex;
  background: rgba(0,0,0,.24);
  width: 13%;
  overflow: hidden;
}

.arrow-mark {
  color: var(--tape-light);
  font-size: clamp(15px, 5vw, 32px);
  line-height: .8;
  transform: scaleY(1.6) translate(4%, -20%);
}

.brand-mark {
  display: flex;
  align-items: center;
  padding: 0 1.5%;
  background: rgba(0,0,0,.24);
  color: var(--tape-light);
  font-family: "Special Elite", ui-monospace, monospace;
  font-size: clamp(9px, 2.5vw, 16px);
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ── Middle tape (label area) ── */
.css-medium-tape {
  height: 65.2%;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0 5.8%;
}

.css-label-container {
  width: 100%;
  background: var(--tape-dark);
  border-radius: 4px;
  padding: .95%;
}

.css-label {
  height: 100%;
  overflow: hidden;
  border-radius: 10px;
  background:
    repeating-linear-gradient(transparent 0 20px, #c6c6c6 20px 21px),
    linear-gradient(278deg, #f1f1ef, #cfcfcd);
}

/* Top label section */
.css-top-label {
  position: relative;
  height: 33%;
  color: #333;
  font-weight: 400;
  font-size: 16px;
}

.predefined-text {
  position: absolute;
  left: 1.8%;
  top: 12%;
  font-family: Arial, sans-serif;
  font-size: clamp(5px, 1.8vw, 9px);
  letter-spacing: .1em;
  opacity: .7;
}

.top-text {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1.3% 7% 0 15%;
  text-align: left;
}

.mixtape-handwrite {
  width: min(92%, 320px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  font-size: clamp(12px, 4.6vw, 21px);
  line-height: 1;
  color: #2a2a2a;
  transform-origin: 12% 50%;
  text-shadow: 0 .2px 0 rgba(0,0,0,.12);
}

/* Middle label section — reels */
.css-medium-label {
  height: 50.6%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--skin-accent);
  font-family: Arial, sans-serif;
}

.side-name {
  width: 12.5%;
  display: grid;
  place-items: center;
  color: #222;
  font-weight: 900;
  font-size: clamp(17px, 6vw, 30px);
}

.gap-container {
  width: 69.5%;
  height: 79%;
  border: clamp(2px, .9vw, 4px) solid var(--tape-dark);
  border-radius: 5px;
  background: linear-gradient(76deg, transparent, rgba(170,170,170,.13)), var(--tape-body);
}

.gap {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Tape reels */
.tapereel {
  width: 15.6%;
  aspect-ratio: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  border: clamp(2px, .9vw, 4px) solid #aaa;
  box-shadow: 0 0 0 clamp(2px, .9vw, 4px) #111;
  background:
    radial-gradient(circle at 50% 50%, #f7efd4 0 28%, transparent 29%),
    radial-gradient(circle, #303030, #141414 68%);
}

.notch {
  position: absolute;
  width: 100%;
  height: 16%;
  background: linear-gradient(to right, #aaa 0 10%, transparent 12% 88%, #aaa 90% 100%);
}

.notch-1 { transform: rotate(60deg); }
.notch-2 { transform: rotate(0deg); }
.notch-3 { transform: rotate(-60deg); }

/* Tape window (inner gap) */
.central-gap {
  position: relative;
  width: 31%;
  height: 66%;
  margin: 0 3.2%;
  overflow: hidden;
  border: clamp(2px, .7vw, 3px) solid #222;
  background:
    radial-gradient(circle at 50% 35%, rgba(255,255,255,.06), transparent 38%),
    linear-gradient(180deg, rgba(0,0,0,.36), rgba(0,0,0,.12)),
    #774486;
}

.central-gap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  background-image: linear-gradient(transparent, rgba(255,255,255,.32), transparent);
  pointer-events: none;
}

/* Tape mass — split left/right via fixed --track-progress */
.innertape {
  position: absolute;
  width: 150%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .96;
  overflow: hidden;
}

.innertape::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(255,255,255,.055) 0 1.2%,
      rgba(42,42,42,.08) 1.2% 2.1%,
      rgba(18,18,18,.0) 2.1% 3.2%),
    conic-gradient(
      from -35deg,
      rgba(255,255,255,.02) 0deg,
      rgba(255,255,255,.08) 32deg,
      rgba(255,255,255,.03) 70deg,
      rgba(255,255,255,.075) 128deg,
      rgba(255,255,255,.025) 176deg,
      rgba(255,255,255,.07) 236deg,
      rgba(255,255,255,.02) 290deg,
      rgba(255,255,255,.06) 332deg,
      rgba(255,255,255,.02) 360deg),
    radial-gradient(circle at 50% 50%, transparent 0 53%, rgba(255,255,255,.06) 61%, rgba(255,255,255,.02) 71%, transparent 79%),
    radial-gradient(circle, #646464 0 58%, #424242 70%, #232323 86%, #141414 100%);
  transform-origin: 50% 50%;
  filter: blur(.35px);
  opacity: .82;
}

.innertape.left {
  left: -98%;
  top: -100%;
}

.innertape.right {
  right: -98%;
  top: -100%;
}

.innertape.left::before {
  transform: scale(var(--left-tape-scale));
}

.innertape.right::before {
  transform: scale(var(--right-tape-scale));
}

.innertape::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, #f1f1ef 0 42%, #bfbfbf 43% 62%, #6b6b6b 63% 78%, #2d2d2d 79% 100%);
  box-shadow:
    0 0 0 1px rgba(20,20,20,.5),
    inset 0 1px 1px rgba(255,255,255,.18);
}

/* Noise reduction badge */
.noise-reduction {
  width: 12.5%;
  margin-left: .5%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #222;
  font-size: clamp(4px, 1.65vw, 7px);
  line-height: 1.1;
}

.noise-reduction .box {
  display: flex;
  margin-top: 2px;
}

.noise-reduction .box > div {
  border: 1px solid #444;
  background: #fff;
  font-size: clamp(4px, 1.4vw, 6px);
  padding: 0 3px;
  border-radius: 2px;
}

/* Bottom label */
.css-bottom-label {
  height: 16.4%;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: linear-gradient(-278deg, #f1f1ef, #cfcfcd);
}

.brand-text .maintext {
  color: #222;
  font-size: clamp(10px, 2.5vw, 20px);
  font-weight: 900;
  line-height: 1;
  transform: translate(18%, 0) scaleX(1.35);
}

.brand-text .subtext {
  color: #333;
  font-family: Arial, sans-serif;
  font-size: clamp(4px, 1.6vw, 7px);
  font-weight: 700;
  transform: translateY(-20%);
}

.arrow-text {
  color: var(--skin-accent);
  font-size: clamp(16px, 6vw, 32px);
  transform: scaleX(1.5) translate(-6%, -3%);
}

.model-text {
  color: #222;
  font-family: "Special Elite", ui-monospace, monospace;
  font-size: clamp(15px, 5vw, 28px);
  font-weight: 900;
  transform: translate(0, 2%);
}

.model-text span { color: var(--skin-accent); }

/* ── Bottom tape strip ── */
.css-bottom-tape {
  height: 26%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.magnetic-container {
  z-index: 3;
  width: 76.4%;
  height: 72.6%;
  position: relative;
  filter:
    drop-shadow(-4px 0 1px #131313)
    drop-shadow(4px 0 1px #383838)
    drop-shadow(0 -4px 0 #202020);
}

.magnetic-shield {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  clip-path: polygon(0 100%, 4% 0, 96% 0, 100% 100%);
  background: repeating-linear-gradient(to bottom, #2c2c2c 0 1px, #1c1c1c 1px 3px);
  filter:
    drop-shadow(-4px 0 1px #131313)
    drop-shadow(4px 0 1px #383838)
    drop-shadow(0 -4px 0 #202020);
}

.left-hole-container,
.right-hole-container {
  width: 35.7%;
  display: flex;
  justify-content: space-evenly;
  align-items: flex-end;
}

.hole {
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111;
  border: 2px solid #191919;
  box-shadow: 0 0 0 2px #171717;
  transform: translateY(-22%);
}

.hole-2, .hole-3 {
  width: 19.2%;
  aspect-ratio: 1.33 / 1;
  border-radius: 30px;
  border: 3px solid #222;
  box-shadow: 0 0 0 2px #111;
  transform: translateY(-88%);
}

.hole-3 {
  width: 16%;
  border-radius: 10px;
  transform-origin: 50% 50%;
  transform: rotate(90deg) translateX(-88%);
}

/* ── Corner screws ── */
.cassette-screw {
  position: absolute;
  z-index: 7;
  width: clamp(10px, 3.5vw, 16px);
  aspect-ratio: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  border-top: 1px solid #222;
  border-bottom: 1px solid #666;
  background: linear-gradient(#555, #333);
  box-shadow: 0 0 2px 2px #111;
  transform: rotate(-25deg);
}

.cassette-screw .dot {
  position: absolute;
  z-index: 5;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #222;
  filter: blur(1px);
}

.cassette-screw::before,
.cassette-screw::after {
  content: "";
  position: absolute;
  width: 88%;
  height: 25%;
  border-radius: 2px;
  background: linear-gradient(to right, #222 10%, #111 45% 65%, #222 90%);
}

.cassette-screw::before { transform: rotate(45deg); }
.cassette-screw::after  { transform: rotate(-45deg); }

.screw-1 { top: 1.4%;  left: 1.2%;  }
.screw-2 { top: 1.4%;  right: 1.2%; }
.screw-3 { bottom: 1.4%; left: 1.2%;  }
.screw-4 { bottom: 1.4%; right: 1.2%; }

/* ── Narrow screen tweaks ── */
@media (max-width: 380px) {
  .css-cassette { border-width: 2px; }
  .css-label-container { padding: .75%; }
  .mixtape-handwrite { font-size: clamp(14px, 5.5vw, 22px); }
  .noise-reduction { font-size: 5px; }
}
