/*
 * Gridiron — front-end theme for the Eliminator pool.
 *
 * Field green chrome, chalk-white page, penalty-flag yellow for the one action
 * that matters (your pick), and marker red for eliminations.
 */

:root {
    --field: #16402A;
    --field-deep: #0F2F1F;
    --chalk: #F5F7F3;
    --ink: #15211A;
    --ink-soft: #4A5A50;
    --flag: #F4C430;
    --flag-deep: #D9A800;
    --strike: #C8312B;
    --turf: #2F7A4A;
    --line: #D9DFD9;
    --paper: #FFFFFF;

    /* Text on the green field and on flag yellow; the same in light and dark. */
    --on-field: #F5F7F3;
    --on-flag: #15211A;

    /* Roles that change between light and dark. */
    --link: var(--field);
    --link-hover: var(--turf);
    --input-border: #BFC8C1;
    --out-name: #7D8A82;
    --win-bg: #DCEFE2;
    --win-ink: #1E5A35;
    --loss-bg: var(--strike);
    --pending-bg: #ECEFEC;

    --font-display: "Big Shoulders Display", "Arial Narrow", sans-serif;
    --font-body: "Barlow", system-ui, sans-serif;

    /* Bootstrap hooks, so module and Orchard views (login, register) match. */
    --bs-body-bg: var(--chalk);
    --bs-body-color: var(--ink);
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 1.0625rem;
    --bs-body-line-height: 1.5;
    --bs-secondary-color: var(--ink-soft);
    --bs-border-color: var(--line);
    --bs-link-color: var(--link);
    --bs-link-color-rgb: 22, 64, 42;
    --bs-link-hover-color: var(--link-hover);
    --bs-link-hover-color-rgb: 47, 122, 74;
    --bs-primary: var(--field);
    --bs-primary-rgb: 22, 64, 42;
    --bs-success: var(--turf);
    --bs-success-rgb: 47, 122, 74;
    --bs-danger: var(--strike);
    --bs-danger-rgb: 200, 49, 43;
    --bs-warning: var(--flag);
    --bs-warning-rgb: 244, 196, 48;
    --bs-border-radius: 6px;
    --bs-focus-ring-color: rgba(244, 196, 48, .6);
}

/*
 * Dark mode: a night game. The page goes to dark turf rather than grey, the
 * header keeps its field green, and flag yellow stays the brightest thing.
 * Bootstrap's own dark variables cover everything not set here.
 */
:root[data-bs-theme="dark"] {
    --field: #143823;
    --field-deep: #0C2416;
    --chalk: #0D1812;
    --paper: #13221A;
    --ink: #E6EDE8;
    --ink-soft: #9CB0A3;
    --line: #253A2D;
    --strike: #E5574F;
    --turf: #5DBB7E;

    --link: #8FD3A6;
    --link-hover: #B5E6C4;
    --input-border: #36503F;
    --out-name: #6F8277;
    --win-bg: #1B3A26;
    --win-ink: #9BE0B2;
    --loss-bg: #B8362F;
    --pending-bg: #1E2E25;

    --bs-body-bg: var(--chalk);
    --bs-body-color: var(--ink);
    --bs-secondary-color: var(--ink-soft);
    --bs-border-color: var(--line);
    --bs-link-color-rgb: 143, 211, 166;
    --bs-link-hover-color-rgb: 181, 230, 196;
    --bs-success-rgb: 93, 187, 126;
    --bs-danger-rgb: 229, 87, 79;
    --bs-emphasis-color: #FFFFFF;
    --bs-tertiary-bg: var(--paper);
    color-scheme: dark;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--chalk);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .h1, .h2, .h3 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1;
    letter-spacing: .005em;
    color: var(--ink);
}

h2, .h2 { font-size: 2rem; }
h3, .h3 { font-size: 1.5rem; }

:focus-visible {
    outline: 3px solid var(--flag);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: .5rem;
    left: .5rem;
    z-index: 2000;
    padding: .5rem .75rem;
    background: var(--flag);
    color: var(--on-flag);
    border-radius: var(--bs-border-radius);
}

/* ---------- Field: header + hero share the mowed-grass surface ---------- */

.site-header,
.elim-hero {
    background-color: var(--field);
    background-image: repeating-linear-gradient(90deg,
        rgba(255, 255, 255, .035) 0 80px,
        rgba(0, 0, 0, .04) 80px 160px);
    color: var(--on-field);
}

.site-header .navbar {
    --bs-navbar-color: rgba(245, 247, 243, .78);
    --bs-navbar-hover-color: #fff;
    --bs-navbar-active-color: #fff;
    --bs-navbar-toggler-border-color: rgba(245, 247, 243, .3);
    padding-block: .75rem;
    gap: .5rem 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--on-field);
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1;
}

