/*
 * Trad RC — the traditional dense racecard skin.
 *
 * Deliberately NOT built on .rm-table. The traditional card's signature is
 * two-line cells (number over form, weight over OR, jockey over trainer) and
 * a comment line under each runner, which means two <tr> per runner. That
 * breaks .rm-table's one-row-per-runner assumptions (sticky columns, the
 * delegated form-line click handler), so this owns its own markup and CSS.
 *
 * Scoped under #traditional-content so nothing here can leak into the other
 * twelve views sharing the popup.
 *
 * Density note: ~11px body / 9.5px uppercase headers / 4px row padding is the
 * whole point of the view. Do not "fix" it to match the rest of the site.
 */

#traditional-content {
    --tc-ink:    #14181d;
    --tc-ink-2:  #4a5158;
    --tc-ink-3:  #7d858c;
    --tc-rule:   #dcd8d0;
    --tc-rule-2: #efece6;
    --tc-navy:   #0a2540;
    --tc-red:    #a8202b;
    --tc-gold:   #fbf1d2;
    --tc-chip:   #f1eee7;
    padding: 12px 14px 16px;
    color: var(--tc-ink);
}

/* ------------------------------------------------------------------ *
 * Race-conditions header
 * ------------------------------------------------------------------ */
.tc-hd {
    display: flex; justify-content: space-between; gap: 24px;
    align-items: flex-start; flex-wrap: wrap;
    border-bottom: 2px solid var(--tc-red); padding-bottom: 8px;
}
.tc-when { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.tc-time { font-weight: 800; font-size: 29px; line-height: 1; }
.tc-course { font-weight: 800; font-size: 24px; line-height: 1; color: var(--tc-navy); }
.tc-date { font-size: 12px; color: var(--tc-ink-3); }
.tc-dist { font-size: 14px; font-weight: 700; color: var(--tc-ink-2); margin-top: 5px; }
.tc-dist span { color: var(--tc-ink-3); font-weight: 600; }
.tc-title { font-size: 13px; margin-top: 1px; }
.tc-title span { color: var(--tc-ink-3); }
.tc-box {
    border-left: 1px solid var(--tc-rule); padding-left: 16px;
    min-width: 190px; display: flex; flex-direction: column; gap: 2px;
}
.tc-box div { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; line-height: 1.5; }
.tc-box span:first-child {
    color: var(--tc-ink-3); text-transform: uppercase;
    letter-spacing: .05em; font-weight: 700; font-size: 10.5px;
}
.tc-box span:last-child { font-size: 11.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tc-cond {
    font-size: 11.5px; line-height: 1.6; color: var(--tc-ink-2);
    padding: 7px 0 8px; border-bottom: 1px solid var(--tc-rule);
}
.tc-cond b {
    text-transform: uppercase; letter-spacing: .07em; font-size: 10px;
    color: var(--tc-ink-3); font-weight: 800; margin-right: 5px;
}

/* ------------------------------------------------------------------ *
 * The card
 * ------------------------------------------------------------------ */
.tc-scroll { overflow-x: auto; }
table.tc-t {
    /* max-width: the card is intrinsically dense, so letting it stretch across
       a wide desktop pulls the horse name miles from its silks. */
    width: 100%; min-width: 720px; max-width: 1080px; border-collapse: collapse;
    font-size: 12px; font-variant-numeric: tabular-nums;
}
table.tc-t th {
    font-size: 9.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--tc-ink-3); text-align: center; padding: 8px 4px 5px;
    border-bottom: 1.5px solid var(--tc-ink); white-space: nowrap; vertical-align: bottom;
}
table.tc-t th.l { text-align: left; }
table.tc-t td { padding: 5px 4px; text-align: center; vertical-align: top; }
/* Left-aligned cells. Qualified with `table.tc-t` because the bare class
   selectors lose the cascade to `table.tc-t td` above (0,1,2 beats 0,1,0)
   and every name column silently renders centred. */
table.tc-t td.l,
table.tc-t td.tc-ppl,
table.tc-t td.tc-viewtxt { text-align: left; }
table.tc-t tr.tc-run td { padding-top: 7px; border-bottom: none; }
table.tc-t tr.tc-view td { padding: 0 4px 7px; border-bottom: 1px solid var(--tc-rule); }
/* When a runner has no comment line the runner row carries the rule itself. */
table.tc-t tr.tc-run.tc-last td { border-bottom: 1px solid var(--tc-rule); padding-bottom: 7px; }
table.tc-t tr.tc-run:hover td,
table.tc-t tr.tc-run:hover + tr.tc-view td { background: #fbfaf7; }
table.tc-t tr.tc-nr td { opacity: .45; }

.tc-no { font-weight: 800; font-size: 15px; line-height: 1; }
.tc-no sup { font-size: 9.5px; font-weight: 600; color: var(--tc-ink-3); }
.tc-form {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10.5px; font-weight: 500; color: var(--tc-ink-2);
    letter-spacing: 0; margin-top: 2px; display: block; white-space: nowrap;
}
.tc-silk { width: 34px; min-width: 34px; padding: 4px 2px !important; }
.tc-silk img { width: 26px; height: 20px; object-fit: contain; display: block; margin: 0 auto; }
.tc-horse { font-weight: 800; font-size: 14px; color: var(--tc-navy); line-height: 1.15; text-decoration: none; }
.tc-horse:hover { text-decoration: underline; text-underline-offset: 2px; }
.tc-meta { display: flex; gap: 5px; align-items: center; margin-top: 3px; flex-wrap: wrap; }
.tc-dslr { font-size: 10px; color: var(--tc-ink-3); }
.tc-two { line-height: 1.3; }
.tc-two b { font-size: 12px; font-weight: 700; display: block; }
.tc-two i { font-size: 11px; font-style: normal; color: var(--tc-ink-3); display: block; }
.tc-ppl { text-align: left; line-height: 1.3; }
.tc-ppl a { font-size: 12px; color: var(--tc-navy); text-decoration: none; display: block; font-weight: 600; }
.tc-ppl a:hover { text-decoration: underline; text-underline-offset: 2px; }
.tc-ppl a.tc-tr { font-size: 11px; color: var(--tc-ink-2); font-weight: 400; }
.tc-claim { font-size: 10px; color: var(--tc-red); font-weight: 700; }
.tc-num { font-size: 12.5px; font-weight: 700; }
.tc-hi { background: var(--tc-gold); }
.tc-odds { font-weight: 800; font-size: 13.5px; }
.tc-rmp { font-size: 11px; color: var(--tc-ink-2); display: block; margin-top: 1px; }
.tc-viewtxt { font-size: 11.5px; color: var(--tc-ink-2); line-height: 1.45; text-align: left; }
.tc-viewtxt b {
    font-size: 9.5px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--tc-red); margin-right: 6px;
}

/* Admin-only launch banner. Removed when the view opens up to real tiers. */
.tc-admin {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--tc-red); color: #fff; font-size: 10.5px; font-weight: 700;
    letter-spacing: .07em; text-transform: uppercase;
    padding: 3px 9px; border-radius: 2px; margin-bottom: 10px;
}

