/* ===========================================================
   Cornerman — Brand Tokens
   White base, deep red accent, navy ink, gold reserved for
   rankings/championship content only.
   =========================================================== */

:root {
  --bg: #F5F5F5;
  --surface: #FFFFFF;
  --ink: #0D1B2A;
  --ink-soft: #4A4A4A;
  --red: #B3151D;
  --red-dark: #8F1017;
  --gold: #C9A84C;
  --win: #3E7B4F;
  --loss: #4A4A4A;
  --draw: #9AA0A6;
  --border: #E3E3E0;
  --border-soft: #ECECE9;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 4px;
  --shadow-sm: 0 1px 2px rgba(13, 27, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(13, 27, 42, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Tabular numerals for every record/stat, so columns align */
.tnum, table td, .stat-value, .record-badge {
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout shell ---------- */

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav ---------- */

.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: 0.01em;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.wordmark .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a {
  color: var(--ink-soft);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--red);
  border-bottom-color: var(--red);
}

/* ---------- Hero / search ---------- */

.hero {
  padding: 56px 24px 40px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at top, rgba(179,21,29,0.04), transparent 60%),
    var(--bg);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.hero p.tagline {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 28px;
}

.search-shell {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 15px 18px 15px 46px;
  font-size: 16px;
  font-family: var(--font-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(179,21,29,0.12);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}

.result-count {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.result-count strong { color: var(--ink); }

/* ---------- Content grid: filters + table ---------- */

.content-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 32px 24px 80px;
}

@media (max-width: 860px) {
  .content-grid { grid-template-columns: 1fr; }
}

/* ---------- Filter sidebar ---------- */

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 84px;
}

@media (max-width: 860px) {
  .filters { position: static; }
}

.filters h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 14px;
}

.filter-group { margin-bottom: 22px; }
.filter-group:last-child { margin-bottom: 0; }

.filter-group label.group-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.filter-group select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
}

.filter-group select:focus { outline: none; border-color: var(--red); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .12s ease;
}

.chip:hover { border-color: var(--red); color: var(--red); }

.chip.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.reset-link {
  display: inline-block;
  margin-top: 16px;
  font-size: 12px;
  color: var(--red);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.reset-link:hover { border-bottom-color: var(--red); }

/* ---------- Data table ---------- */

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table.fighters-table {
  width: 100%;
  border-collapse: collapse;
}

.fighters-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: #FAFAF9;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.fighters-table thead th:hover { color: var(--red); }

.fighters-table thead th .sort-arrow {
  font-size: 9px;
  margin-left: 3px;
  opacity: 0.5;
}

.fighters-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background-color .1s ease;
}

.fighters-table tbody tr:last-child { border-bottom: none; }

.fighters-table tbody tr:hover {
  background: rgba(179,21,29,0.045);
}

.fighters-table td {
  padding: 11px 16px;
  font-size: 14px;
  vertical-align: middle;
}

.fighter-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.fighter-name {
  font-weight: 600;
  color: var(--ink);
}

.nat-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.flag { font-size: 16px; }

.record-badge {
  display: inline-flex;
  gap: 4px;
  font-weight: 600;
  font-size: 13.5px;
}
.record-badge .w { color: var(--win); }
.record-badge .l { color: var(--loss); }
.record-badge .d { color: var(--draw); }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.active {
  background: rgba(179,21,29,0.1);
  color: var(--red);
}

.status-badge.inactive {
  background: rgba(154,160,166,0.15);
  color: var(--ink-soft);
}

.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-soft);
}

.empty-state .em-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ---------- Fighter profile page ---------- */

.profile-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 44px 24px;
}

.profile-hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  gap: 28px;
  align-items: center;
}

.profile-avatar {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  flex-shrink: 0;
}

.profile-name {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  margin: 0 0 6px;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ink-soft);
}

.dot-sep::before { content: "·"; margin-right: 10px; color: var(--border); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.back-link:hover { color: var(--red); }

.stat-grid {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 700px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-hero-inner { flex-direction: column; text-align: center; }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-top: 4px;
}

.body-badges {
  max-width: 1120px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.body-badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  padding: 6px 12px;
  border: 1.5px solid var(--gold);
  color: #8A6D26;
  background: rgba(201,168,76,0.1);
  border-radius: var(--radius);
  letter-spacing: 0.03em;
}

.section-block {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.section-block h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 14px;
}

.no-history {
  color: var(--ink-soft);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.result-pill {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.result-pill.W { background: var(--win); }
.result-pill.L { background: var(--loss); }
.result-pill.D { background: var(--draw); }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Utility ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
