/* ============================================================
   ronde-trading.css: what project2-ronde.html has of its own
   ------------------------------------------------------------
   Loaded after ronde-project.css (shared with project 1), which
   still styles the hero, cover, stats, overview, steps and
   screenshots. This file adds the page's own pieces:

   - the ensemble panel: a soft magenta wash with the five networks
     as rows beside a ring of five halftone circles (#tr-ring);
   - the results panel: an ink panel that stays dark in both modes,
     holding two glass cards, the stake-to-profit drawing (#tr-flow)
     and the accuracy line.

   js/rondeTrading.js draws both canvases and runs the line. The one
   accent is the project's magenta (the "quant / finance" ink in
   docs/halftoneInkElement.md). Rules: docs/rondeDesignRules.md.
   ============================================================ */

:root {
    --rh-magenta: #D9479C;
    --pr-accent: var(--rh-magenta);
}

@media (prefers-color-scheme: dark) {
    :root { --rh-magenta: #e46cb2; }
}

/* The title's full stop, as on the home, resume and contact headings. */
.tr-stop { color: var(--pr-accent); }

/* ── Ensemble: rows left, ring of five right, on a blurred wash ── */
.tr-ens {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
    align-items: center;
    gap: clamp(24px, 4vw, 56px);
    padding: clamp(28px, 4.4vw, 56px);
    overflow: hidden;
    isolation: isolate;
    border-radius: 32px;
    background: var(--rh-card);
    box-shadow: var(--rh-panel-shadow);
}

/* Two blurred lights behind the content: the accent low on the right,
   under the ring, and a warmer one top left. */
.tr-ens::before,
.tr-ens::after {
    content: '';
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}

.tr-ens::before {
    right: -8%;
    bottom: -45%;
    width: 62%;
    height: 110%;
    background: var(--pr-accent);
    opacity: .24;
}

.tr-ens::after {
    top: -50%;
    left: -12%;
    width: 50%;
    height: 90%;
    background: #FFB39E;
    opacity: .3;
}

.tr-ens .pr-h2 {
    max-width: 12ch;
    margin-top: 10px;
}

.tr-nets {
    margin-top: clamp(24px, 3vw, 40px);
    list-style: none;
}

.tr-nets li {
    display: grid;
    grid-template-columns: 40px minmax(0, auto) minmax(0, 1fr);
    align-items: baseline;
    column-gap: 12px;
    padding: 15px 0;
    border-top: 1px solid var(--rh-line);
}

.tr-nets li:last-child { border-bottom: 1px solid var(--rh-line); }

.tr-nets__n {
    color: var(--rh-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    transition: color .2s ease-out;
}

.tr-nets h3 {
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -.01em;
}

.tr-nets p {
    color: var(--rh-muted);
    font-size: 15px;
    line-height: 1.4;
    text-align: right;
    transition: color .2s ease-out;
}

/* The row whose circle is lifted out of the ring. */
.tr-nets li.is-on .tr-nets__n { color: var(--pr-accent); }
.tr-nets li.is-on p { color: var(--rh-text-2); }

.tr-ens__art {
    width: 100%;
    max-width: 380px;
    aspect-ratio: 1;
    justify-self: center;
}

#tr-ring {
    display: block;
    width: 100%;
    height: 100%;
    color: var(--rh-ink);
}

/* ── Results: an ink panel, dark in both modes ── */
.tr-results {
    --tr-bg: #111214;
    --tr-fg: #f7f7f7;
    --tr-fg-2: rgba(255, 255, 255, .7);
    --tr-muted: rgba(255, 255, 255, .45);
    --tr-line: rgba(255, 255, 255, .2);
    --tr-glass: rgba(255, 255, 255, .06);
    --tr-accent: #e46cb2;
    position: relative;
    padding: clamp(20px, 3vw, 32px);
    overflow: hidden;
    isolation: isolate;
    border-radius: 32px;
    background: var(--tr-bg);
    color: var(--tr-fg);
}

/* One blurred light in the accent, behind the glass cards. */
.tr-results::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: -30%;
    right: -6%;
    width: 52%;
    height: 90%;
    border-radius: 50%;
    background: var(--tr-accent);
    opacity: .3;
    filter: blur(90px);
    pointer-events: none;
}

.tr-results__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 4px 0;
    margin-bottom: clamp(20px, 3vw, 32px);
}

.tr-results .rh-pill { border-color: var(--tr-line); }
.tr-results :focus-visible { outline-color: var(--tr-fg); }

