/* === Football Field === */

@font-face {
  font-family: 'Matrix II Wide';
  src: url('assets/fonts/matrix-ii-wide.otf') format('opentype');
}

.field-wrap {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
}

.field {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7.2;
  background:
    repeating-linear-gradient(
      90deg,
      var(--field-grass-1) 0,
      var(--field-grass-1) 8.33%,
      var(--field-grass-2) 8.33%,
      var(--field-grass-2) 16.66%
    );
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px oklch(1 0 0 / 0.18), inset 0 0 80px oklch(0 0 0 / 0.4);
  user-select: none;
}

/* End zones — M&T Bank Stadium style: Ravens purple with bold block letters */
.endzone {
  position: absolute;
  top: 0; bottom: 0;
  width: 8.33%;
  background:
    linear-gradient(180deg, oklch(0.30 0.16 290) 0%, oklch(0.24 0.16 290) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid oklch(1 0 0 / 0.18);
  overflow: hidden;
}
.endzone.left { left: 0; border-left: 0; }
.endzone.right { right: 0; border-right: 0; }

/* Stadium endzone text (shared) */
.ez-word {
  display: flex;
  font-family: 'Matrix II Wide', var(--font-display);
  font-weight: 1000;
  color: oklch(0.97 0.005 270);
  -webkit-text-fill-color: oklch(0.97 0.005 270);
  text-transform: uppercase;
  line-height: 0.9;
  letter-spacing: 0;
  -webkit-text-stroke: 3px oklch(0.9 0.18 100);
  paint-order: stroke;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.ez-letter {
  display: inline-block;
}

/* Horizontal field: endzones are tall+narrow, letters stack vertically */
.field:not(.vertical) .endzone .ez-word {
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: 78%;
  width: 100%;
  font-size: clamp(11px, 1.45vw, 19px);
}

/* Vertical field: endzones are wide+short, letters spread horizontally */
.field.vertical .endzone .ez-word {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 80%;
  height: 100%;
  font-size: clamp(18px, 4.2vw, 56px);
}

/* Field of play (between end zones) */
.field-play {
  position: absolute;
  left: 8.33%; right: 8.33%; top: 0; bottom: 0;
}

/* Yard lines */
.yard-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1.5px;
  background: oklch(1 0 0 / 0.55);
}
.yard-number {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(9px, 0.95vw, 13px);
  color: oklch(1 0 0 / 0.55);
  letter-spacing: 0.05em;
}
.yard-number.top { top: 5%; transform: translateX(-50%); }
.yard-number.bottom { bottom: 5%; transform: translateX(-50%) rotate(180deg); }

/* Hash marks */
.hash {
  position: absolute;
  width: 1.5px;
  height: 1.5%;
  background: oklch(1 0 0 / 0.4);
}
.hash.top { top: 36%; }
.hash.bottom { bottom: 36%; }

/* Midfield logo */
.mid-logo {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: oklch(1 0 0 / 0.05);
  border: 2px solid oklch(1 0 0 / 0.25);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 2.6vw, 36px);
  color: oklch(1 0 0 / 0.5);
  letter-spacing: -0.05em;
}

