/* ---------- Fonts (self-hosted) ---------- */

@font-face {
  font-family: "Archivo Black";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/archivo-black-400.woff2") format("woff2");
}

@font-face {
  font-family: "Dela Gothic One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/dela-gothic-one-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-500.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-600.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-var.woff2") format("woff2");
}

/* ---------- Tokens ---------- */

:root {
  --outer: #0c0c0a;
  --panel: #c9c4b6;
  --ink: #16150f;
  --ink-2: #35342c;
  --ink-3: #6e6c61;
  --field-bg: #fdfcf8;
  --placeholder: #9c998d;
  --card-bg: #131318;
  --card-blue: #a5bff2;
  --card-green: #6fdc8c;
  --error: #a83a32;

  --font-display: "Archivo Black", "Arial Black", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  padding: clamp(12px, 1.6vw, 22px);
  background: var(--outer);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Panel (the tinted canvas) ---------- */

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  background-color: var(--panel);
  padding: clamp(28px, 5vw, 76px);
  padding-top: clamp(24px, 3.6vw, 52px);
  transition: background-color 1400ms ease;
  overflow: hidden;
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: clamp(32px, 5vh, 64px);
}

.wordmark {
  /* The wordmark gets its own face, distinct from the headline. */
  font-family: "Dela Gothic One", var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  letter-spacing: 0.03em;
  color: var(--ink);
  text-decoration: none;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: start;
  gap: clamp(32px, 4vw, 64px);
  /* Center the hero in the space left under the header. */
  margin-block: auto;
  padding-bottom: clamp(24px, 6vh, 72px);
}

.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(2.6rem, 6.1vw, 5.5rem);
  line-height: 0.93;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.subhead {
  margin: clamp(28px, 4vh, 44px) 0 0;
  max-width: 34ch;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  line-height: 1.42;
  font-weight: 450;
  color: var(--ink-2);
}

/* ---------- Join form ---------- */

.join {
  display: flex;
  gap: 16px;
  margin-top: clamp(30px, 4.5vh, 52px);
  max-width: 640px;
}

.field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.field input {
  width: 100%;
  height: 66px;
  border: 0;
  border-radius: 999px;
  padding: 0 30px;
  background: var(--field-bg);
  font-family: var(--font-body);
  font-size: 1.15rem;
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(20, 20, 15, 0.08);
  transition: box-shadow 200ms ease;
}

.field input:focus-visible {
  box-shadow:
    0 1px 2px rgba(20, 20, 15, 0.08),
    0 0 0 3px rgba(22, 21, 15, 0.35);
}

.field.error input {
  box-shadow:
    0 1px 2px rgba(20, 20, 15, 0.08),
    0 0 0 3px var(--error);
}

.field.error {
  animation: shake 380ms ease;
}

@keyframes shake {
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

/* Fake "someone is typing" placeholder */

.ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 30px;
  pointer-events: none;
  font-size: 1.15rem;
  color: var(--placeholder);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity 200ms ease;
}

.field.engaged .ghost {
  opacity: 0;
}

.caret {
  flex: none;
  width: 2px;
  height: 1.3em;
  margin-left: 3px;
  background: var(--ink-3);
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink {
  0%,
  55% {
    opacity: 1;
  }
  56%,
  100% {
    opacity: 0;
  }
}

.join-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 66px;
  padding: 0 38px;
  border: 0;
  border-radius: 999px;
  /* --btn-bg/--btn-fg are set by script.js to the detected school's
     accent color and a readable text color for it. */
  background: var(--btn-bg, #131313);
  color: var(--btn-fg, #f4f2ec);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  cursor: pointer;
  transition: transform 160ms ease, background-color 900ms ease,
    color 900ms ease, filter 160ms ease;
}

.join-btn:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
}

.join-btn:active {
  transform: translateY(0);
}

.join-btn .arrow {
  display: inline-block;
  transition: transform 160ms ease;
}

.join-btn:hover .arrow {
  transform: translateX(4px);
}

/* ---------- Notes & success ---------- */

.note {
  margin: clamp(22px, 3.2vh, 32px) 0 0;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--ink-2);
}

