/* ============================================================================
   Track record: idea cards, headline tiles, the running-total chart and the
   log tables. Loaded only by the pages that show the record (the /track-record
   hub, the pair pages, /xauusd-signals and the homepage's Ideas section), via
   RECORD_HEAD in src/record-ui.mjs.

   Status colour is never the only signal: every win or loss carries a mark
   (✓ / ✕) and a word next to it.
   ========================================================================== */

.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- headline tiles ------------------------------------------------------ */

.rc-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rc-tile {
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--hairline); border-radius: var(--r-card-sm);
  padding: 18px 18px 16px; min-width: 0;
}
.rc-tl { font-family: var(--font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
/* Proportional figures at display size; tabular only where numbers stack. */
.rc-tv { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -0.03em; line-height: 1.1; margin-top: 8px; color: var(--text-primary); overflow-wrap: anywhere; }
.rc-tv small { font-size: .52em; font-weight: 600; letter-spacing: 0; color: var(--text-secondary); }
.rc-ts { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }

/* Win rate against break-even: the fill is the rate, the white tick is the
   rate this record would need just to finish flat. */
.rc-meter { position: relative; height: 6px; margin-top: 12px; border-radius: 99px; background: rgba(61,255,168,0.14); }
.rc-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--up); }
.rc-meter-be { position: absolute; top: 50%; width: 3px; height: 14px; border-radius: 2px; background: var(--text-primary); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); }

/* ---- secondary figures ---------------------------------------------------- */

.rc-asof { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.rc-asof time { color: var(--text-secondary); }
.rc-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 18px; overflow: hidden; }
.rc-facts > div { background: var(--surface); padding: 14px 16px; }
.rc-facts dt { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-display); font-weight: 600; }
.rc-facts dd { margin-top: 5px; font-size: 15px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.rc-facts dd span { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--text-secondary); }
.rc-note { margin-top: 16px; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); max-width: 74ch; }
.rc-note a { color: var(--signal); }

/* ---- running total -------------------------------------------------------- */

.rc-chart { margin-top: 26px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card-sm); padding: 20px 22px 16px; }
.rc-chart figcaption { display: flex; flex-direction: column; gap: 3px; margin-bottom: 18px; }
.rc-ct { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text-primary); }
.rc-cs { font-size: 12.5px; color: var(--text-muted); }
.rc-plot { position: relative; height: clamp(200px, 30vw, 300px); margin: 0 58px 0 58px; outline: none; touch-action: pan-y; }
.rc-plot:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--signal); border-radius: 6px; }
.rc-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.rc-grid { stroke: rgba(255,255,255,0.07); stroke-width: 1; }
.rc-zero { stroke: rgba(255,255,255,0.24); stroke-width: 1; }
.rc-line { fill: none; stroke: var(--up); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rc-area { fill: var(--up); opacity: .1; }
.rc-ytick { position: absolute; left: -10px; transform: translate(-100%, -50%); font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-end { position: absolute; left: 100%; width: 10px; height: 10px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); }
.rc-endlabel { position: absolute; left: calc(100% + 10px); transform: translateY(-50%); font-size: 13px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,0.32); pointer-events: none; }
.rc-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, -50%); pointer-events: none; }
.rc-tip {
  position: absolute; top: 0; z-index: 2; pointer-events: none; min-width: 176px;
  background: var(--surface-overlay); border: 1px solid var(--hairline-strong); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--card-shadow); font-size: 12.5px; color: var(--text-secondary);
}
.rc-tip b { display: block; font-size: 15px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.rc-tip .k { display: inline-block; width: 12px; height: 2px; border-radius: 1px; background: var(--up); vertical-align: middle; margin-right: 6px; }
.rc-xaxis { display: flex; justify-content: space-between; margin: 10px 58px 0; font-size: 11.5px; color: var(--text-muted); }

/* ---- cards ---------------------------------------------------------------- */

.rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; margin-top: 8px; }
.rc-card {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--hairline); border-radius: var(--r-card-sm); padding: 20px; min-width: 0;
}
.rc-card::before { content: ""; position: absolute; left: 20px; right: 20px; top: -1px; height: 2px; border-radius: 0 0 2px 2px; background: var(--hairline-strong); }
.rc-card.is-win::before { background: var(--win); }
.rc-card.is-loss::before { background: var(--loss); }
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rc-pair { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; line-height: 1.25; }
.rc-pair a { color: inherit; }
.rc-pair a:hover { color: var(--signal); }
.rc-meta { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.rc-dir { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--r-chip); font-size: 12.5px; font-weight: 600; }
.rc-dir.is-buy { background: var(--signal-muted); color: var(--up); }
.rc-dir.is-sell { background: rgba(255,92,122,0.16); color: #FF9DB0; }

/* Risk on the left, reward on the right, from the signal's own prices. */
.rc-bar { position: relative; height: 6px; margin: 18px 5px 14px; border-radius: 99px; background: rgba(255,255,255,0.07); }
.rc-bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.rc-bar-fill.is-win { background: var(--up); opacity: .85; }
.rc-bar-fill.is-loss { background: var(--down); opacity: .85; }
.rc-tick { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--surface-raised); background: rgba(255,255,255,0.28); }
.rc-tick.is-entry { background: var(--text-primary); }
.rc-tick.is-tp { background: rgba(61,255,168,0.32); }
.rc-tick.is-tp.is-hit { background: var(--up); }
.rc-tick.is-sl { background: rgba(255,92,122,0.35); }
.rc-tick.is-sl.is-hit { background: var(--down); }