/* Player chip */
.player-pos {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.player-pos:hover { transform: translate(-50%, -50%) scale(1.08); z-index: 10; }

.player-disc {
  width: clamp(34px, 3.6vw, 50px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(160deg, oklch(0.96 0.005 260), oklch(0.82 0.005 260));
  color: oklch(0.16 0.02 260);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(11px, 1.1vw, 15px);
  box-shadow:
    0 0 0 2px oklch(0.16 0.02 260),
    0 4px 14px oklch(0 0 0 / 0.5),
    inset 0 1px 0 oklch(1 0 0 / 0.5);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  position: relative;
}
.offense .player-disc {
  background: linear-gradient(160deg, oklch(0.30 0.16 290), oklch(0.24 0.16 290));
  color: oklch(0.97 0.005 270);
  box-shadow:
    0 0 0 2px oklch(0.15 0.02 290),
    0 4px 14px oklch(0 0 0 / 0.5),
    inset 0 1px 0 oklch(1 0 0 / 0.3);
}
.defense .player-disc {
  background: linear-gradient(160deg, oklch(0.30 0.16 290), oklch(0.24 0.16 290));
  color: oklch(0.97 0.005 270);
  box-shadow:
    0 0 0 2px oklch(0.15 0.02 290),
    0 4px 14px oklch(0 0 0 / 0.5),
    inset 0 1px 0 oklch(1 0 0 / 0.3);
}

.player-pos .pos-label {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(8.5px, 0.7vw, 10px);
  font-weight: 600;
  letter-spacing: 0.1em;
  color: oklch(1 0 0 / 0.85);
  background: oklch(0 0 0 / 0.55);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
}

.player-pos .pos-name {
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: clamp(11px, 1.0vw, 13px);    /* ← increase from clamp(9px, 0.78vw, 11px) */
  font-weight: 700;
  color: oklch(1 0 0 / 0.95);
  text-shadow: 0 1px 3px oklch(0 0 0 / 0.8);
  white-space: nowrap;
  letter-spacing: 0.065em;
}

.player-pos .pos-depth {
  position: absolute;
  bottom: -3px; right: -3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  display: grid; place-items: center;
  border: 1.5px solid oklch(1 0 0 / 0.6);
}

/* Side toggle */
.field-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.side-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.side-toggle button {
  background: transparent;
  border: 0;
  padding: 8px 16px;
  color: var(--fg-1);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  transition: all 120ms;
}
.side-toggle button.active {
  background: var(--bg-0);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

/* Depth roster — stacked sections */
.depth-sections {
  margin-top: 18px;
}

/* Section divider: ─────  LABEL  ───── */
.depth-section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 12px;
}
.depth-section-divider:first-child { margin-top: 0; }
.depth-section-line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.depth-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.20em;
  color: var(--fg-2);
  text-transform: uppercase;
  white-space: nowrap;
}

/* Position cards flow horizontally (defense / special) */
.depth-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

/* Offense fixed formation grid: 9 equal columns, 2 rows */
.depth-fixed-grid {
  display: grid;
  gap: 8px;
}
.offense-grid {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: auto auto;
}
.defense-grid {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: auto auto auto;
}

.depth-pos-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  height: 130px;
  overflow-y: auto;
  scrollbar-width: none;       /* Firefox */
}
.depth-pos-card::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

/* Position title: centered, larger */
.depth-pos-card .ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.depth-pos-card .ph strong {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
}

/* Player rows: smaller text, no wrapping, hover highlight */
.depth-pos-card .pl-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 5px;
  margin: 0 -5px;
  font-size: 11px;
  border-radius: 4px;
  transition: background 80ms;
}
.depth-pos-card .pl-row:hover { background: var(--bg-3); }
.depth-pos-card .pl-row .num {
  font-family: var(--font-mono);
  color: var(--fg-2);
  width: 20px;
  text-align: right;
  font-size: 10px;
  flex-shrink: 0;
}
.depth-pos-card .pl-row .nm {
  color: var(--fg-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 80ms;
}
.depth-pos-card .pl-row:hover .nm { color: var(--accent); }
.depth-pos-card .pl-row.starter .nm { font-weight: 600; }
.depth-pos-card .pl-row.starter::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.depth-pos-card .pl-row:not(.starter)::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--fg-3);
  opacity: 0.5;
  flex-shrink: 0;
}

/* === Roster row filter animation === */
/* Rows stay mounted on filter change; .is-out collapses + fades them
   smoothly so the table reflows with motion instead of a hard cut. */
.roster-row td {
  transition:
    padding-top 260ms cubic-bezier(0.4, 0, 0.2, 1),
    padding-bottom 260ms cubic-bezier(0.4, 0, 0.2, 1),
    font-size 240ms cubic-bezier(0.4, 0, 0.2, 1),
    line-height 240ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 200ms ease,
    border-color 200ms ease,
    transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: padding, opacity;
  transform-origin: left center;
}
.roster-row.is-out {
  pointer-events: none;
}
.roster-row.is-out td {
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 0;
  line-height: 0;
  border-bottom-color: transparent;
  transform: translateX(-12px);
}
.roster-row.is-out td * { opacity: 0; transition: opacity 160ms ease; }