.note #note-school {
  font-weight: 700;
  transition: opacity 300ms ease, color 400ms ease;
}

.note #note-school.swap {
  opacity: 0;
}

.success {
  margin-top: clamp(30px, 4.5vh, 52px);
  animation: rise 500ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-chip {
  display: inline-block;
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: #131313;
  color: var(--card-green);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
}

.success-title {
  margin: 18px 0 0;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.05;
  color: var(--ink);
}

.success-sub {
  margin: 12px 0 0;
  max-width: 44ch;
  font-size: 1.08rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ---------- Market card ---------- */

.market-card {
  justify-self: end;
  align-self: start;
  width: min(420px, 100%);
  margin-top: clamp(8px, 2vh, 28px);
  padding: clamp(28px, 3vw, 42px) clamp(30px, 3.4vw, 46px);
  border-radius: 26px;
  background: var(--card-bg);
  color: #fff;
  transform: rotate(-4deg);
  box-shadow:
    0 24px 48px rgba(10, 10, 8, 0.32),
    0 6px 14px rgba(10, 10, 8, 0.18);
  animation: float 6.5s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: rotate(-4deg) translateY(0);
  }
  50% {
    transform: rotate(-3.2deg) translateY(-10px);
  }
}

/* Tick-over animation when the card swaps to a new market: the text lines
   slide up and out, content changes, lines drop back in with a slight
   stagger. The big number doesn't slide — it counts to the new value like
   a stock ticker (see .odds .num below and animateOdds in script.js). */
.market-card .ticker,
.market-card .movement {
  transition: opacity 320ms ease, transform 320ms ease;
}

.market-card .movement {
  transition-delay: 80ms;
}

.market-card.tick .ticker,
.market-card.tick .movement {
  opacity: 0;
  transform: translateY(-12px);
}

/* While counting, the number flashes green (up) or red (down), then
   settles back to white once the class is removed. */
.odds .num {
  transition: color 500ms ease;
}

.odds .num.up {
  color: var(--card-green);
  transition-duration: 120ms;
}

.odds .num.down {
  color: #f0938a;
  transition-duration: 120ms;
}

.ticker {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  letter-spacing: 0.18em;
  color: var(--card-blue);
}

/* Long question-style markets get smaller, tighter type so they fit the
   card in a few lines. Toggled by script.js on ticker length. */
.ticker.long {
  font-size: clamp(0.8rem, 1vw, 0.92rem);
  letter-spacing: 0.07em;
  line-height: 1.6;
}

.odds {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(4.2rem, 6.4vw, 6rem);
  line-height: 1;
  color: #fff;
}

.odds .pct {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.42em;
  color: var(--card-blue);
}

/* "OUTCOMES" label for multi-outcome markets, in place of the % sign. */
.odds .pct.label {
  font-size: 0.22em;
  letter-spacing: 0.16em;
  margin-left: 0.4em;
}

.movement {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  letter-spacing: 0.16em;
  color: var(--card-green);
}

.movement .tri {
  font-size: 0.85em;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    margin-top: 40px;
  }

  .market-card {
    order: 2;
    justify-self: center;
    width: min(360px, 92%);
    margin-top: 12px;
  }

  .hero-copy {
    order: 1;
  }
}

@media (max-width: 560px) {
  /* Full-bleed on phones: no dark border, spacing otherwise unchanged. */
  body {
    padding: 0;
  }

  .panel {
    border-radius: 0;
  }

  .join {
    flex-direction: column;
  }

  .join-btn {
    justify-content: center;
  }

  .field input,
  .join-btn {
    height: 60px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .market-card,
  .caret {
    animation: none;
  }

  .market-card .ticker,
  .market-card .movement,
  .odds .num {
    transition: none;
  }

  .panel {
    transition-duration: 400ms;
  }

  .field.error {
    animation: none;
  }
}
