/*
 * Hawks After Dark — cyan lettering, a red underline, black and white.
 *
 * Everything is tokens on :root, so a different team can be re-skinned by
 * editing this block and nothing else.
 */

:root {
  --cyan: #00afe0;
  --red: #ff1020;

  --bg: #121212;
  --surface: #1c1c1c;
  --surface-2: #232323;
  --line: #333;
  --line-soft: #2a2a2a;
  --text: #f5f5f5;
  --muted: #a3a3a3;

  --win: var(--cyan);
  --loss: #f4603f;
  --tie: var(--muted);

  --league-wednesday: var(--cyan);
  --league-thursday: #f4603f;

  --field: #243b33;
  --field-infield: #2b4139;
  --field-chalk: #cfdedb;

  --radius: 10px;
  --wrap: 1180px;

  --display: "Bebas Neue", "Barlow Condensed", Impact, sans-serif;
  --sans: "Barlow", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 3.25rem);
}
h2 {
  font-size: 1.75rem;
}
h3 {
  font-size: 1.1rem;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  color: var(--cyan);
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--muted);
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 16px;
}

.muted,
.subtitle {
  color: var(--muted);
}

.sep {
  margin-inline: 0.45em;
  color: var(--line);
}

/* ---------------------------------------------------------------- header -- */

.site-head {
  border-bottom: 2px solid var(--red);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
}

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

.brand img {
  height: 52px;
  width: auto;
}

.brand.has-logo .brand-text {
  display: none;
}

@media (max-width: 480px) {
  .brand img {
    height: 40px;
  }
}

.brand-text {
  font-family: var(--display);
  font-size: 1.6rem;
  color: var(--cyan);
  white-space: nowrap;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 7px 12px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

.nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav a.is-active {
  background: var(--cyan);
  color: #06232c;
}

main {
  padding-block: 24px 48px;
}

/* ------------------------------------------------------------------ bits -- */

.page-head {
  margin-bottom: 18px;
}

.page-head .subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.back {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.loading {
  color: var(--muted);
  padding-block: 40px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.controls > :last-child:not(:only-child) {
  margin-left: auto;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.is-active {
  background: var(--cyan);
  color: #06232c;
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.field input {
  width: 72px;
}

.button {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--cyan);
  color: #06232c;
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 7px 14px;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.1);
  color: #06232c;
}

.button.ghost {
  background: none;
  border-color: var(--line);
  color: var(--text);
}

.button.ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  filter: none;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--badge, var(--cyan)) 18%, transparent);
  color: var(--badge, var(--cyan));
}

.badge[data-league="wednesday"] {
  --badge: var(--league-wednesday);
}
.badge[data-league="thursday"] {
  --badge: var(--league-thursday);
}