/* Rows expand form lines on click, same as the other card views. */
#traditional-content table.tc-t tbody tr.tc-run { cursor: pointer; }
#traditional-content .fl-container { padding: 6px 0 10px; }

@media (max-width: 860px) {
    #traditional-content { padding: 10px 8px 14px; }
    .tc-box { border-left: none; padding-left: 0; margin-top: 8px; }
    .tc-time { font-size: 24px; }
    .tc-course { font-size: 20px; }
}

/* ------------------------------------------------------------------ *
 * Trad RC form pop-out (phase 2)
 * Own shell rather than profile-popup's .bdd-* classes, which live in a
 * different page's <style> block and are not loaded here.
 * ------------------------------------------------------------------ */
.tp-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(20, 24, 29, 0.55);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 32px 16px; overflow-y: auto;
}
.tp-modal {
    background: #fff; width: 100%; max-width: 1080px; border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden;
    font-family: inherit; color: #14181d;
}
.tp-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
    padding: 14px 18px; background: #0a2540; color: #fbfaf7;
}
.tp-kind {
    font-size: 10px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; opacity: .7;
}
.tp-title { margin: 2px 0 0; font-size: 22px; font-weight: 800; line-height: 1.1; }
.tp-sub { font-size: 11.5px; opacity: .8; margin-top: 3px; }
.tp-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.tp-full {
    color: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; text-decoration: none;
    border-bottom: 1px solid currentColor; padding-bottom: 1px; white-space: nowrap;
}
.tp-close {
    background: none; border: 0; color: inherit; font-size: 26px; line-height: 1;
    cursor: pointer; padding: 0 2px; opacity: .8;
}
.tp-close:hover { opacity: 1; }
.tp-body { padding: 14px 18px 18px; }

.tp-sec {
    font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: #7d858c; margin: 14px 0 6px;
}
.tp-body > .tp-sec:first-child { margin-top: 2px; }

/* connections strip — owner / sire / dam / damsire */
.tp-conn { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 2px 0 4px; }
.tp-conn span { font-size: 12px; }
.tp-conn i {
    font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .09em;
    text-transform: uppercase; color: #7d858c; margin-right: 6px;
}
.tp-conn a { color: #0a2540; font-weight: 600; text-decoration: none; }
.tp-conn a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* lifetime record */
table.tp-lt { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.tp-lt th {
    font-size: 9.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: #7d858c; text-align: right; padding: 4px 8px; border-bottom: 1px solid #dcd8d0;
}
table.tp-lt th:first-child { text-align: left; }
table.tp-lt td { padding: 5px 8px; text-align: right; border-bottom: 1px solid #efece6; }
table.tp-lt td:first-child { text-align: left; font-weight: 700; }
table.tp-lt tr.tp-tot td { border-top: 1.5px solid #14181d; border-bottom: none; font-weight: 700; }

/* strike-rate grid for the six non-horse types */
.tp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.tp-stat { background: #f1eee7; border-radius: 3px; padding: 7px 10px; }
.tp-stat span {
    display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #7d858c;
}
.tp-stat b { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* layoff separator inside the shared form-lines table */
tr.fl-change-row td {
    background: #eef6ee; text-align: center; font-size: 10px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; color: #3f7a4a;
    padding: 3px 4px !important;
}
tr.fl-break-row td {
    background: #f1eee7; text-align: center; font-size: 10px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase; color: #7d858c;
    padding: 3px 4px !important;
}

@media (max-width: 860px) {
    .tp-overlay { padding: 0; }
    .tp-modal { max-width: none; border-radius: 0; min-height: 100%; }
    .tp-title { font-size: 18px; }
    .tp-body { padding: 12px 10px 16px; }
}
