/* ============================================================
   Yes Hitter -- design tokens
   Typography styled after modern sports-network sites (clean
   condensed display type, plain sans body). Palette drawn from
   the field itself: grass green, infield dirt brown, chalk white.
   ============================================================ */

:root {
  --field-green: #1e5631;
  --field-green-deep: #123c21;
  --infield-brown: #8b5a2b;
  --infield-brown-deep: #6b4420;
  --chalk-white: #ffffff;
  --off-white: #f7f6f2;
  --ink: #1a1a1a;
  --ink-soft: #59564d;
  --out-marker: #b23a2e;
  --hairline: rgba(26, 26, 26, 0.12);
  --hairline-on-dark: rgba(255, 255, 255, 0.18);

  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;

  --radius: 4px;
  --shadow-card: 0 1px 0 rgba(26, 26, 26, 0.05), 0 6px 18px -12px rgba(26, 26, 26, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--off-white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--infield-brown);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.005em;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.external-link-icon {
  font-size: 0.8em;
  margin-left: 3px;
  opacity: 0.7;
}

/* ============================================================
   Preview data banner -- shown when the API can't be reached and
   the site is silently falling back to mock/demo data, so that
   fallback is never mistaken for real records.
   ============================================================ */

.preview-banner {
  display: none;
  background: var(--out-marker);
  color: var(--chalk-white);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
}

/* ============================================================
   Top bar
   ============================================================ */

.topbar {
  background: var(--field-green-deep);
  color: var(--chalk-white);
  border-bottom: 3px solid var(--infield-brown);
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--chalk-white);
  text-transform: uppercase;
  white-space: nowrap;
}

.wordmark span {
  color: #7fbf8e;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.topnav {
  display: flex;
  gap: 24px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topnav a {
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--chalk-white);
  border-color: #7fbf8e;
}

.follow-x {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--chalk-white);
  color: var(--field-green-deep);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: background 0.15s ease;
}

.follow-x:hover,
.follow-x:focus-visible {
  background: #e9e6de;
}

.follow-x svg {
  width: 13px;
  height: 13px;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  background: linear-gradient(180deg, var(--field-green) 0%, var(--field-green-deep) 100%);
  color: var(--chalk-white);
  padding: 64px 0 56px;
  position: relative;
  border-bottom: 4px solid var(--infield-brown);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 44px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(38px, 5.6vw, 60px);
  line-height: 0.98;
  text-transform: uppercase;
}

.hero h1 em {
  font-style: normal;
  color: #8fd39e;
}

.hero-sub {
  margin-top: 16px;
  max-width: 50ch;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
  line-height: 1.6;
}

.hero-rule {
  width: 48px;
  height: 3px;
  background: var(--infield-brown);
  margin-bottom: 18px;
}

.hero-example {
  background: var(--chalk-white);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px 24px 24px;
  box-shadow: var(--shadow-card);
}

.example-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.example-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.example-name {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 800;
}

.example-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ============================================================
   Headshots / logos
   ============================================================ */

.headshot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--off-white);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
}

.headshot--sm {
  width: 28px;
  height: 28px;
}

.headshot--lg {
  width: 88px;
  height: 88px;
}

.team-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
}

.team-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ============================================================
   Diamond trail -- signature element
   ============================================================ */

.diamond-trail {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 6px;
}

.diamond {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0;
  animation: diamond-in 0.35s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .diamond {
    opacity: 1;
    animation: none;
  }
}

.diamond--safe {
  background: var(--field-green);
  border: 1px solid var(--field-green-deep);
}

.diamond--out {
  background: transparent;
  border: 1px solid var(--out-marker);
}

