/* ================================================================
   Road to MetLife — World Cup 2026 knockout bracket
   Direction: the matchday sticker album. Print-white paper with a
   halftone dot screen, album-navy ink, Panini red, foil-gold champion.
   Type: Passion One (poster display) + Barlow / Barlow Condensed.
   ================================================================ */

:root {
  --paper: #fbfaf3;
  --ink: #1a2270;
  --ink-soft: #565da1;
  --ink-line: rgba(26, 34, 112, 0.22);
  --red: #e0372b;
  --green: #187a3f;
  --gold: #c3941f;
  --card: #ffffff;
  --accent: var(--red);
  --disp: "Passion One", "Arial Narrow", sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", "Helvetica Neue", sans-serif;
}

body.whatif {
  --accent: var(--green);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--body);
  color: var(--ink);
  background-color: var(--paper);
  /* halftone print screen: navy dots + misregistered red dots */
  background-image: radial-gradient(circle, rgba(26, 34, 112, 0.055) 1px, transparent 1.3px),
    radial-gradient(circle, rgba(224, 55, 43, 0.045) 1px, transparent 1.3px);
  background-size: 14px 14px, 14px 14px;
  background-position: 0 0, 5px 7px;
  min-height: 100vh;
  line-height: 1.45;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ----------------------------------------------------------------
   Masthead
   ---------------------------------------------------------------- */
.masthead {
  text-align: center;
  padding: clamp(2.2rem, 5vw, 3.8rem) 1.2rem 0.4rem;
}

.eyebrow {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
}

.title {
  font-family: var(--disp);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.86;
  margin: 0.5rem 0 0.9rem;
}

.title-road {
  display: block;
  font-size: clamp(1.6rem, 4.5vw, 2.9rem);
  letter-spacing: 0.22em;
  color: var(--ink);
  font-weight: 400;
}

.title-metlife {
  display: block;
  font-size: clamp(4rem, 13vw, 8.5rem);
  letter-spacing: 0.015em;
  color: var(--red);
  text-shadow: 0.045em 0.045em 0 rgba(26, 34, 112, 0.22);
}

.lede {
  max-width: 56ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 500;
}

/* ----------------------------------------------------------------
   Controls
   ---------------------------------------------------------------- */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  padding: 1.4rem 1rem 0.4rem;
}

.tally {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--ink);
  color: var(--paper);
  padding: 0.28rem 0.85rem 0.32rem;
  border-radius: 999px;
  transform: rotate(-1.2deg);
  box-shadow: 2px 2px 0 rgba(26, 34, 112, 0.25);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  width: 44px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  position: relative;
  transition: background 0.18s ease;
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked + .switch-track {
  background: #e2f0e6;
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
  background: var(--green);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.switch-label {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 1.02rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.reset-btn {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--red);
  border: 2px solid var(--red);
  border-radius: 999px;
  padding: 0.22rem 0.9rem 0.26rem;
  background: var(--card);
  transition: background 0.15s ease, color 0.15s ease;
}

.reset-btn:hover {
  background: var(--red);
  color: #fff;
}

.whatif-banner {
  max-width: 62ch;
  margin: 0.9rem auto 0;
  padding: 0.55rem 1.1rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--green);
  border: 2px dashed var(--green);
  border-radius: 12px;
  background: rgba(24, 122, 63, 0.06);
}

/* ----------------------------------------------------------------
   Bracket layout
   ---------------------------------------------------------------- */
.bracket-scroll {
  overflow-x: auto;
  padding: 1.6rem 1rem 1rem;
}

.bracket {
  position: relative;
  display: flex;
  gap: 22px;
  width: max-content;
  margin: 0 auto;
}