/* === Personnel dropdowns (Depth Chart page) === */
.personnel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 2px;
}
.personnel-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.personnel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--fg-2);
  text-transform: uppercase;
}
.personnel-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.personnel-select {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 7px 30px 7px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 120ms, background 120ms;
}
.personnel-select:hover { border-color: var(--accent-line); background: var(--bg-1); }
.personnel-select:focus { border-color: var(--accent-line); }
.select-chevron {
  position: absolute;
  right: 10px;
  color: var(--fg-2);
  pointer-events: none;
}

/* Custom Dropdown overrides */
.personnel-select {
  text-align: left;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 32px oklch(0 0 0 / 0.35), 0 2px 8px oklch(0 0 0 / 0.2);
  z-index: 50;
  padding: 6px 0;
  max-height: 280px;
  overflow-y: auto;
  animation: dropdownFadeIn 180ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  transform-origin: top center;
}

.custom-dropdown-option {
  padding: 10px 16px;
  color: var(--fg-0);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.custom-dropdown-option.selected {
  background: oklch(0.30 0.16 290);
  color: oklch(0.97 0.005 270);
}

/* === Vertical field (Depth Chart page) === */
.field.vertical {
  aspect-ratio: 1 / 1.4;
  background:
    repeating-linear-gradient(
      0deg,
      var(--field-grass-1) 0,
      var(--field-grass-1) 8.33%,
      var(--field-grass-2) 8.33%,
      var(--field-grass-2) 16.66%
    );
}
.field.vertical .endzone {
  position: absolute;
  left: 0; right: 0;
  width: auto;
  height: 8.33%;
  top: auto; bottom: auto;
  writing-mode: horizontal-tb;
  transform: none;
}
.field.vertical .endzone.top {
  top: 0; 
  border-top: 0; 
  border-left: 2px solid oklch(1 0 0 / 0.2); 
  border-right: 2px solid oklch(1 0 0 / 0.2); 
}
.field.vertical .endzone.bottom { 
  bottom: 0; 
  border-bottom: 0; 
  border-left: 2px solid oklch(1 0 0 / 0.2); 
  border-right: 2px solid oklch(1 0 0 / 0.2); 
}

.field-play.vertical {
  position: absolute;
  top: 8.33%; bottom: 8.33%;
  left: 0; right: 0;
}

/* Vertical yard lines: horizontal across the field, spaced top-to-bottom */
.yard-line.v {
  top: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  bottom: auto;
}
.yard-number.v {
  top: 0;
}
.yard-number.v.left { left: 5%; transform: translateY(-50%); }
.yard-number.v.right { right: 5%; transform: translateY(-50%) rotate(180deg); }

/* Vertical hash marks: short horizontal ticks on each sideline */
.hash.v {
  top: 0;
  width: 1.5%;
  height: 1.5px;
  bottom: auto;
}
.hash.v.left { left: 36%; }
.hash.v.right { right: 36%; }

/* Faint Ravens watermarks (one per half) */
.raven-watermark {
  position: absolute;
  left: 50%;
  width: 55%;
  aspect-ratio: 192.7 / 94.6;
  background: url('assets/baltimore-ravens-logo.svg') center / contain no-repeat;
  opacity: 0.08;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: grayscale(0.2);
}
.raven-watermark.top { top: 25%; }
.raven-watermark.bottom { top: 75%; }

/* Line of scrimmage divider between defense (top) and offense (bottom) */
.field-play.vertical .scrimmage {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 2px;
  background: oklch(0.78 0.14 210);
  box-shadow: 0 0 10px oklch(0.78 0.14 210 / 0.55);
  pointer-events: none;
  z-index: 1;
}

/* Layout: only-field full width */
.field-fullwidth { grid-template-columns: 1fr; }
.field-fullwidth .depth-list { display: none; }

/* Abstract grid mode (no field) */
.abstract-mode .field-wrap { display: none; }
.abstract-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1000px) { .abstract-grid { grid-template-columns: repeat(2, 1fr); } }
