﻿
/* ─── TOKENS ─────────────────────────────────────────────────── */
:root {
    --navy: #0f2137;
    --navy-mid: #1a3550;
    --navy-light: #2b4d6f;
    --gold: #b8901a;
    --gold-light: #f5e6c0;
    --silver: #7b8fa1;
    --bronze: #8c5a20;
    --blue-lr: #2563a8;
    --blue-lr-light: #dbeafe;
    --row-even: #f7f9fb;
    --row-hover: #eaf3fb;
    --border: #d6dfe8;
    --summary-bg: #e4eaf1;
    --text-primary: #0f2137;
    --text-muted: #6b7a8d;
    --radius: 8px;
    --font-display: 'Playfair Display', serif;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

/* ─── RESET & BASE ────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-primary);
    background: #f0f4f8;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--navy-light);
    text-decoration: none;
}

    a:hover {
        text-decoration: underline;
        color: var(--gold);
    }

/* ─── LAYOUT ──────────────────────────────────────────────────── */
.page-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* ─── PAGE HEADER ─────────────────────────────────────────────── */
.stallion-header {
    background: var(--navy);
    color: white;
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

    .stallion-header h1 {
        font-family: var(--font-display);
        font-size: clamp(1.5rem, 5vw, 2.2rem);
        letter-spacing: 0.02em;
        margin-bottom: 0.25rem;
    }

    .stallion-header .subtitle {
        font-size: 0.85rem;
        color: rgba(255,255,255,0.65);
        font-weight: 300;
    }

/* ─── SECTION TITLES ─────────────────────────────────────────── */
.section-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .section-title .badge {
        font-family: var(--font-body);
        font-size: 0.7rem;
        font-weight: 600;
        background: var(--gold);
        color: white;
        padding: 0.15rem 0.5rem;
        border-radius: 20px;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

/* ─── CARD WRAPPER ────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
    margin-bottom: 2rem;
}

/* ─── GRADE PILLS ─────────────────────────────────────────────── */
.pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.pill-gr1 {
    background: var(--gold);
    color: white;
}

.pill-gr2 {
    background: #6b7a8d;
    color: white;
}

.pill-gr3 {
    background: var(--bronze);
    color: white;
}

.pill-lr {
    background: var(--blue-lr);
    color: white;
}

/* ══════════════════════════════════════════════════════════════
   SECTION 1: PROGENY LIST — MOBILE-FIRST CARD → TABLE
══════════════════════════════════════════════════════════════ */

/* ── MOBILE: stack layout ── */
.progeny-table {
    width: 100%;
    border-collapse: collapse;
}

    /* Hide thead on mobile; we use data-label instead */
    .progeny-table thead {
        display: none;
    }

    .progeny-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "horse  meta"
            "dam    dam"
            "pills  pills";
        gap: 0.1rem 0.5rem;
        padding: 0.875rem 1rem;
        border-bottom: 1px solid var(--border);
        transition: background 0.15s;
    }

        .progeny-table tbody tr:last-child {
            border-bottom: none;
        }

        .progeny-table tbody tr:nth-child(even) {
            background: var(--row-even);
        }

        .progeny-table tbody tr:hover {
            background: var(--row-hover);
        }

    .progeny-table td {
        display: block;
        border: none;
        padding: 0;
        font-size: 0.875rem;
    }

        /* Horse name cell */
        .progeny-table td.col-horse {
            grid-area: horse;
            font-weight: 600;
            font-size: 0.95rem;
        }

            .progeny-table td.col-horse a {
                color: var(--navy);
            }

                .progeny-table td.col-horse a:hover {
                    color: var(--gold);
                }

        /* Meta: wins + prize */
        .progeny-table td.col-meta {
            grid-area: meta;
            text-align: right;
        }

    .progeny-table .wins {
        font-weight: 600;
        font-variant-numeric: tabular-nums;
        color: var(--navy-mid);
        font-size: 0.85rem;
    }

    .progeny-table .prize {
        display: block;
        font-size: 0.78rem;
        color: var(--text-muted);
        font-variant-numeric: tabular-nums;
    }

    /* Dam info */
    .progeny-table td.col-dam {
        grid-area: dam;
        font-size: 0.78rem;
        color: var(--text-muted);
    }

        .progeny-table td.col-dam .year {
            font-weight: 500;
            color: var(--text-primary);
        }

    /* Pills row */
    .progeny-table td.col-pills {
        grid-area: pills;
        padding-top: 0.3rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

/* ── TABLET+: proper table ── */
@media (min-width: 680px) {
    .progeny-table thead {
        display: table-header-group;
    }

        .progeny-table thead th {
            background: var(--navy);
            color: white;
            font-family: var(--font-body);
            font-size: 0.72rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            padding: 0.7rem 0.875rem;
            text-align: left;
            position: sticky;
            top: 0;
            z-index: 2;
            white-space: nowrap;
        }

            .progeny-table thead th:not(:first-child) {
                text-align: right;
            }

    .progeny-table tbody tr {
        display: table-row;
        padding: 0;
    }

    .progeny-table td {
        display: table-cell;
        padding: 0.65rem 0.875rem;
        vertical-align: middle;
        border-bottom: 1px solid var(--border);
    }

        .progeny-table td.col-horse {
            width: 18%;
            min-width: 130px;
        }

        .progeny-table td.col-dam {
            width: 20%;
            font-size: 0.82rem;
        }

        .progeny-table td.col-meta {
            width: 14%;
            text-align: right;
        }

        .progeny-table td.col-pills {
            flex-wrap: wrap;
            gap: 0.25rem;
            padding-top: 0.65rem;
        }

    .progeny-table .prize {
        display: inline;
        margin-left: 0.25rem;
    }

    .progeny-table .wins {
        font-size: 0.88rem;
    }
}

/* ── DESKTOP: wider padding ── */
@media (min-width: 960px) {
    .progeny-table thead th,
    .progeny-table td {
        padding: 0.75rem 1rem;
    }

        .progeny-table td.col-horse {
            font-size: 0.95rem;
        }
}


/* ══════════════════════════════════════════════════════════════
   SECTION 2: NICKS — ACCORDION
══════════════════════════════════════════════════════════════ */

.nicks-group {
    margin-bottom: 4px;
    border-radius: var(--radius);
    overflow: hidden;
}

/* Accordion trigger */
.nicks-trigger {
    width: 100%;
    display: grid;
    /* mobile: 2 cols */
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.1rem 0.5rem;
    background: var(--navy);
    color: white;
    border: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    text-align: left;
    transition: background 0.15s;
}

    .nicks-trigger:hover {
        background: var(--navy-mid);
    }

    .nicks-trigger:focus-visible {
        outline: 2px solid var(--gold);
        outline-offset: -2px;
    }

    .nicks-trigger .damsire-name {
        font-family: var(--font-display);
        font-size: 0.95rem;
        font-weight: 600;
        grid-column: 1;
        grid-row: 1;
        align-self: center;
    }

    .nicks-trigger .trigger-icon {
        grid-column: 2;
        grid-row: 1 / 3;
        align-self: center;
        font-size: 0.75rem;
        opacity: 0.7;
        transition: transform 0.25s;
    }

    .nicks-trigger[aria-expanded="true"] .trigger-icon {
        transform: rotate(180deg);
    }

    .nicks-trigger .trigger-stats {
        grid-column: 1;
        grid-row: 2;
        font-size: 0.72rem;
        color: rgba(255,255,255,0.6);
        font-weight: 400;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

        .nicks-trigger .trigger-stats .stat-val {
            color: rgba(255,255,255,0.9);
            font-weight: 600;
        }

    .nicks-trigger .trigger-best {
        display: inline;
        font-size: 0.72rem;
    }

        .nicks-trigger .trigger-best .best-label {
            color: rgba(255,255,255,0.5);
        }

        .nicks-trigger .trigger-best .best-name {
            color: var(--gold-light);
            font-weight: 600;
        }

/* tablet+: single row */
@media (min-width: 680px) {
    .nicks-trigger {
        grid-template-columns: auto 1fr auto auto;
        grid-template-rows: 1fr;
        align-items: center;
        gap: 0 1.5rem;
        padding: 0.75rem 1.25rem;
    }

        .nicks-trigger .damsire-name {
            grid-column: 1;
            grid-row: 1;
            min-width: 180px;
            font-size: 1rem;
        }

        .nicks-trigger .trigger-stats {
            grid-column: 2;
            grid-row: 1;
        }

        .nicks-trigger .trigger-best {
            grid-column: 3;
            grid-row: 1;
            font-size: 0.78rem;
        }

        .nicks-trigger .trigger-icon {
            grid-column: 4;
            grid-row: 1;
        }
}

/* Panel */
.nicks-panel {
    display: none;
    background: white;
    overflow: hidden;
}

    .nicks-panel.open {
        display: block;
    }

/* Inner nicks table — MOBILE: compact 3-col */
.nicks-table {
    width: 100%;
    border-collapse: collapse;
}

    .nicks-table thead th {
        background: var(--summary-bg);
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        padding: 0.5rem 1rem;
        text-align: left;
        border-bottom: 1px solid var(--border);
    }

        .nicks-table thead th:last-child {
            text-align: right;
        }

    .nicks-table tbody tr {
        border-bottom: 1px solid var(--border);
    }

        .nicks-table tbody tr:last-child {
            border-bottom: none;
        }

        .nicks-table tbody tr:nth-child(even) {
            background: var(--row-even);
        }

        .nicks-table tbody tr:hover {
            background: var(--row-hover);
        }

    .nicks-table td {
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
        vertical-align: middle;
    }

        .nicks-table td:last-child {
            text-align: right;
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

    .nicks-table .horse-link {
        font-weight: 500;
        color: var(--navy);
    }

        .nicks-table .horse-link:hover {
            color: var(--gold);
        }

/* Wins badge */
.wins-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

    .wins-badge .win-count {
        font-weight: 600;
        font-size: 0.88rem;
    }

    .wins-badge .sw-count {
        font-size: 0.68rem;
        background: var(--gold-light);
        color: var(--gold);
        font-weight: 700;
        padding: 0.1rem 0.35rem;
        border-radius: 4px;
        border: 1px solid var(--gold);
    }

/* Mini bar */
.mini-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mini-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    flex: 1;
    max-width: 80px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.4s ease;
}

/* On mobile, hide dam column and bar to keep it tight */
@media (max-width: 479px) {
    .nicks-table .col-dam {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════════════
   SECTION 3: SALES RESULTS
══════════════════════════════════════════════════════════════ */

/* Year banner */
.year-banner {
    background: var(--navy);
    color: white;
    padding: 0.75rem 1rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid var(--gold);
}

    .year-banner .year-num {
        font-size: 1.3rem;
    }

    .year-banner .year-meta {
        font-size: 0.72rem;
        font-weight: 400;
        opacity: 0.65;
        text-align: right;
    }

/* Summary row — the Yearling/Weanling summary */
.sales-table {
    width: 100%;
    border-collapse: collapse;
}

    /* Column header — shown tablet+ */
    .sales-table .col-header {
        display: none;
    }

@media (min-width: 640px) {
    .sales-table .col-header {
        display: table-header-group;
    }

        .sales-table .col-header th {
            background: var(--summary-bg);
            color: var(--text-muted);
            font-size: 0.68rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            padding: 0.5rem 0.875rem;
            text-align: right;
            border-bottom: 1px solid var(--border);
        }

            .sales-table .col-header th:first-child {
                text-align: left;
                padding-left: 1rem;
            }
}

/* Summary row */
.sales-table .row-summary {
    background: var(--summary-bg);
    border-bottom: 2px solid var(--border);
}

    .sales-table .row-summary td {
        padding: 0.65rem 1rem;
        font-weight: 600;
        font-size: 0.88rem;
        font-variant-numeric: tabular-nums;
    }

/* On mobile: summary row is a mini-card with flex layout */
@media (max-width: 639px) {
    .sales-table .row-summary {
        display: block;
        padding: 0.75rem 1rem;
    }

        .sales-table .row-summary td {
            display: none;
        }

        .sales-table .row-summary .summary-mobile {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem 1.25rem;
            align-items: baseline;
        }

        .sales-table .row-summary .summary-label {
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--navy);
            width: 100%;
            margin-bottom: 0.25rem;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            font-family: var(--font-body);
        }

        .sales-table .row-summary .summary-stat {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

            .sales-table .row-summary .summary-stat .stat-n {
                font-family: var(--font-mono);
                font-size: 1rem;
                font-weight: 500;
                color: var(--navy);
                line-height: 1;
            }

            .sales-table .row-summary .summary-stat .stat-k {
                font-size: 0.7rem;
                color: var(--text-muted);
                margin-top: 0.15rem;
            }

        .sales-table .row-summary .summary-mobile-sep {
            width: 1px;
            height: 28px;
            background: var(--border);
            align-self: center;
        }
}

/* Detail rows (individual sales) */
.sales-table .row-detail {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

    .sales-table .row-detail:last-child {
        border-bottom: none;
    }

    .sales-table .row-detail:hover {
        background: var(--row-hover);
    }

.sales-table tbody tr:nth-child(even).row-detail {
    background: var(--row-even);
}

    .sales-table tbody tr:nth-child(even).row-detail:hover {
        background: var(--row-hover);
    }

/* MOBILE: detail row as mini-grid */
@media (max-width: 639px) {
    .sales-table .row-detail {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        column-gap: 0.75rem;
        padding: 0.65rem 1rem;
    }

        .sales-table .row-detail td {
            display: block;
            padding: 0;
            border: none;
        }

    .sales-table .col-sale {
        grid-column: 1;
        grid-row: 1;
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--navy);
        padding-left: 0.75rem;
        border-left: 2px solid var(--border);
    }

    .sales-table .col-sold {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
        font-size: 0.8rem;
        color: var(--text-muted);
        align-self: start;
    }

        .sales-table .col-sold::before {
            content: attr(data-label) " ";
            font-size: 0.7rem;
        }

    .sales-table .col-total, .sales-table .col-avg, .sales-table .col-top {
        grid-column: 1;
        grid-row: 2;
        font-size: 0.75rem;
        color: var(--text-muted);
        padding-left: 0.75rem;
    }
        /* Show a single combined stats line */
        .sales-table .col-total::before {
            content: "Total ";
        }

        .sales-table .col-avg::before {
            content: " · Avg ";
        }

        .sales-table .col-top::before {
            content: " · Top ";
        }

    .sales-table .col-avg, .sales-table .col-top {
        display: inline;
        grid-column: unset;
        grid-row: unset;
        padding-left: 0;
    }

    .sales-table .col-total {
        grid-column: 1;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
    }
}

/* TABLET+: proper table cells */
@media (min-width: 640px) {
    .sales-table .row-detail {
        display: table-row;
    }

        .sales-table .row-detail td {
            padding: 0.55rem 0.875rem;
            font-size: 0.85rem;
            vertical-align: middle;
        }

    .sales-table .col-sale {
        padding-left: 1.75rem; /* indent under summary */
        border-left: 3px solid var(--border);
    }

        .sales-table .col-sale a {
            color: var(--navy);
        }

            .sales-table .col-sale a:hover {
                color: var(--gold);
            }

    .sales-table td:not(.col-sale) {
        text-align: right;
        font-variant-numeric: tabular-nums;
        font-family: var(--font-mono);
        font-size: 0.82rem;
    }
    /* Summary row cells on tablet */
    .sales-table .row-summary td:not(:first-child) {
        text-align: right;
    }

    .sales-table .row-summary td:first-child {
        padding-left: 1rem;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        font-size: 0.75rem;
        color: var(--navy-mid);
    }

    .sales-table .summary-mobile {
        display: none;
    }

    .sales-table .col-mobile-stats {
        display: none;
    }
}

/* ─── SPACER ──────────────────────────────────────────────────── */
.section-gap {
    margin-bottom: 2rem;
}

/* ─── NAV TABS ────────────────────────────────────────────────── */
.page-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
    padding: 0.25rem;
    background: var(--navy);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

    .page-tabs::-webkit-scrollbar {
        display: none;
    }

    .page-tabs a {
        flex-shrink: 0;
        padding: 0.5rem 0.9rem;
        border-radius: 6px;
        font-size: 0.78rem;
        font-weight: 500;
        color: rgba(255,255,255,0.6);
        white-space: nowrap;
        transition: all 0.15s;
    }

        .page-tabs a:hover {
            color: white;
            text-decoration: none;
        }

        .page-tabs a.active {
            background: var(--gold);
            color: white;
        }

/* ─── TOP SELLERS BTN ─────────────────────────────────────────── */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1.5px solid var(--navy-light);
    color: var(--navy-light);
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s;
    margin: 0.75rem 1rem;
}

    .btn-ghost:hover {
        background: var(--navy);
        border-color: var(--navy);
        color: white;
        text-decoration: none;
    }

/* ─── MOBILE HINT LABEL ───────────────────────────────────────── */
.scroll-hint {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.4rem;
    background: var(--row-even);
    border-top: 1px solid var(--border);
}

@media (min-width: 640px) {
    .scroll-hint {
        display: none;
    }
}