.brand:hover { color: #fff; }

.brand-flag {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--on-field);
    transform: rotate(-8deg);
}

.site-header .nav-link {
    font-weight: 500;
    padding-inline: .75rem !important;
    border-radius: var(--bs-border-radius);
}

.site-header .nav-link.active {
    box-shadow: inset 0 -2px 0 var(--on-field);
    border-radius: 0;
}

.site-user { display: flex; align-items: center; }
.site-user .navbar-nav { flex-direction: row; gap: .25rem; }
.site-user .dropdown-menu { position: absolute; }
.site-user .navbar-nav,
.site-user ul { margin: 0; }
.site-user .nav-link,
.site-user .btn-link { color: rgba(245, 247, 243, .85); }
.site-user .dropdown-menu { --bs-dropdown-link-active-bg: var(--field); }

/* Hero: pool name and the one sentence that says where things stand. */

.elim-hero {
    position: relative;
    padding: 2.5rem 0 3.25rem;
    /* Chalk sideline with hash marks along the bottom edge. */
    border-bottom: 3px solid var(--on-field);
}

.elim-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 14px;
    background: repeating-linear-gradient(90deg,
        rgba(245, 247, 243, .55) 0 2px,
        transparent 2px 40px);
}

.elim-hero h1 {
    color: #fff;
    font-size: clamp(2.75rem, 9vw, 5.5rem);
    max-width: 16ch;
    margin: 0 0 .75rem;
}

.elim-hero-status {
    font-size: clamp(1.125rem, 2.4vw, 1.375rem);
    max-width: 52ch;
    margin: 0;
    color: rgba(245, 247, 243, .9);
}

.elim-hero-status strong { color: #fff; font-weight: 600; }

.elim-hero-champs {
    color: var(--flag);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6em;
}

.site-main {
    flex: 1;
    padding-block: 2rem 3rem;
}

/* ---------- Buttons and forms ---------- */

.btn {
    --bs-btn-font-weight: 600;
    --bs-btn-padding-x: 1.1rem;
    --bs-btn-padding-y: .55rem;
}

.btn-primary {
    --bs-btn-color: var(--on-flag);
    --bs-btn-bg: var(--flag);
    --bs-btn-border-color: var(--flag);
    --bs-btn-hover-color: var(--on-flag);
    --bs-btn-hover-bg: var(--flag-deep);
    --bs-btn-hover-border-color: var(--flag-deep);
    --bs-btn-active-color: var(--on-flag);
    --bs-btn-active-bg: var(--flag-deep);
    --bs-btn-active-border-color: var(--flag-deep);
    --bs-btn-disabled-color: var(--on-flag);
    --bs-btn-disabled-bg: var(--flag);
    --bs-btn-disabled-border-color: var(--flag);
    --bs-btn-focus-shadow-rgb: 244, 196, 48;
}

.btn-secondary,
.btn-outline-secondary {
    --bs-btn-color: var(--link);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--link);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--field);
    --bs-btn-hover-border-color: var(--field);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--field-deep);
    --bs-btn-active-border-color: var(--field-deep);
}

.form-control,
.form-select {
    --bs-border-color: var(--input-border);
    background-color: var(--paper);
    padding-block: .55rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--link);
    box-shadow: 0 0 0 .25rem rgba(244, 196, 48, .45);
}

.form-label { font-weight: 600; }

.alert {
    --bs-alert-border-radius: 0;
    border: 0;
    border-left: 5px solid currentColor;
    background: var(--paper);
    color: var(--ink);
}

.alert-success { border-left-color: var(--turf); }
.alert-danger { border-left-color: var(--strike); }
.alert-info { border-left-color: var(--link); }
.alert-warning { border-left-color: var(--flag); }

/* Orchard's login, register and password pages. */
.auth-form,
form[action$="/Register"],
form[action*="ForgotPassword"],
form[action*="ResetPassword"],
form[action*="ChangePassword"] {
    max-width: 30rem;
}

/* ---------- Pool page ---------- */

.elim-layout {
    display: grid;
    /* minmax(0, …) lets the board scroll inside its box instead of widening the page. */
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

@media (min-width: 992px) {
    .elim-layout.has-aside { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
}

.elim-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--bs-border-radius);
    padding: 1.5rem;
}

.elim-panel h2 { margin-bottom: .5rem; }

/* A column of panels: one per entry, then join and pending notes. */
.elim-stack {
    display: grid;
    gap: 1rem;
    align-content: start;
}

/* Which entry a pick panel belongs to, when a player has more than one. */
.elim-panel-entry {
    margin: 0 0 .25rem;
    font-weight: 600;
    font-size: .9375rem;
    color: var(--ink-soft);
}
.elim-panel p:last-child { margin-bottom: 0; }

/* Your pick: the only flag-yellow surface on the page. */
.elim-pick {
    border-top: 8px solid var(--flag);
}

