/* ============================================================
   RentSem -- design tokens, locked off the approved art
   palette   : sampled straight from banner.png (paper tan wall,
               ink-black bull, hoodie navy, ledger-red FOR RENT sign)
   type      : Bangers (comic shout / episode title)
               + Patrick Hand (handwritten sticker + dialogue voice)
               + IBM Plex Mono (case-file / CA readout)
   spacing   : 8px base scale
   radius    : sharp paper edges, no soft UI rounding
   motion    : one rolling VHS tracking line + grain, bull boings on click
   ============================================================ */

@font-face {
  font-family: 'Bangers';
  src: url('fonts/bangers-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Patrick Hand';
  src: url('fonts/patrick-hand-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/ibm-plex-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #b99a6c;
  --paper-dark: #7c6440;
  --paper-light: #efe0ba;
  --ink: #17130f;
  --bull: #0f1014;
  --navy: #16233f;
  --wood: #3a1b0e;
  --red: #c6402e;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;

  --f-display: 'Bangers', 'Arial Black', sans-serif;
  --f-hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --f-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--wood);
  color: var(--ink);
  font-family: var(--f-hand);
}

img { max-width: 100%; display: block; }

main { display: block; }

/* ---------------- episode hero ---------------- */

.episode {
  width: 100%;
  background: var(--bull);
}

.grain-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 1;
  overflow: hidden;
  isolation: isolate;
}

.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.16;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
}

.tracking-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 4%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 45%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0.35) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  top: -8%;
  animation: rollTrack 7s linear infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}

@keyframes rollTrack {
  0%   { top: -8%; }
  100% { top: 108%; }
}

.bull-hit {
  position: absolute;
  left: 33.7%;
  top: 8%;
  width: 29%;
  height: 61%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-origin: 50% 100%;
}

.bull-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bull-hit.boing {
  animation: bullBoing 0.55s cubic-bezier(.34, 1.9, .4, 1);
}

@keyframes bullBoing {
  0%   { transform: scaleY(1)    scaleX(1); }
  30%  { transform: scaleY(0.78) scaleX(1.12); }
  55%  { transform: scaleY(1.1)  scaleX(0.94); }
  75%  { transform: scaleY(0.95) scaleX(1.03); }
  100% { transform: scaleY(1)    scaleX(1); }
}

.rec {
  position: absolute;
  top: 3%;
  left: 3%;
  font-family: var(--f-mono);
  font-size: clamp(9px, 1.4vw, 13px);
  color: var(--paper-light);
  background: rgba(15, 16, 20, 0.55);
  padding: 0.35em 0.6em;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.rec-dot {
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
  animation: recBlink 1.2s steps(1) infinite;
}

@keyframes recBlink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

.ep-tag {
  position: absolute;
  top: 3%;
  right: 3%;
  text-align: right;
  font-family: var(--f-mono);
  font-size: clamp(8px, 1.2vw, 12px);
  color: var(--paper-light);
  background: rgba(15, 16, 20, 0.55);
  padding: 0.4em 0.7em;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.ep-title {
  font-family: var(--f-hand);
  font-size: 1.25em;
}

.bubble {
  position: absolute;
  top: 15%;
  left: 3%;
  max-width: 29%;
  background: var(--paper-light);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 16px 16px 4px 16px;
  padding: var(--space-2) var(--space-2);
  font-family: var(--f-hand);
  font-size: clamp(9px, 1.65vw, 17px);
  line-height: 1.28;
}

.bubble p { margin: 0 0 0.35em; }
.bubble p:last-child { margin-bottom: 0; }

.bubble::after {
  content: '';
  position: absolute;
  left: 14%;
  bottom: -14px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 4px solid transparent;
  border-top: 16px solid var(--ink);
}

.bubble::before {
  content: '';
  position: absolute;
  left: calc(14% + 2.5px);
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 3px solid transparent;
  border-top: 13px solid var(--paper-light);
  z-index: 1;
}

/* ---------------- sticker wall ---------------- */

.wall {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.05)),
    var(--paper);
  padding: var(--space-5) var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-3);
  justify-content: center;
  border-top: 6px solid var(--ink);
  border-bottom: 6px solid var(--ink);
}

.sticker {
  position: relative;
  background: var(--paper-light);
  border: 2px solid var(--ink);
  padding: var(--space-2) var(--space-3);
  min-width: 190px;
  max-width: 240px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--f-hand);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(0,0,0,0.35);
}

.sticker:nth-child(1) { transform: rotate(-2.5deg); }
.sticker:nth-child(2) { transform: rotate(1.5deg); }
.sticker:nth-child(3) { transform: rotate(-1deg); }
.sticker:nth-child(4) { transform: rotate(2deg); }

.sticker::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 46px;
  height: 16px;
  background: rgba(239, 224, 186, 0.75);
  border: 1px solid rgba(23, 19, 15, 0.35);
}

.sticker-icon {
  width: 32px;
  height: 32px;
}

.sticker-label {
  font-size: 18px;
  letter-spacing: 0.02em;
}

.sticker-value {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--wood);
  word-break: break-all;
  text-align: center;
}

.sticker-hint {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--paper-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sticker--ca.copied .sticker-hint::after {
  content: ' \2713 copied';
}

/* ---------------- end card ---------------- */

.endcard {
  background: var(--bull);
  color: var(--paper-light);
  padding: var(--space-4) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  text-align: left;
}

.endcard-avatar {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid var(--paper-light);
}

.endcard-text { max-width: 460px; }

.endcard-name {
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
  color: var(--paper-light);
}

.endcard-line {
  font-family: var(--f-hand);
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--paper);
}

.endcard-next {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--red);
  margin: 0;
  letter-spacing: 0.03em;
}

/* ---------------- responsive ---------------- */

@media (max-width: 640px) {
  .bubble { top: 22%; max-width: 42%; font-size: clamp(7px, 2.6vw, 12px); padding: 8px; }
  .rec, .ep-tag { padding: 0.25em 0.45em; font-size: 8px; }
  .sticker { min-width: 140px; padding: var(--space-1) var(--space-2); }
  .endcard { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .tracking-line { animation: none; display: none; }
  .rec-dot { animation: none; opacity: 1; }
  .bull-hit.boing { animation: none; }
  .grain { display: none; }
}
