/* System type on purpose: getsidea.com sets its wordmark in the system font,
   which is SF on a Mac, and SF can't be served as a webfont. */
[data-signoff='side-a'] {
  --sa-ink: #242b29;
  --sa-print: rgb(255 255 255 / 0.5);
  --sa-face: #dde0e1;
  --sa-hole: #f7f8f7;
  --sa-orange: #e94f24;
  --sa-metal: #d0d4d7;
  --sa-metal-low: #c6cbce;
  --sa-sheen: rgb(255 255 255 / 0.55);
  --sa-grain: 0.5;
  --sa-base: clamp(24px, 4cqw, 60px);
  --b-height: clamp(230px, 25vw, 380px);
  --b-height-m: 210px;
  --b-font: system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --b-weight: 600;
  --b-tracking: -0.036em;
  --b-fit: 0.128;
  --b-ink: var(--sa-ink);
}
.dark [data-signoff='side-a'] {
  --sa-ink: #c3c9cc;
  --sa-print: rgb(0 0 0 / 0.35);
  --sa-face: #2c3236;
  --sa-hole: #16191b;
  --sa-metal: #25292c;
  --sa-metal-low: #202326;
  --sa-sheen: rgb(255 255 255 / 0.05);
  --sa-grain: 0.2;
  --b-ink-dark: var(--sa-ink);
}

/* Brushed aluminium. The grain is SVG noise stretched along the brushing
   direction and blended soft-light, so it only lightens and darkens the
   metal. Light catching horizontal grain spreads across it, which is why the
   sheen runs in soft vertical bands. The eased mask lets the page colour
   dissolve into the lid with no edge. */
[data-signoff='side-a'] .sa-lid {
  background:
    linear-gradient(
      90deg,
      transparent 2%,
      var(--sa-sheen) 21%,
      transparent 39%,
      transparent 57%,
      color-mix(in srgb, var(--sa-sheen) 60%, transparent) 75%,
      transparent 93%
    ),
    linear-gradient(
      90deg,
      var(--sa-metal),
      var(--sa-metal-low) 48%,
      var(--sa-metal)
    );
  -webkit-mask-image: linear-gradient(
    transparent,
    rgb(0 0 0 / 0.03) 10%,
    rgb(0 0 0 / 0.1) 20%,
    rgb(0 0 0 / 0.22) 30%,
    rgb(0 0 0 / 0.4) 40%,
    rgb(0 0 0 / 0.6) 50%,
    rgb(0 0 0 / 0.78) 60%,
    rgb(0 0 0 / 0.91) 70%,
    rgb(0 0 0 / 0.98) 80%,
    #000 90%
  );
  mask-image: linear-gradient(
    transparent,
    rgb(0 0 0 / 0.03) 10%,
    rgb(0 0 0 / 0.1) 20%,
    rgb(0 0 0 / 0.22) 30%,
    rgb(0 0 0 / 0.4) 40%,
    rgb(0 0 0 / 0.6) 50%,
    rgb(0 0 0 / 0.78) 60%,
    rgb(0 0 0 / 0.91) 70%,
    rgb(0 0 0 / 0.98) 80%,
    #000 90%
  );
}
[data-signoff='side-a'] .sa-lid::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--sa-grain);
  mix-blend-mode: soft-light;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='320'%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.004 0.85' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1.7 0 0 0 -0.35 1.7 0 0 0 -0.35 1.7 0 0 0 -0.35 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E")
    0 0 / 640px 320px;
}

/* One baseline for the whole lid: the disc and the LCD are each one cap
   height tall and stand on the wordmark's baseline. */
[data-signoff='side-a'] .sa-name {
  bottom: var(--sa-base);
  translate: none;
  justify-content: space-between;
  align-items: baseline;
  line-height: 1;
}
[data-signoff='side-a'] .sa-lockup {
  display: flex;
  align-items: baseline;
  gap: 0.25em;
}
[data-signoff='side-a'] .sa-word {
  text-shadow: 0 1px 0 var(--sa-print);
  perspective: 600px;
}

/* Round shapes overshoot the cap height and baseline a little, as an O does. */
[data-signoff='side-a'] .sa-disc {
  flex: none;
  width: 1.03cap;
  height: 1.03cap;
  translate: 0 0.015cap;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
[data-signoff='side-a'] .sa-disc svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: scale 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}
[data-signoff='side-a'] .sa-disc:active svg {
  scale: 0.97;
}
[data-signoff='side-a'] .sa-disc-face {
  fill: var(--sa-face);
  stroke: var(--sa-ink);
  stroke-width: 3.6;
}
[data-signoff='side-a'] .sa-disc-hole {
  fill: var(--sa-hole);
  stroke: var(--sa-ink);
  stroke-width: 3.6;
}
[data-signoff='side-a'] .sa-disc-dot {
  fill: var(--sa-ink);
}
/* side-a-spin.ts writes the rotation; the off-centre dot shows each turn. */
[data-signoff='side-a'] .sa-spin {
  transform-origin: 32px 32px;
}
[data-signoff='side-a'] .sa-play {
  fill: var(--sa-orange);
  stroke: var(--sa-orange);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transform-origin: 48px 48px;
  transition: scale 0.18s cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) {
  [data-signoff='side-a'] .sa-disc:hover .sa-play {
    scale: 1.1;
  }
}
[data-signoff='side-a'] .sa-disc:focus-visible {
  outline: 2px solid var(--sa-ink);
  outline-offset: 6px;
  border-radius: 50%;
}

