/* Sahabat: friend reference sheets. See the contract comment in index.html. */

:root {
  --lime: #d7ff2a;
  --rasp: #ff2ca6;
  --grape: #7a2cff;
  --teal: #00e6c7;
  --orange: #ff6a00;
  --void: #0b0b0b;
  --static: #b9b9b9;
  --paper: #f3efe2;
  --ground: #3b12ad;
  --grid: rgba(11, 11, 11, 0.38);

  --display: "Sedgwick Ave Display", "Marker Felt", "Comic Sans MS", cursive;
  --hand: "Shantell Sans", "Marker Felt", "Comic Sans MS", system-ui, sans-serif;

  --ink-shadow: 4px 4px 0 var(--void);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Notched tape: torn on both ends. */
  --tape-clip: polygon(0 10%, 4% 0, 96% 6%, 100% 0, 97% 52%, 100% 100%, 5% 94%, 0 100%, 3% 48%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font: 400 17px/1.45 var(--hand);
  background-color: var(--ground);
  background-image:
    linear-gradient(var(--grid) 2px, transparent 2px),
    linear-gradient(90deg, var(--grid) 2px, transparent 2px);
  background-size: 30px 30px;
  background-position: -1px -1px;
  overflow-x: hidden;
}

/* Paper crackle over everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--lime);
  color: var(--void);
  font-weight: 800;
  text-decoration: none;
}
.skip:focus { top: 12px; }

:focus-visible {
  outline: 3px dashed var(--lime);
  outline-offset: 4px;
}

/* ---------- Masthead ---------- */

.masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 16px 8px;
}

.banner-wrap { filter: drop-shadow(5px 6px 0 var(--void)); }

.banner {
  position: relative;
  background: var(--lime);
  color: var(--void);
  text-align: center;
  padding: clamp(18px, 3vw, 30px) clamp(28px, 6vw, 80px) clamp(20px, 3vw, 28px);
  clip-path: polygon(0 6%, 3% 0, 30% 4%, 62% 0, 97% 3%, 100% 0, 98% 50%, 100% 100%, 70% 96%, 34% 100%, 4% 95%, 0 100%, 2% 52%);
}

.banner h1 {
  margin: 0;
  font: 400 clamp(64px, 17vw, 168px)/0.86 var(--display);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.banner-sub {
  margin: 10px auto 0;
  max-width: 34ch;
  font-weight: 800;
  font-size: clamp(15px, 2.2vw, 22px);
  line-height: 1.2;
  text-transform: uppercase;
  text-wrap: balance;
}

.swoosh {
  display: block;
  width: min(420px, 80%);
  height: 14px;
  margin: 8px auto 0;
  fill: none;
  stroke: var(--rasp);
  stroke-width: 4;
  stroke-linecap: round;
}
.swoosh path + path { stroke: var(--void); stroke-width: 2.5; }

.doodle {
  position: absolute;
  width: clamp(22px, 4vw, 40px);
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.doodle-star { left: clamp(12px, 3vw, 40px); top: clamp(16px, 3vw, 34px); stroke: var(--void); }
.doodle-x { right: clamp(12px, 3vw, 44px); top: clamp(14px, 3vw, 30px); stroke: var(--rasp); stroke-width: 6; }

.sticker {
  margin: 0;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.05;
}

.sticker-unfair {
  width: max-content;
  margin: -18px 0 0 auto;
  margin-right: clamp(4px, 4vw, 60px);
  padding: 10px 16px;
  background: var(--rasp);
  color: var(--void);
  font-size: clamp(14px, 2vw, 18px);
  transform: rotate(4deg);
  box-shadow: var(--ink-shadow);
  border: 3px solid var(--void);
}

/* ---------- Tape labels ---------- */

.tape {
  display: inline-block;
  margin: 0;
  padding: 6px 26px 7px;
  color: var(--void);
  font: 400 clamp(26px, 4.5vw, 38px)/1 var(--display);
  text-transform: uppercase;
  clip-path: var(--tape-clip);
}
.tape-teal { background: var(--teal); }

/* ---------- Standings ---------- */

.standings {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 0 16px;
}

.standings-hint {
  display: inline-block;
  margin: 0 0 0 12px;
  font-size: 15px;
  color: var(--lime);
  transform: rotate(-2deg);
}

.roster {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 18px;
}

.chip {
  --c: var(--lime);
  --on: var(--void);
  display: grid;
  grid-template-columns: auto 60px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 8px 10px 8px 6px;
  background: var(--void);
  color: var(--paper);
  border: 3px solid var(--c);
  box-shadow: var(--ink-shadow);
  font: inherit;
  text-align: left;
  text-decoration: none;
  position: relative;
  rotate: -0.8deg;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), background-color 0.2s;
}
.roster li:nth-child(even) .chip { rotate: 0.7deg; }
/* A strip of masking tape holding each chip to the grid paper. */
.chip::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 54px;
  height: 16px;
  translate: -50% 0;
  rotate: 3deg;
  background: rgba(243, 239, 226, 0.72);
  clip-path: polygon(0 12%, 6% 0, 94% 8%, 100% 0, 97% 100%, 4% 90%, 0 100%);
}
.chip:hover { transform: translate(-2px, -3px) rotate(-1deg); box-shadow: 7px 8px 0 var(--void); }
.chip:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--void); }