@keyframes diamond-in {
  from {
    opacity: 0;
    transform: rotate(45deg) scale(0.4);
  }
  to {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
}

.trail-more {
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-left: 2px;
}

/* Both-teams matchup display (logo + abbreviation on each side) */
.matchup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.matchup .abbr {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.matchup .vs {
  color: var(--ink-soft);
  font-size: 12px;
  margin: 0 2px;
}

.card-date-line {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.trail-key {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.trail-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.key-swatch {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  display: inline-block;
}

.key-swatch--safe {
  background: var(--field-green);
  border: 1px solid var(--field-green-deep);
}

.key-swatch--out {
  border: 1px solid var(--out-marker);
}

.example-line {
  font-size: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--hairline);
  color: var(--ink-soft);
}

.box-score-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--field-green);
  text-decoration: none;
}

.box-score-link:hover,
.box-score-link:focus-visible {
  text-decoration: underline;
}

/* ============================================================
   Section shells
   ============================================================ */

section {
  padding: 52px 0;
}

section + section {
  border-top: 1px solid var(--hairline);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-head h2 {
  font-size: 30px;
  text-transform: uppercase;
}

.section-head .section-sub {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ============================================================
   Feed cards
   ============================================================ */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 0 rgba(26, 26, 26, 0.05), 0 12px 22px -14px rgba(26, 26, 26, 0.4);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.card-name-block {
  min-width: 0;
}

.pitcher-link {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  text-decoration: none;
  color: var(--ink);
}

.pitcher-link:hover,
.pitcher-link:focus-visible {
  color: var(--field-green);
  text-decoration: underline;
}

.card-meta {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
}

.card-meta a {
  color: var(--ink-soft);
  text-decoration: none;
}

.card-meta a:hover {
  color: var(--field-green);
  text-decoration: underline;
}

.badge {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--yes {
  background: var(--field-green);
  color: var(--chalk-white);
}

.badge--near {
  background: transparent;
  border: 1px solid var(--out-marker);
  color: var(--out-marker);
}

.card .diamond-trail {
  margin: 14px 0 4px;
}

.card .diamond {
  width: 12px;
  height: 12px;
}

.card-line {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--hairline);
}

.empty-state {
  font-size: 14px;
  color: var(--ink-soft);
  padding: 32px;
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
}

/* ============================================================
   From the Archive
   ============================================================ */

.archive-rarity {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.archive-rarity strong {
  color: var(--infield-brown-deep);
  font-variant-numeric: tabular-nums;
}

.featured {
  background: linear-gradient(135deg, var(--field-green) 0%, var(--field-green-deep) 100%);
  color: var(--chalk-white);
  border-radius: var(--radius);
  padding: 30px 32px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 26px;
  align-items: center;
}

.featured-badge-col {
  border-right: 1px solid var(--hairline-on-dark);
  padding-right: 26px;
  text-align: center;
}

.featured-badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fd39e;
}

.featured-badge small {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 6px;
  font-weight: 600;
}

.featured-name {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
}

.featured-meta {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 2px;
}

.featured .diamond-trail {
  margin-top: 14px;
}

.featured .box-score-link {
  color: #8fd39e;
}

/* ============================================================
   Leaderboards
   ============================================================ */

.ledger-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ledger-tab {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.ledger-tab:hover,
.ledger-tab:focus-visible {
  color: var(--ink);
}

.ledger-tab.active {
  background: var(--field-green);
  border-color: var(--field-green);
  color: var(--chalk-white);
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}

table.ledger th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--chalk-white);
  background: var(--infield-brown);
  padding: 10px 14px;
}

table.ledger td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14.5px;
}

table.ledger tr:last-child td {
  border-bottom: none;
}

table.ledger tr:nth-child(even) {
  background: var(--off-white);
}

table.ledger td.rank {
  color: var(--ink-soft);
  width: 36px;
}

table.ledger td.count {
  font-weight: 700;
  text-align: right;
  color: var(--field-green);
}

.table-scroll {
  overflow-x: auto;
}

table.stats-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

table.stats-table th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  color: var(--chalk-white);
  background: var(--infield-brown);
  padding: 9px 10px;
  white-space: nowrap;
}

/* Numeric header cells must match the centered alignment of their
   data cells below (table.stats-table td.num) -- without this they
   sit left-aligned while their numbers sit centered underneath. */