/* Side A turns over to Side B. */
[data-signoff='side-a'] .sa-flip {
  display: inline-grid;
  transform-style: preserve-3d;
  /* Turn about the middle of the cap height, not the line box, so the
     letter stays on its baseline as it turns. */
  transform-origin: 50% 0.43em;
  transition: transform 0.8s cubic-bezier(0.65, 0, 0.35, 1);
}
[data-signoff='side-a'] .sa-flip > span {
  grid-area: 1 / 1;
  backface-visibility: hidden;
}
[data-signoff='side-a'] .sa-flip > span:last-child {
  transform: rotateX(180deg);
}
[data-signoff='side-a'] .sa-flip[data-b] {
  transform: rotateX(180deg);
}

/* The player's LCD as the 3D model draws it: an 820 by 295 pale green glass
   with Courier type, in a black bezel. Every size is relative to the glass so
   the layout matches the real one at any width. Clicking it skips, as on the
   site. */
[data-signoff='side-a'] .sa-lcd-slot {
  position: relative;
  flex: none;
  display: block;
  height: 1cap;
  width: calc(1cap * 2.46);
  container-type: size;
}
[data-signoff='side-a'] .sa-lcd {
  position: absolute;
  inset: 0;
  padding: 8cqh;
  border: 0;
  border-radius: 9cqh;
  background: linear-gradient(#2d2f30, #1b1c1d);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.14),
    inset 0 -1.5px 0 rgb(0 0 0 / 0.5),
    0 1px 0 rgb(255 255 255 / 0.6),
    0 10px 18px -12px rgb(30 36 40 / 0.45);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.dark [data-signoff='side-a'] .sa-lcd {
  background: linear-gradient(#202223, #121314);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    inset 0 -1.5px 0 rgb(0 0 0 / 0.5),
    0 1px 0 rgb(255 255 255 / 0.04),
    0 10px 18px -10px rgb(0 0 0 / 0.6);
}
[data-signoff='side-a'] .sa-glass {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  container-type: size;
  overflow: hidden;
  border-radius: 2.4cqh;
  background:
    linear-gradient(172deg, rgb(255 255 255 / 0.16), rgb(255 255 255 / 0) 42%),
    #bbc5a0;
  box-shadow:
    inset 0 3cqh 5cqh -2cqh rgb(20 28 18 / 0.4),
    inset 0 0 0 1px rgb(0 0 0 / 0.3);
  color: #2c412b;
  font-family: 'Courier New', Courier, 'Nimbus Mono PS', monospace;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-align: left;
  text-shadow: 0.35cqh 0.5cqh 0 rgb(44 65 43 / 0.16);
}
.dark [data-signoff='side-a'] .sa-glass {
  filter: brightness(0.86);
}
[data-signoff='side-a'] .sa-glass > span {
  position: absolute;
  left: 4.9cqw;
  right: 4.9cqw;
  white-space: nowrap;
}
[data-signoff='side-a'] .sa-row1,
[data-signoff='side-a'] .sa-row3 {
  display: flex;
}
[data-signoff='side-a'] .sa-row1 {
  top: 9.5cqh;
  font-size: 8.1cqh;
}
[data-signoff='side-a'] .sa-row1 > span:last-child {
  position: absolute;
  left: 17.5cqw;
}
[data-signoff='side-a'] .sa-row2 {
  top: 32cqh;
  font-size: 20.3cqh;
  font-weight: 700;
}
[data-signoff='side-a'] .sa-row3 {
  top: 75cqh;
  font-size: 7.8cqh;
}
[data-signoff='side-a'] .sa-row3 > span:last-child {
  position: absolute;
  left: 47cqw;
}
[data-signoff='side-a'] .sa-lcd:focus-visible {
  outline: 2px solid var(--sa-ink);
  outline-offset: 4px;
}

@media (max-width: 640px) {
  [data-signoff='side-a'] {
    --b-fit: 0.244;
    --sa-base: 26px;
  }
  /* No room for the LCD beside the name on a phone; play and the flip stay. */
  [data-signoff='side-a'] .sa-lcd-slot {
    display: none;
  }
}