.chip-crown {
  position: absolute;
  left: -14px;
  top: -24px;
  width: 44px;
  rotate: -18deg;
  filter: drop-shadow(2px 2px 0 var(--void));
}
.chip-last {
  position: absolute;
  right: -8px;
  top: -12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 4px;
  background: var(--static);
  color: var(--void);
  border: 2px solid var(--void);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  rotate: 6deg;
}
.chip-last svg { width: 16px; height: 16px; }
.chip-delta { font-weight: 800; margin-left: 4px; }
.chip-delta.up { color: var(--lime); }
.chip-delta.down { color: var(--rasp); }
.chip[aria-current="true"] .chip-delta { color: var(--on); }
.chip[aria-current="true"] { background: var(--c); color: var(--on); }

.chip-rank {
  font: 400 30px/1 var(--display);
  color: var(--c);
  min-width: 1.4ch;
  text-align: center;
}
.chip[aria-current="true"] .chip-rank { color: var(--on); }

.chip-face {
  width: 60px;
  height: 60px;
  border: 2px solid var(--c);
  background: var(--ground);
  overflow: hidden;
}
.chip-face svg, .chip-face img { display: block; width: 100%; height: 100%; object-fit: cover; }

.chip-name {
  display: block;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.1;
  overflow-wrap: break-word;
}
.chip-pts { font-size: 14px; opacity: 0.85; font-variant-numeric: tabular-nums; }

/* ---------- Sheets ---------- */

.sheets {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 16px 24px;
  display: grid;
  gap: 56px;
}

.sheet {
  --c: var(--lime);
  --on: var(--void);
  position: relative;
  background: var(--void);
  border: 3px solid var(--c);
  box-shadow: 8px 9px 0 var(--void);
  padding: 0 clamp(14px, 2.4vw, 28px) clamp(18px, 2.4vw, 28px);
  scroll-margin-top: 110px; /* clears the raised head and #1's crown after a jump */
}
.sheet:nth-child(odd) { transform: rotate(-0.4deg); }
.sheet:nth-child(even) { transform: rotate(0.35deg); }

.sheets .sheet.flash { animation: flash 1.1s var(--ease-out) 0s; }
@keyframes flash {
  0%, 30% { box-shadow: 0 0 0 10px var(--c), 8px 9px 0 10px var(--void); }
  100% { box-shadow: 8px 9px 0 var(--void); }
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 calc(-1 * clamp(14px, 2.4vw, 28px));
  padding: 0 clamp(14px, 2.4vw, 28px);
  transform: translateY(-50%);
  margin-bottom: -6px;
}

.sheet-rank {
  display: grid;
  place-items: center;
  min-width: 76px;
  height: 76px;
  padding: 0 8px;
  background: var(--c);
  color: var(--on);
  border: 3px solid var(--void);
  font: 400 46px/1 var(--display);
  box-shadow: var(--ink-shadow);
  transform: rotate(-6deg);
}

.sheet-name-wrap { filter: drop-shadow(4px 4px 0 var(--void)); min-width: 0; }

.sheet-name {
  display: inline-block;
  margin: 0;
  padding: 8px 30px 10px 26px;
  background: var(--c);
  color: var(--on);
  font: 400 clamp(30px, 6vw, 54px)/1 var(--display);
  text-transform: uppercase;
  clip-path: var(--tape-clip);
  overflow-wrap: anywhere;
}
.sheet-name small {
  display: block;
  font: 800 13px/1 var(--hand);
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.delta {
  margin-left: auto;
  padding: 6px 12px;
  border: 2px solid var(--void);
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--void);
  transform: rotate(3deg);
}
.delta.up { background: var(--lime); color: var(--void); }
.delta.down { background: var(--rasp); color: var(--void); }
.delta.same { background: var(--static); color: var(--void); }

.crown {
  position: absolute;
  left: 2px;
  top: -74px;
  width: 92px;
  transform: rotate(-14deg);
  z-index: 2;
  filter: drop-shadow(3px 3px 0 var(--void));
}

