/* HEAD-TO-HEAD
   Extracted from components.css — loaded only by the pages that use it. */

/* ================================================================
   HEAD-TO-HEAD
   ================================================================ */
.btn-h2h {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    margin-left: 4px;
    vertical-align: middle;
    border-radius: var(--radius-sm);
    background: var(--gold-light);
    border: 1px solid var(--gold-glow);
    color: var(--gold);
    cursor: pointer;
    transition: var(--transition);
}
.btn-h2h:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
    transform: translateY(-1px);
}
.btn-h2h svg { width: 13px; height: 13px; }

.h2h-panel {
    width: 100%;
    max-width: 560px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    animation: fadeIn 0.2s ease;
}
.h2h-panel__header {
    padding: var(--space-6) var(--space-6) var(--space-4);
    border-bottom: 1px solid var(--border);
}
.h2h-panel__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
}
.h2h-panel__eyebrow svg { width: 13px; height: 13px; }
.h2h-panel__title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.15;
    margin-top: 2px;
}
.h2h-panel__sub {
    font-size: 12.5px;
    color: var(--ink-muted);
    margin-top: 4px;
}
.h2h-panel__sub strong { color: var(--ink-secondary); }
.h2h-panel__body {
    padding: var(--space-4) var(--space-6) var(--space-6);
    overflow-y: auto;
}

.h2h-loading,
.h2h-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) 0;
    color: var(--ink-muted);
    font-size: 13px;
}

.h2h-legend {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--space-2);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    margin-bottom: var(--space-3);
}
.h2h-legend__behind { justify-self: start; }
.h2h-legend__ahead { justify-self: end; }
.h2h-legend__zero {
    padding: 1px 8px;
    border-left: 1px dashed var(--border-hover);
    border-right: 1px dashed var(--border-hover);
    color: var(--ink-faint);
}
.h2h-legend i {
    display: inline-block;
    width: 14px;
    height: 8px;
    border-radius: 2px;
    vertical-align: middle;
}
.h2h-legend__behind i { background: var(--crimson); margin-right: 5px; }
.h2h-legend__ahead i { background: var(--hunter); margin-left: 5px; }

.h2h-rows { display: flex; flex-direction: column; }
.h2h-item { border-bottom: 1px solid var(--border); }
.h2h-item:last-child { border-bottom: none; }

.h2h-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.3fr) minmax(90px, 2fr) auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 2px;
    cursor: pointer;
    transition: background var(--transition);
}
.h2h-row:hover { background: var(--bg-subtle); }

.h2h-row__opp {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}
.h2h-row__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.h2h-row__no {
    display: inline-block;
    color: var(--ink-faint);
    font-weight: 700;
    margin-right: 5px;
}

.h2h-bar {
    position: relative;
    height: 18px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.h2h-bar__axis {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-hover);
    z-index: 2;
}
.h2h-bar__fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 3px;
}
.h2h-bar__fill--ahead {
    background: linear-gradient(90deg, var(--hunter-muted), var(--hunter));
}
.h2h-bar__fill--behind {
    background: linear-gradient(90deg, var(--crimson), #c0504a);
}

.h2h-row__stat {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    min-width: 96px;
}
.h2h-margin {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.h2h-margin.is-ahead { color: var(--accent); }
.h2h-margin.is-behind { color: var(--crimson); }
.h2h-margin.is-neutral { color: var(--ink-faint); }
.h2h-record {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-variant-numeric: tabular-nums;
}
.h2h-row__chev {
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
    transition: transform var(--transition);
}
.h2h-row.is-open .h2h-row__chev { transform: rotate(180deg); }

.h2h-encounters {
    padding: 2px 2px var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.h2h-encounters[hidden] { display: none; }
.h2h-enc {
    font-size: 11.5px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-base);
    border-left: 2px solid var(--border-hover);
}
.h2h-enc.is-ahead { border-left-color: var(--hunter); }
.h2h-enc.is-behind { border-left-color: var(--crimson); }
.h2h-enc__main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-3);
}
.h2h-enc__date { color: var(--ink-secondary); font-weight: 600; white-space: nowrap; }
.h2h-enc__where {
    flex-basis: 100%;
    color: var(--ink-muted);
    line-height: 1.3;
}
.h2h-enc__res { color: var(--ink-secondary); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h2h-enc__marg { font-weight: 700; }
.h2h-enc.is-ahead .h2h-enc__marg { color: var(--accent); }
.h2h-enc.is-behind .h2h-enc__marg { color: var(--crimson); }
.h2h-enc__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}
.h2h-tag {
    font-size: 10.5px;
    color: var(--ink-secondary);
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-variant-numeric: tabular-nums;
}
.h2h-tag__k {
    color: var(--ink-faint);
    font-weight: 700;
    margin-right: 4px;
}
.h2h-tag em {
    font-style: normal;
    font-weight: 700;
}
.h2h-tag em.is-ahead { color: var(--accent); }
.h2h-tag em.is-behind { color: var(--crimson); }