.rc-levels { display: flex; flex-direction: column; }
.rc-lv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hairline); }
.rc-lv:last-child { border-bottom: 0; }
.rc-lv dt { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.rc-lv dd { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--text-secondary); }
.rc-lv.is-entry dd, .rc-lv.is-hit dd { color: var(--text-primary); }
.rc-mark { display: inline-flex; width: 18px; justify-content: center; font-weight: 700; }
.rc-mark.is-hit { color: var(--up); }
.rc-mark.is-stop { color: var(--down); }

.rc-outcome { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--text-primary); background: rgba(255,255,255,0.04); border: 1px solid var(--hairline); }
.rc-outcome b { margin-left: auto; white-space: nowrap; }
.rc-oi { font-weight: 700; color: var(--text-muted); }
.is-win .rc-outcome { background: rgba(0,179,126,0.10); border-color: var(--signal-muted); }
.is-win .rc-oi, .is-win .rc-outcome b { color: var(--up); }
.is-loss .rc-outcome { background: rgba(229,72,104,0.10); border-color: rgba(229,72,104,0.30); }
.is-loss .rc-oi, .is-loss .rc-outcome b { color: #FF9DB0; }
.rc-time { margin-top: 10px; font-size: 12.5px; color: var(--text-muted); }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rc-tag { font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-chip); border: 1px solid var(--hairline-strong); color: var(--text-secondary); }
.rc-tag.is-rev { color: var(--signal); border-color: var(--signal-muted); }
.rc-why { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.rc-why summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-secondary); list-style: none; }
.rc-why summary::-webkit-details-marker { display: none; }
.rc-why summary::before { content: "+"; display: inline-block; width: 14px; color: var(--signal); }
.rc-why[open] summary::before { content: "−"; }
.rc-why p { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.rc-inv b { color: var(--text-primary); }

/* ---- tables --------------------------------------------------------------- */

.rc-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; margin-top: 8px; }
.rc-table, .prose .rc-table { display: table; width: 100%; border-collapse: collapse; font-size: 14px; }
.rc-table caption { caption-side: top; text-align: left; padding: 14px 16px 6px; font-size: 13px; color: var(--text-muted); }
.rc-table th, .rc-table td, .prose .rc-table th, .prose .rc-table td { padding: 10px 14px; border-bottom: 1px solid var(--hairline); text-align: left; white-space: nowrap; vertical-align: middle; }
.rc-table thead th { font-family: var(--font-display); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.rc-table tbody th { font-weight: 600; color: var(--text-primary); }
.rc-table tbody td { color: var(--text-secondary); }
.rc-table tbody tr:last-child > * { border-bottom: 0; }
.rc-table tbody tr:hover > * { background: rgba(255,255,255,0.02); }
.rc-table a { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--hairline-strong); text-underline-offset: 3px; }
.rc-table a:hover { color: var(--signal); text-decoration-color: currentColor; }
.rc-table .rc-num { text-align: right; }
.rc-o.is-win { color: var(--up); }
.rc-o.is-loss { color: #FF9DB0; }

/* The log shows the latest rows; the toggle unfolds the rest. Without :has()
   support every row simply stays visible, which is the safe failure. */
.rc-log:has(> .rc-more-toggle:not([open])) .rc-more { display: none; }
.rc-more-toggle { margin-top: 14px; }
.rc-more-toggle summary { display: inline-flex; cursor: pointer; list-style: none; padding: 10px 16px; border-radius: var(--r-button); border: 1px solid var(--hairline-strong); background: rgba(255,255,255,0.04); font-size: 14px; font-weight: 600; color: var(--text-primary); }
.rc-more-toggle summary::-webkit-details-marker { display: none; }
.rc-more-toggle summary:hover { background: rgba(255,255,255,0.08); }
.rc-when-open { display: none; }
.rc-more-toggle[open] .rc-when-open { display: inline; }
.rc-more-toggle[open] .rc-when-closed { display: none; }

/* ---- homepage Ideas strip ------------------------------------------------- */

.rc-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0 24px; }
.rc-strip > div { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card-sm); padding: 18px 20px; }
.rc-strip b { display: block; font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.03em; color: var(--text-primary); }
.rc-strip span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--text-secondary); }
.rc-cta { display: flex; justify-content: center; margin-top: 28px; }
#ideas .rc-asof { text-align: center; margin: 18px auto 0; max-width: 70ch; }

@media (max-width: 720px) {
  .rc-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rc-plot { margin: 0 44px 0 46px; }
  .rc-xaxis { margin: 10px 44px 0 46px; }
  .rc-chart { padding: 16px 14px 14px; }
  .rc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  .rc-tiles { grid-template-columns: 1fr; }
}