.sheet-level {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 0 0 16px;
}
.level-badge {
  padding: 3px 10px;
  background: var(--rasp);
  color: var(--void);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 15px;
}
.level-num {
  font: 400 clamp(34px, 5vw, 48px)/1 var(--display);
  color: var(--c);
  font-variant-numeric: tabular-nums;
}
.level-num small { font: 800 15px/1 var(--hand); color: var(--paper); margin-left: 4px; }

/* Views */

.views {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--static);
}

.view {
  margin: 0;
  border-left: 2px solid var(--static);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.view:first-child { border-left: 0; }

.view figcaption {
  order: -1;
  padding: 8px 6px 2px;
  text-align: center;
  color: var(--teal);
  font-weight: 800;
  font-size: clamp(11px, 1.6vw, 16px);
  text-transform: uppercase;
  line-height: 1.1;
}

.view-art {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: #1d0b57;
  background-image:
    linear-gradient(rgba(122, 44, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 44, 255, 0.35) 1px, transparent 1px);
  background-size: 16px 16px;
}
.view-art svg, .view-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.view-art img.mirror { transform: scaleX(-1); }
.view-art img.tired { filter: grayscale(1) contrast(1.35) brightness(0.85); }

/* Info strip */

.info {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 22px 28px;
  margin-top: 22px;
}

.mini-tape {
  display: inline-block;
  margin: 0 0 12px;
  padding: 3px 16px 4px;
  color: var(--void);
  font: 400 22px/1 var(--display);
  text-transform: uppercase;
  clip-path: var(--tape-clip);
  rotate: -1.5deg;
}
.mt-grape { background: #a98bff; }
.mt-orange { background: var(--orange); rotate: 1deg; }
.mt-rasp { background: var(--rasp); }

/* Views, the sample marker and the catchphrase tape */
.views-wrap { position: relative; }

.sample-tape {
  position: absolute;
  z-index: 2;
  right: 10px;
  top: -14px;
  margin: 0;
  padding: 3px 12px;
  background: var(--static);
  color: var(--void);
  border: 2px solid var(--void);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  rotate: 2.5deg;
}

.quote-wrap {
  display: flex;
  justify-content: center;
  margin-top: -18px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(3px 3px 0 var(--void));
}
.quote-tape {
  margin: 0;
  padding: 6px 30px 8px;
  background: var(--paper);
  color: var(--void);
  font-weight: 800;
  font-size: clamp(15px, 2vw, 20px);
  text-transform: uppercase;
  text-align: center;
  clip-path: var(--tape-clip);
  rotate: -1deg;
}

.sheet-doodle {
  position: absolute;
  width: 34px;
  pointer-events: none;
  color: var(--c);
}
.sheet-doodle svg { display: block; width: 100%; }
.sd-1 { right: clamp(14px, 3vw, 40px); top: 60px; rotate: 12deg; }
.sd-2 { right: 18%; bottom: 22px; width: 26px; color: var(--teal); rotate: -10deg; }

.swatches { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.swatch {
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}
.swatch-chip {
  height: 34px;
  background: var(--s);
  border: 2px solid var(--paper);
}
.swatch-name { display: block; font-weight: 600; line-height: 1.15; color: var(--s); }
.swatch-hex { display: block; font-size: 13px; color: var(--static); letter-spacing: 0.04em; }

.card {
  background: var(--paper);
  color: var(--void);
  padding: 14px 16px;
  clip-path: polygon(0 2%, 98% 0, 100% 97%, 2% 100%);
}
.card dl { margin: 0; display: grid; gap: 10px; }
.card dt {
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  color: #b0127a;
}
.card dd { margin: 0; font-weight: 600; line-height: 1.25; }

.scribbles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.scribbles li {
  font-size: 18px;
  line-height: 1.2;
  color: var(--paper);
  transform: rotate(-2deg);
}
.scribbles li:nth-child(even) { transform: rotate(1.5deg); padding-left: 1.2em; color: var(--teal); }
.scribbles li::before { content: "→ "; color: var(--rasp); font-weight: 800; }

.warn-wrap {
  width: max-content;
  max-width: 100%;
  margin-top: 16px;
  filter: drop-shadow(3px 4px 0 var(--void));
  rotate: -5deg;
}
.warn {
  display: grid;
  place-items: center;
  width: 210px;
  max-width: 100%;
  aspect-ratio: 1.6 / 1;
  margin: 0;
  padding: 14% 18%;
  background: var(--rasp);
  color: var(--void);
  font-weight: 800;
  font-size: 13px;
  line-height: 1.1;
  text-transform: uppercase;
  text-align: center;
  text-wrap: balance;
}

/* ---------- Footer ---------- */

.rules {
  max-width: 1180px;
  margin: 24px auto 0;
  padding: 0 16px 40px;
}

.rules-band {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px 28px;
  padding: 18px 24px;
  background: var(--lime);
  color: var(--void);
  border: 3px solid var(--void);
  box-shadow: 8px 9px 0 var(--void);
}

.rules-title {
  margin: 0;
  font: 400 clamp(34px, 5vw, 50px)/0.9 var(--display);
  text-transform: uppercase;
}

.rules-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.rules-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px;
  border-left: 3px solid var(--void);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1.15;
}
.rules-list svg {
  flex: none;
  width: 40px;
  height: 40px;
  stroke: var(--void);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.rules-list svg path[fill] { stroke: var(--void); }

.burst-wrap {
  filter: drop-shadow(6px 7px 0 var(--void));
  max-width: 560px;
  margin: 30px auto 0;
}
.burst {
  margin: 0;
  display: grid;
  place-items: center;
  aspect-ratio: 1.9 / 1;
  padding: 12% 16%;
  background: var(--rasp);
  color: var(--void);
  text-align: center;
  font: 400 clamp(24px, 4.6vw, 40px)/1 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}

.colophon {
  margin: 26px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--lime);
}

/* ---------- States ---------- */

.notice {
  text-align: center;
  padding: 40px 20px;
}
.notice h2 { margin: 0 0 8px; font: 400 40px/1 var(--display); color: var(--lime); text-transform: uppercase; }
.notice p { margin: 0 0 18px; }
.notice button {
  padding: 10px 22px;
  background: var(--lime);
  color: var(--void);
  border: 3px solid var(--void);
  box-shadow: var(--ink-shadow);
  font: 800 16px var(--hand);
  text-transform: uppercase;
  cursor: pointer;
}

/* The one authored moment (sheets slapping down as they arrive) is run from app.js
   with the Web Animations API, so every sheet is visible if it never fires. */

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .roster { grid-template-columns: 1fr 1fr; }
  .info { grid-template-columns: 1fr 1fr; }
  .info .notes-col { grid-column: 1 / -1; }
  .rules-band { grid-template-columns: 1fr; }
  .rules-list { grid-template-columns: 1fr 1fr; gap: 10px 0; }
}

@media (max-width: 560px) {
  body { font-size: 16px; background-size: 24px 24px; }
  .masthead { padding-top: 20px; }
  .doodle { width: 18px; }
  .doodle-star { left: 12px; top: 10px; }
  .doodle-x { right: 12px; top: 10px; stroke-width: 5; }
  .sticker-unfair { margin-top: -14px; }
  .standings-hint { display: block; margin: 8px 0 0 4px; }
  .roster { grid-template-columns: 1fr 1fr; gap: 10px; }
  .chip-name { font-size: 16px; }
  .chip { grid-template-columns: 40px 1fr; grid-template-rows: auto auto; padding: 8px; gap: 4px 8px; }
  .chip-rank { grid-row: 1; grid-column: 1; font-size: 24px; }
  .chip-face { grid-row: 2; grid-column: 1; width: 40px; height: 40px; }
  .chip-text { grid-row: 1 / 3; grid-column: 2; align-self: center; }
  .sheets { gap: 64px; padding-top: 48px; }
  .sheet { scroll-margin-top: 90px; }
  .sheet-head { padding-right: 0; }
  .sheet .delta { position: absolute; right: -6px; top: 34px; margin: 0; font-size: 12px; padding: 4px 8px; }
  .sheet-level { margin-bottom: 12px; }
  .sd-1 { top: auto; bottom: 30px; right: 14px; width: 26px; }
  .sd-2 { display: none; }
  .quote-wrap { margin-top: -14px; }
  .views-wrap { display: flex; flex-direction: column; }
  .sample-tape { position: static; order: 3; align-self: flex-end; margin-top: 8px; }
  .quote-tape { padding: 5px 22px 6px; font-size: 14px; }
  .info { gap: 16px; margin-top: 18px; }
  .swatches { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .swatch { grid-template-columns: 28px 1fr; gap: 8px; }
  .swatch-chip { height: 28px; }
  .swatch-name { font-size: 14px; }
  .mini-tape { font-size: 19px; margin-bottom: 8px; }
  .scribbles { gap: 8px; }
  .scribbles li { font-size: 16px; }
  .warn { width: 180px; font-size: 12px; }
  .sheet-rank { min-width: 58px; height: 58px; font-size: 34px; }
  .crown { width: 68px; top: -58px; }
  .delta { margin-left: 0; }
  .info { grid-template-columns: 1fr; }
  .rules-list { grid-template-columns: 1fr; }
  .rules-list li { border-left: 0; border-top: 3px solid var(--void); padding: 10px 0; }
  .rules-list li:first-child { border-top: 0; }
  .burst { aspect-ratio: 1.4 / 1; padding: 14% 14%; }
}