/* Detail-level toggle */
.h2h-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
}
.h2h-help-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-muted);
    transition: var(--transition);
}
.h2h-help-link:hover { color: var(--accent); }
.h2h-help-link svg { width: 14px; height: 14px; }
.h2h-controls__right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.h2h-trip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    transition: var(--transition);
}
.h2h-trip:hover { color: var(--ink-secondary); border-color: var(--border-hover); }
.h2h-trip svg { width: 13px; height: 13px; }
.h2h-trip__band { color: var(--ink-faint); font-weight: 600; }
.h2h-trip.is-active {
    background: var(--hunter);
    border-color: var(--hunter);
    color: #fff;
}
.h2h-trip.is-active .h2h-trip__band { color: rgba(255, 255, 255, 0.7); }
.h2h-toggle {
    display: inline-flex;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}
.h2h-toggle__btn {
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    padding: 3px 10px;
    border-radius: 4px;
    transition: var(--transition);
}
.h2h-toggle__btn:hover { color: var(--ink-secondary); }
.h2h-toggle__btn.is-active {
    background: var(--bg-elevated);
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

/* "How to read this" walkthrough overlay */
.h2h-help {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.15s ease;
}
.h2h-help[hidden] { display: none; }
.h2h-help__head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.h2h-help__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.h2h-help__back:hover { background: var(--hunter-light); color: var(--accent); border-color: var(--hunter); }
.h2h-help__back svg { width: 14px; height: 14px; }
.h2h-help__title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.h2h-help__body { padding: var(--space-5) var(--space-6) var(--space-6); overflow-y: auto; }
.h2h-help__intro { font-size: 13px; color: var(--ink-secondary); line-height: 1.5; margin: 0 0 var(--space-4); }
.h2h-help__intro strong { color: var(--accent); }
.h2h-help__worked {
    background: var(--gold-light);
    border: 1px solid var(--gold-glow);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
}
.h2h-help__cap {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 4px;
}
.h2h-help__worked p { font-size: 13px; color: var(--ink); line-height: 1.55; margin: 0 0 var(--space-3); }
.h2h-help__worked p strong { color: var(--accent); }
.h2h-help__defs { margin: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.h2h-help__defs dt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 3px;
}
.h2h-help__defs dd { margin: 0; font-size: 12px; color: var(--ink-secondary); line-height: 1.5; }
.h2h-help em.is-ahead { font-style: normal; font-weight: 700; color: var(--accent); }
.h2h-help em.is-behind { font-style: normal; font-weight: 700; color: var(--crimson); }
.h2h-sw { display: inline-block; width: 22px; height: 10px; border-radius: 3px; }
.h2h-sw--ahead { background: var(--hunter); }
.h2h-sw--behind { background: var(--crimson); }
.h2h-help__note {
    margin: var(--space-5) 0 0;
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border);
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.5;
}
.h2h-help__note strong { color: var(--ink-secondary); }

.h2h-nohist {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.h2h-nohist__label {
    width: 100%;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-faint);
    margin-bottom: 2px;
}
.h2h-chip {
    font-size: 11.5px;
    color: var(--ink-muted);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
}

@media (max-width: 600px) {
    .h2h-panel { max-width: 100%; max-height: 92vh; }
    .h2h-row { grid-template-columns: minmax(96px, 1fr) minmax(70px, 1.4fr) auto; gap: var(--space-2); }
    .h2h-row__stat { min-width: 78px; }
}


/* Tabular monospace for dense numerics (moved from components.css polish block) */
.h2h-margin, .h2h-record {
    font-family: var(--font-mono);
}