.elim-pick-current {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 2.25rem;
    line-height: 1;
    margin: .25rem 0 1rem;
}

.elim-pick-missing {
    color: var(--strike);
    font-weight: 600;
}

.elim-deadline { color: var(--ink-soft); }
.elim-deadline strong { color: var(--ink); }

.elim-used {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--line);
    font-size: .9375rem;
    color: var(--ink-soft);
}

.elim-out-note {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--strike);
    line-height: 1.1;
}

/* ---------- The board ---------- */

.elim-board-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .25rem 1rem;
    margin-bottom: .75rem;
}

.elim-board-head h2 { margin: 0; }
.elim-board-head p { margin: 0; color: var(--ink-soft); }

.elim-board-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--bs-border-radius);
}

.elim-board {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.elim-board th,
.elim-board td {
    padding: .7rem .75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}

.elim-board tbody tr:last-child > * { border-bottom: 0; }

.elim-board thead th {
    font-weight: 500;
    font-size: .875rem;
    color: var(--ink-soft);
    background: var(--chalk);
}

.elim-board thead th a { color: inherit; text-decoration: none; }
.elim-board thead th a:hover { color: var(--link); text-decoration: underline; }

.elim-board .elim-week { text-align: center; }

.elim-board th.elim-entry {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
}

.elim-board thead th.elim-entry { background: var(--chalk); }
.elim-board tbody th.elim-entry { background: var(--paper); }

.elim-name {
    position: relative;
    display: inline-block;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1.1;
    color: var(--ink);
}

.elim-entry small {
    display: block;
    font-size: .8125rem;
    color: var(--ink-soft);
}

/* Crossed off the sheet: a marker stroke through eliminated names. */
.is-out .elim-name { color: var(--out-name); }

.is-out .elim-name::after {
    content: "";
    position: absolute;
    left: -.15em;
    right: -.15em;
    top: 52%;
    height: .16em;
    border-radius: .1em;
    background: var(--strike);
    transform: rotate(-3deg);
    transform-origin: left center;
    animation: elim-strike .45s cubic-bezier(.6, 0, .3, 1) both;
    animation-delay: calc(.25s + var(--i, 0) * .08s);
}

@keyframes elim-strike {
    from { transform: rotate(-3deg) scaleX(0); }
    to { transform: rotate(-3deg) scaleX(1); }
}

.is-winner .elim-name::before {
    content: "";
    display: inline-block;
    width: .7em;
    height: .7em;
    margin-right: .3em;
    background: var(--flag);
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.is-me th.elim-entry { box-shadow: inset 5px 0 0 var(--flag); }

/* Pick chips: team abbreviation, colored by result. */
.elim-chip {
    display: inline-block;
    min-width: 3.25rem;
    padding: .25rem .5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: .9375rem;
    text-align: center;
    line-height: 1.2;
}

.elim-chip.is-win { background: var(--win-bg); color: var(--win-ink); }
.elim-chip.is-loss { background: var(--loss-bg); color: #fff; }
.elim-chip.is-pending { background: var(--pending-bg); color: var(--ink-soft); }
.elim-chip.is-saved { box-shadow: inset 0 0 0 2px var(--flag); }

.elim-status {
    font-size: .875rem;
    font-weight: 600;
}

.elim-status.is-alive { color: var(--turf); }
.elim-status.is-out { color: var(--strike); }
.elim-status.is-winner { color: var(--ink); }

/* ---------- Week page ---------- */

.elim-weeks {
    display: flex;
    flex-wrap: wrap;
    gap: .375rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.elim-weeks a {
    display: inline-block;
    min-width: 2.75rem;
    padding: .35rem .6rem;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: var(--bs-border-radius);
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.elim-weeks a:hover { border-color: var(--link); }
.elim-weeks a[aria-current="page"] { background: var(--field); border-color: var(--field); color: #fff; }

.elim-tally {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.elim-tally li {
    padding: .3rem .65rem;
    border-radius: 4px;
    background: var(--paper);
    border: 1px solid var(--line);
    font-weight: 600;
}

.elim-tally li span { color: var(--ink-soft); font-weight: 400; }

.elim-game { color: var(--ink-soft); font-size: .9375rem; }

/* ---------- Footer ---------- */

.site-footer {
    padding: 1.5rem 0;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: .9375rem;
}

.site-footer p { margin: 0; }

/* ---------- Small screens ---------- */

@media (max-width: 575.98px) {
    .site-main { padding-top: 1.5rem; }
    .elim-hero { padding: 1.75rem 0 2.5rem; }
    .elim-panel { padding: 1.25rem; }
    .elim-name { font-size: 1.3rem; }
    .elim-board th,
    .elim-board td { padding: .6rem .5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .is-out .elim-name::after { animation: none; }
}