.wires {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.wire {
  fill: none;
  stroke: rgba(26, 34, 112, 0.32);
  stroke-width: 3;
  stroke-dasharray: 0.6 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.col {
  display: flex;
  flex-direction: column;
  width: 182px;
}

.round-label {
  height: 3.4rem;
  text-align: center;
  font-family: var(--cond);
  text-transform: uppercase;
}

.round-name {
  display: block;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.round-dates {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--red);
}

.slots {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.slot {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 10px 0;
}

/* ----------------------------------------------------------------
   Match cards
   ---------------------------------------------------------------- */
.match {
  position: relative;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 rgba(26, 34, 112, 0.16);
  padding: 0.45rem 0.5rem 0.5rem;
}

.match-meta {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--ink-soft);
  text-align: center;
  padding-bottom: 0.35rem;
}

.mdate.today {
  color: var(--red);
}

.mdate.today::before {
  content: "●";
  margin-right: 0.4em;
  font-size: 0.8em;
}

.team {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-align: left;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  transition: transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.team + .team {
  margin-top: 3px;
}

button.team:not(:disabled):hover {
  background: rgba(26, 34, 112, 0.07);
  transform: translateX(2px) rotate(-0.6deg);
}

button.team:disabled {
  cursor: default;
}

.tname {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 1.06rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flag {
  width: 30px;
  height: 21px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1.5px rgba(26, 34, 112, 0.3);
  flex: none;
}

span.flag-fb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 0.62rem;
  background: var(--ink);
  color: var(--paper);
}

.score {
  font-family: var(--disp);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-soft);
}

/* the placed sticker */
.team.is-pick {
  background: var(--ink);
  color: var(--paper);
  transform: rotate(-1.4deg) scale(1.02);
  box-shadow: 2.5px 3px 0 rgba(26, 34, 112, 0.3);
}

body.whatif .team.is-pick {
  background: var(--green);
  box-shadow: 2.5px 3px 0 rgba(24, 122, 63, 0.3);
}

.team.is-pick .flag {
  box-shadow: 0 0 0 1.5px rgba(251, 250, 243, 0.65);
}

.pick-tag {
  font-family: var(--disp);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 0.05rem 0.4rem 0.1rem;
  transform: rotate(2deg);
}

/* real results */
.team.is-winner {
  font-weight: 700;
}

.team.is-winner .score {
  color: var(--red);
}

.team.is-winner .tname::after {
  content: " →";
  color: var(--red);
}

.team.is-out {
  opacity: 0.42;
}

.team.is-out .flag {
  filter: grayscale(0.8);
}

/* empty slot — "place sticker here" */
.team.tbd {
  border: 2px dashed var(--ink-line);
  border-radius: 8px;
  padding: 0.34rem 0.45rem;
  color: var(--ink-soft);
}

.flag-slot {
  display: inline-block;
  border: 1.5px dashed var(--ink-line);
  box-shadow: none;
  background: transparent;
}

.tbd-name {
  font-size: 0.9rem;
  font-weight: 500;
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.01em;
  white-space: normal;
  line-height: 1.15;
}

/* rubber stamps on settled predictions */
.stamp {
  position: absolute;
  top: -0.7rem;
  right: -0.5rem;
  font-family: var(--disp);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.02rem 0.5rem 0.08rem;
  border: 2px solid currentColor;
  border-radius: 7px;
  background: var(--paper);
  transform: rotate(6deg);
  box-shadow: 2px 2px 0 rgba(26, 34, 112, 0.12);
}

.stamp.hit {
  color: var(--green);
}

.stamp.miss {
  color: var(--red);
}

/* ----------------------------------------------------------------
   Champion foil sticker
   ---------------------------------------------------------------- */
.champion-slot {
  display: flex;
  justify-content: center;
}

.champion {
  text-align: center;
  border-radius: 14px;
  padding: 0.9rem 1.1rem 1rem;
  width: 100%;
}

.champion.crowned {
  border: 2px solid var(--ink);
  color: var(--ink);
  background: linear-gradient(115deg, #f7dc8a 0%, #d9ab35 22%, #f9e9ae 42%, #c3941f 62%, #f4d370 82%, #e0b845 100%);
  background-size: 300% 300%;
  box-shadow: 4px 4px 0 rgba(26, 34, 112, 0.2);
  transform: rotate(-2deg);
  animation: foil-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1), foil-sheen 5s ease-in-out 0.5s infinite;
}

.champion .flag {
  width: 52px;
  height: 36px;
  margin: 0.45rem 0 0.25rem;
  box-shadow: 0 0 0 2px var(--ink);
}

.champ-ribbon {
  font-family: var(--disp);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.champ-name {
  font-family: var(--disp);
  font-size: 1.7rem;
  line-height: 1;
  text-transform: uppercase;
}

.champ-fine {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 0.3rem;
  opacity: 0.75;
}

.champion.empty {
  border: 2px dashed var(--gold);
  color: var(--gold);
  padding: 1.3rem 1.1rem;
}

@keyframes foil-pop {
  from {
    transform: rotate(-11deg) scale(0.55);
  }
  to {
    transform: rotate(-2deg) scale(1);
  }
}

@keyframes foil-sheen {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ----------------------------------------------------------------
   Footer
   ---------------------------------------------------------------- */
.foot {
  text-align: center;
  padding: 1.6rem 1.2rem 2.4rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.foot-fine {
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.3rem;
  opacity: 0.8;
}

/* ----------------------------------------------------------------
   Mobile: rounds stack vertically in play order
   ---------------------------------------------------------------- */
@media (max-width: 1019.98px) {
  .bracket {
    flex-direction: column;
    width: 100%;
    max-width: 460px;
    gap: 0.4rem;
  }

  .col {
    width: 100%;
    order: var(--mob-order);
  }

  /* right-half columns continue the round their left twin started */
  .col.side-R .round-label {
    display: none;
  }

  .round-label {
    height: auto;
    padding: 1.1rem 0 0.5rem;
  }

  .slot {
    padding: 7px 0;
  }

  .wires {
    display: none;
  }
}

/* ----------------------------------------------------------------
   Motion preferences
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