.tr-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
    gap: 16px;
}

.tr-card {
    position: relative;
    display: flex;
    min-height: 400px;
    flex-direction: column;
    padding: 24px;
    border-radius: 24px;
    background: var(--tr-glass);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.tr-card__label {
    color: var(--tr-muted);
    font-size: 14px;
}

/* The big number under each drawing, with its unit small and grey. */
.tr-readout {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.tr-readout__value {
    display: block;
    font-size: clamp(44px, 4.8vw, 60px);
    font-weight: 300;
    letter-spacing: -.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tr-readout__value small {
    margin-left: 3px;
    color: var(--tr-muted);
    font-size: .42em;
    font-weight: 400;
    letter-spacing: 0;
}

.tr-readout__label {
    display: block;
    margin-top: 8px;
    color: var(--tr-muted);
    font-size: 14px;
}

.tr-chip {
    display: inline-flex;
    height: 34px;
    flex: 0 0 auto;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--tr-line);
    border-radius: 999px;
    color: var(--tr-fg);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    transition: opacity .3s ease-out, transform .3s ease-out;
}

.tr-chip small {
    margin-right: 2px;
    color: var(--tr-muted);
    font-size: 1em;
}

/* ── Stake to profit: the canvas fills the card's middle ── */
.tr-flow__stage {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    margin: 12px 0 20px;
}

#tr-flow {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    color: var(--tr-fg);
}

/* While the drawing has yet to play, the multiplier waits. */
.tr-flow.is-waiting .tr-chip {
    opacity: 0;
    transform: translateY(6px);
}

/* ── Accuracy: one accent line over a dotted coin-flip line ── */
.tr-acc__stage {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    margin: 28px 6px 24px 0;
}

.tr-acc__svg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.tr-acc__chance {
    stroke: var(--tr-muted);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 1 6;
}

.tr-acc__line {
    fill: none;
    stroke: var(--tr-accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.tr-acc__area {
    opacity: 0;
    transition: opacity .5s ease-out;
}

.tr-acc.is-complete .tr-acc__area { opacity: 1; }

.tr-fade__top { stop-color: var(--tr-accent); stop-opacity: .26; }
.tr-fade__bottom { stop-color: var(--tr-accent); stop-opacity: 0; }

/* The comparison's own label, sitting on its line. */
.tr-acc__note {
    position: absolute;
    right: 0;
    top: 0;
    padding-top: 8px;
    color: var(--tr-muted);
    font-size: 13px;
    white-space: nowrap;
}

/* The line's leading point, an HTML element so the stretched SVG
   can't make it oval. */
.tr-acc__dot {
    position: absolute;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--tr-accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--tr-accent) 24%, transparent);
    opacity: 0;
    transition: opacity .2s ease-out;
    pointer-events: none;
}

.tr-acc.is-running .tr-acc__dot,
.tr-acc.is-complete .tr-acc__dot { opacity: 1; }

/* ── Tablets ── */
@media (max-width: 960px) {
    .tr-ens { grid-template-columns: minmax(0, 1fr); }
    .tr-ens__art { max-width: 320px; order: -1; }
    .tr-ens .pr-h2 { max-width: none; }
    .tr-grid { grid-template-columns: minmax(0, 1fr); }
    .tr-card { min-height: 380px; }
}

/* ── Phones ── */
@media (max-width: 760px) {
    .tr-ens { border-radius: 24px; }
    .tr-ens__art { max-width: 260px; }
    .tr-nets li { grid-template-columns: 32px minmax(0, 1fr); }
    .tr-nets p { grid-column: 2; margin-top: 2px; text-align: left; }
    .tr-nets h3 { font-size: 18px; }
    .tr-results { padding: 16px; border-radius: 24px; }
    .tr-results__head { flex-wrap: wrap; padding: 6px 4px 0; }
    .tr-card { min-height: 340px; padding: 20px; border-radius: 20px; }
}

@media (prefers-color-scheme: dark) {
    /* A step lighter than the near-black page, like the screenshot frames. */
    .tr-results { --tr-bg: #17181b; }
    .tr-ens::before { opacity: .26; }
    .tr-ens::after { opacity: .12; }
}

@media (prefers-reduced-motion: reduce) {
    .tr-chip,
    .tr-acc__area,
    .tr-acc__dot,
    .tr-nets__n,
    .tr-nets p { transition: none; }
}
