/* ==========================================================
   Pitchpool — shared design system
   Every page links this file. Page-specific styles go in
   css/<page>.css and must only use the tokens below.
   ========================================================== */

:root {
  /* Colors */
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #efefea;
  --ink: #1b1c20;
  --muted: #646872;
  --line: #e2e2dc;

  --brand: #3352e0;        /* primary actions, links */
  --brand-ink: #ffffff;
  --brand-soft: #e7ebfd;

  --money: #0d8a5f;        /* participation pay — "everyone gets paid" */
  --money-soft: #dcf3e9;
  --gold: #b7790c;         /* winner prize */
  --gold-soft: #fbefd5;
  --silver: #556070;       /* optional 2nd place prize */
  --silver-soft: #eceff3;
  --danger: #c43d3d;

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 0.78rem;
  --fs-sm: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.5rem;

  /* Spacing & shape */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --container: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--sp-3); }
h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 var(--sp-4); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-5); }
/* Only top/bottom padding, so it can share an element with .container
   without wiping out the container's left/right padding */
.section { padding-block: var(--sp-7); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Header / footer (injected by js/layout.js) ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: var(--sp-4); }
.logo { font-weight: 800; font-size: var(--fs-lg); color: var(--ink); letter-spacing: -0.02em; }
.logo span { color: var(--brand); }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: var(--sp-2); align-items: center; }
.nav a { color: var(--muted); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--surface-2); }
/* The CTA button must beat ".nav a" (which is more specific than ".btn-primary") */
.nav a.btn-primary, .nav a.btn-primary:hover { color: var(--brand-ink); background: var(--brand); }
.nav a.btn-primary:hover { background: #2741c4; }
/* Logged-in user chip + log out (outside <nav>, right of the links on desktop) */
.nav { margin-left: auto; }
.nav-account { display: flex; align-items: center; gap: var(--sp-1); }
.nav-user { display: inline-flex; align-items: center; gap: var(--sp-2); padding-left: var(--sp-3); border-left: 1px solid var(--line); }
.nav-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: var(--fs-sm); }
.nav-user-text { display: flex; flex-direction: column; line-height: 1.15; font-size: var(--fs-sm); font-weight: 600; }
.nav-user-text small { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.nav-logout { font: inherit; font-size: var(--fs-sm); color: var(--muted); background: none; border: 0; cursor: pointer; padding: var(--sp-2); }
.nav-logout:hover { color: var(--ink); text-decoration: underline; }
/* Small screens: keep every link (they matter now), just tighter; hide the name text */
@media (max-width: 700px) {
  /* Row 1: logo + account (right). Row 2: the page links. */
  .site-header .container { height: auto; padding-block: var(--sp-2); flex-wrap: wrap; row-gap: var(--sp-2); }
  .nav-account { order: 1; margin-left: auto; }
  .nav { order: 2; width: 100%; margin-left: 0; gap: var(--sp-1); }
  .nav a:not(.btn) { padding: var(--sp-2); white-space: nowrap; }
  .nav .btn { padding: 8px 12px; white-space: nowrap; }
  .nav .btn:last-child { margin-left: auto; } /* main action button sits on the right */
  .nav-user-text { display: none; }
  .nav-user { border-left: 0; padding-left: 0; }
  .nav-logout { white-space: nowrap; }
}

/* "Please log in" card shown on pages that need a specific role */
.gate-card { max-width: 560px; margin: var(--sp-7) auto; text-align: center; }
.gate-card .row { justify-content: center; }

.site-footer { border-top: 1px solid var(--line); padding: var(--sp-6) 0; margin-top: var(--sp-8); color: var(--muted); font-size: var(--fs-sm); }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-4); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #2741c4; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-lg { padding: 14px 24px; font-size: var(--fs-md); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-5); box-shadow: var(--shadow);
}
.card-link { color: inherit; display: block; transition: transform .12s, box-shadow .12s; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.08); }

/* ---------- Badges & money pills ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--muted);
}
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.pill-prize { background: var(--gold-soft); color: var(--gold); }   /* winner money */
.pill-pay   { background: var(--money-soft); color: var(--money); } /* participation money */

/* Reward split: the signature component — winner prize vs. guaranteed pay */
.reward {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2);
  border-radius: var(--radius-sm); overflow: hidden;
}
.reward > div { padding: var(--sp-3); }
.reward .prize { background: var(--gold-soft); }
.reward .pay   { background: var(--money-soft); }
.reward .label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.reward .prize .label, .reward .prize .amount { color: var(--gold); }
.reward .pay .label,   .reward .pay .amount   { color: var(--money); }
.reward .amount { font-size: var(--fs-lg); font-weight: 800; }

/* Card reward block: amount + a bold tag (number of winners / Guaranteed).
   Used on challenge cards (browse page + landing page featured cards). */
.cc-reward { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.cc-prize, .cc-pay {
  border-radius: var(--radius-sm); padding: var(--sp-3);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1);
}
.cc-prize { background: var(--gold-soft); color: var(--gold); }
.cc-pay   { background: var(--money-soft); color: var(--money); }
.cc-amount { font-size: var(--fs-lg); font-weight: 800; line-height: 1.1; }
/* Small line under the amount ("1 winner" / "Guaranteed"), same colour as its tile */
.cc-tag { font-size: var(--fs-sm); font-weight: 600; color: inherit; white-space: nowrap; }
/* Optional 2nd place: a slim silver row spanning both tiles */
.cc-runner {
  grid-column: 1 / -1;
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
  background: var(--silver-soft); color: var(--silver);
}
.cc-runner .cc-amount { font-size: var(--fs-md); }

/* A creator's or firm's name that opens their profile (see profileLink() in data.js) */
.profile-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; text-decoration-color: var(--muted); }
.profile-link:hover { color: var(--brand); text-decoration-style: solid; text-decoration-color: var(--brand); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field label { font-weight: 600; font-size: var(--fs-sm); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
input, textarea, select {
  font: inherit; color: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 120px; resize: vertical; }

/* ---------- Placeholder image (for mock submissions) ---------- */
.thumb {
  aspect-ratio: 4 / 3; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-2));
  display: grid; place-items: center; color: var(--muted); font-size: var(--fs-sm);
}