table.stats-table th.num {
  text-align: center;
}

table.stats-table th.sortable {
  cursor: pointer;
  user-select: none;
}

table.stats-table th.sortable:hover,
table.stats-table th.sortable:focus-visible {
  background: var(--infield-brown-deep);
}

table.stats-table th.sortable .sort-arrow {
  display: inline-block;
  width: 10px;
  margin-left: 3px;
  opacity: 0.5;
}

table.stats-table th.sortable.sorted .sort-arrow {
  opacity: 1;
}

table.stats-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
  white-space: nowrap;
}

table.stats-table tr:nth-child(even) {
  background: var(--off-white);
}

table.stats-table td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.scroll-sentinel {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--ink-soft);
}

.leaderboard-page section {
  padding-top: 36px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-field label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Multiselect team/opponent dropdown */
.ms-dropdown {
  position: relative;
}

.ms-button {
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: var(--off-white);
  color: var(--ink);
  min-width: 130px;
  text-align: left;
  cursor: pointer;
}

.ms-button:focus-visible {
  outline: 2px solid var(--field-green);
  outline-offset: 1px;
}

.ms-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  width: 240px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 6px 0;
}

.ms-panel.open {
  display: block;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13.5px;
  cursor: pointer;
}

.ms-option:hover {
  background: var(--off-white);
}

.ms-option input {
  margin: 0;
}

.filter-field input,
.filter-field select {
  font-family: var(--font-body);
  font-size: 13.5px;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  background: var(--off-white);
  color: var(--ink);
  min-width: 130px;
}

.filter-field input:focus,
.filter-field select:focus {
  outline: 2px solid var(--field-green);
  outline-offset: 1px;
}

.filter-clear {
  align-self: flex-end;
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.filter-clear:hover {
  color: var(--out-marker);
  border-color: var(--out-marker);
}

.load-more-row {
  text-align: center;
  margin-top: 16px;
}

.load-more-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--infield-brown);
  color: var(--chalk-white);
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius);
  cursor: pointer;
}

.load-more-btn:hover,
.load-more-btn:focus-visible {
  background: var(--infield-brown-deep);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ============================================================
   Closest calls strip
   ============================================================ */

.closest-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.closest-card {
  flex: 0 0 260px;
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.closest-card .pitcher-link {
  font-size: 17px;
}

.closest-card .diamond {
  width: 11px;
  height: 11px;
}

.miss-note {
  font-size: 12px;
  color: var(--out-marker);
  font-weight: 600;
  margin-top: 10px;
}

/* ============================================================
   Pitcher profile page
   ============================================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 8px;
}

.profile-name {
  font-size: clamp(32px, 5vw, 46px);
  text-transform: uppercase;
}

.profile-links {
  margin-top: 6px;
  font-size: 14px;
}

.profile-links a {
  color: var(--field-green);
  text-decoration: none;
  font-weight: 600;
}

.profile-links a:hover {
  text-decoration: underline;
}

.profile-totals {
  display: flex;
  gap: 28px;
  margin: 20px 0 32px;
}

.profile-stat {
  background: var(--chalk-white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 22px;
  text-align: center;
}

.profile-stat .num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  color: var(--field-green);
  display: block;
}

.profile-stat .label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  margin-bottom: 20px;
}

.back-link:hover {
  color: var(--field-green);
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  background: var(--field-green-deep);
  color: rgba(255, 255, 255, 0.7);
  padding: 30px 0;
  font-size: 12.5px;
}

footer a {
  color: #8fd39e;
  text-decoration: none;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .topnav {
    display: none;
  }

  .featured {
    grid-template-columns: 1fr;
  }

  .featured-badge-col {
    border-right: none;
    border-bottom: 1px solid var(--hairline-on-dark);
    padding-right: 0;
    padding-bottom: 16px;
  }

  .profile-totals {
    flex-wrap: wrap;
  }
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--field-green);
  outline-offset: 2px;
}