.notice {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.notice ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.notice-warn {
  border-left-color: #e8b33c;
}
.notice-bad {
  border-left-color: var(--red);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-title {
  font-family: var(--display);
  font-size: 1.75rem;
  color: var(--text);
  margin: 0 0 4px;
}

.empty .button {
  margin-top: 14px;
}

.file-note {
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ----------------------------------------------------------------- table -- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table.stats {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

table.stats th,
table.stats td {
  padding: 8px 9px;
  text-align: left;
  white-space: nowrap;
}

table.stats thead th {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}

table.stats thead th:hover {
  color: var(--text);
}

table.stats .num {
  text-align: right;
}

table.stats tbody tr {
  border-bottom: 1px solid var(--line-soft);
}

table.stats tbody tr:last-child {
  border-bottom: 0;
}

table.stats tbody tr:hover {
  background: var(--surface-2);
}

table.stats .is-sorted {
  color: var(--cyan);
}

.caret {
  margin-left: 2px;
  font-size: 0.7em;
}

.sticky {
  position: sticky;
  left: 0;
  background: var(--surface);
  font-weight: 600;
}

tbody tr:hover .sticky {
  background: var(--surface-2);
}

table.stats tfoot td {
  border-top: 1px solid var(--line);
  font-weight: 700;
  background: var(--surface-2);
}

table.stats tfoot .sticky {
  background: var(--surface-2);
}

.player-link {
  font-weight: 600;
}

.jersey {
  color: var(--muted);
  margin-right: 6px;
  font-weight: 400;
}

/* ------------------------------------------------------------ game list -- */

.game-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.game-row {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 14px;
}

.game-row:hover {
  border-color: #454545;
}

.result {
  font-family: var(--display);
  font-size: 1.75rem;
  width: 1.1em;
  text-align: center;
  color: var(--tie);
}

.result[data-result="W"] {
  color: var(--win);
}
.result[data-result="L"] {
  color: var(--loss);
}

.game-main {
  flex: 1;
  min-width: 0;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.game-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.score {
  font-family: var(--display);
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

.score .dash {
  color: var(--muted);
  margin-inline: 1px;
}

.scoreline {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.scoreline[data-result="W"] {
  color: var(--win);
}
.scoreline[data-result="L"] {
  color: var(--loss);
}

/* ---------------------------------------------------------------- player -- */

.player-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.jersey-big {
  font-family: var(--display);
  font-size: clamp(3rem, 12vw, 4.5rem);
  line-height: 0.85;
  color: var(--cyan);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 {
  margin-bottom: 12px;
}

.card-primary h2 {
  color: var(--cyan);
}

.card[data-league="wednesday"] h2 {
  color: var(--league-wednesday);
}
.card[data-league="thursday"] h2 {
  color: var(--league-thursday);
}

.split-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 720px) {
  .split-grid {
    grid-template-columns: 1fr 1fr;
  }
  .split-grid .card {
    margin-bottom: 0;
  }
}

.headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.stat-value {
  font-family: var(--display);
  font-size: 1.9rem;
  line-height: 1;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stat-small .stat-label {
  font-size: 0.6rem;
}

.block {
  margin-top: 28px;
}

.block h2 {
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------- lineup -- */

.lineup-layout {
  display: grid;
  gap: 20px;
}

@media (min-width: 900px) {
  .lineup-layout {
    grid-template-columns: minmax(320px, 1.05fr) 1.3fr;
    align-items: start;
  }
}

/* Grid items default to min-width:auto, which lets wide content push the
   column past the viewport — on a phone the field has to shrink instead. */
.lineup-layout > * {
  min-width: 0;
}

.diamond {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 600 / 570;
}

.diamond-field,
.diamond-field svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.diamond .turf {
  fill: var(--field);
}
.diamond .infield {
  fill: var(--field-infield);
}
.diamond .chalk {
  fill: none;
  stroke: var(--field-chalk);
  stroke-width: 2;
  opacity: 0.55;
}
.diamond .fence {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 2;
  stroke-dasharray: 5 8;
  opacity: 0.4;
}
.diamond .mound {
  fill: none;
  stroke: var(--field-chalk);
  stroke-width: 1.5;
  opacity: 0.5;
}
.diamond .base {
  fill: var(--text);
}

.slot {
  position: absolute;
  width: 24%;
  transform: translate(-50%, -50%);
}

.slot[data-position="LF"] {
  left: 14%;
  top: 26%;
}
.slot[data-position="LC"] {
  left: 37%;
  top: 13%;
}
.slot[data-position="RC"] {
  left: 63%;
  top: 13%;
}
.slot[data-position="RF"] {
  left: 86%;
  top: 26%;
}
.slot[data-position="SS"] {
  left: 32%;
  top: 42%;
}
.slot[data-position="2B"] {
  left: 68%;
  top: 42%;
}
.slot[data-position="3B"] {
  left: 18%;
  top: 61%;
}
.slot[data-position="1B"] {
  left: 82%;
  top: 61%;
}
.slot[data-position="P"] {
  left: 50%;
  top: 64%;
}
.slot[data-position="C"] {
  left: 50%;
  top: 90%;
}

.slot-button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.slot-button:hover {
  border-color: var(--cyan);
}

.slot-position {
  font-family: var(--display);
  font-size: 1.05rem;
  line-height: 1;
  color: var(--cyan);
}

.slot-name {
  font-size: 0.68rem;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-name.is-empty {
  color: var(--muted);
}

@media (max-width: 620px) {
  .slot {
    width: 27%;
  }

  .slot-button {
    padding: 4px 2px;
  }

  .slot-position {
    font-size: 0.9rem;
  }

  .slot-name {
    font-size: 0.6rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

table.batting td {
  padding-block: 7px;
}

.order-number {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--muted);
  width: 2ch;
}

.grip {
  color: var(--line);
  margin-right: 8px;
  cursor: grab;
}

table.batting tbody tr {
  cursor: grab;
}

.position-chip,
.chip {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.position-chip:hover,
.chip:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.chip {
  font-size: 0.85rem;
  padding: 6px 11px;
}

.chip.is-active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #06232c;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-select {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 4px;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions button {
  font: inherit;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
}

.row-actions button:hover {
  color: var(--cyan);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.name-input {
  width: 140px;
}

.bench {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.bench h3 {
  margin-bottom: 10px;
  font-size: 0.75rem;
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.bench .count {
  color: var(--cyan);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.6);
}

.modal-card {
  width: min(460px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-button {
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--text);
}

/* ---------------------------------------------------------------- footer -- */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: 20px 36px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ----------------------------------------------------------------- print -- */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --text: #000;
    --muted: #555;
    --line: #bbb;
    --line-soft: #ddd;
  }

  body {
    background: #fff;
  }

  .site-head,
  .site-foot,
  .no-print,
  .nav,
  #banner {
    display: none !important;
  }

  .lineup-layout {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .table-wrap {
    overflow: visible;
  }
}
