/* The new design, « Horizon » (Sebastien's choice, 2026-11-22), while it is being built.
   Everything here hangs on <html data-design="next">, which js/design.js sets when the
   « New design (preview) » switch of Settings is on: without the attribute this file changes
   nothing, and the app is exactly the current one. Loaded after talucrypt.css and after the
   screens' own styles, so it has the last word.

   Step 2: the ambiance only. The palette below replaces talucrypt.css's, token for token,
   so every screen takes Horizon's colours without a change of its own; the screens keep
   their layout. New classes, when a screen gets its Horizon layout, are prefixed tc-fx-.

   Horizon in a few words: one light (an ice blue, drawn from the brand's steel) on a near
   black, or the same blue deepened on a pale grey-blue in the light theme; hairlines mixed
   from that light rather than framed panels; Sora for the text, JetBrains Mono for small
   labels. Both fonts are in ../fonts with their licences (SIL Open Font License 1.1), and
   the browser only fetches them once a page asks for them, so not while the switch is off. */

@font-face {
    font-family: 'Sora';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url('../fonts/sora-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
}

/* The dark palette. Surfaces and lines are the light mixed into the ground (5 % for a
   panel, 15 % for a hairline, 34 % for a strong one), written out as #RRGGBB because the
   canvas charts read these tokens as they are. */
:root[data-design="next"] {
    --bg: #05080C;
    --surface: #0C1218;
    --surface-2: #10191F;
    --line: #1A2730;
    --line-soft: #131D24;
    --line-strong: #344F5F;
    --selected: #1E2D38;
    /* 3:1 against the page, as in the current design. */
    --field-line: #476C81;

    --text: #EAF4FB;
    --text-dim: #A9BCCB;
    --text-muted: #8196A6;

    --accent: #8FD8FF;
    /* White button text needs 4.5:1: the light itself is far too pale to carry it. */
    --accent-strong: #1F6F96;
    --accent-soft: #A8E1FF;
    --brand: #8FD8FF;

    --up: #5FE3A1;
    --down: #FF8585;
    --down-strong: #C84C48;
    --down-hover: #B5423E;
    --warn: #F2B84B;

    --chart-1: #8FD8FF;
    --chart-2: #F2B84B;
    --chart-3: #C4B5FF;
    --chart-4: #D9E3EA;
    --chart-5: #4BB39F;
    --chart-6: #E08FD0;
    --chart-7: #4A9FD0;
    --chart-8: #B3A06A;

    --chart-ground: #0A1017;
    --chart-grid: #131D24;

    --chrome: #05080C;
    --chrome-raised: #0C1218;
    --chrome-raised-hover: #10191F;
    --tint: #8FD8FF;
    --shadow-ink: #000000;
    --scrim: rgba(2, 5, 8, 0.78);
    --on-warn: #1B1406;

    /* Horizon's own: the type, and how square its corners are. */
    --fx-sans: 'Sora', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --fx-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    --fx-halo: color-mix(in srgb, var(--accent) 11%, transparent);
    /* The glow of the big figure, and the glass of a detail opened under its row. */
    --fx-hero-glow: 0 0 34px color-mix(in srgb, var(--accent) 35%, transparent);
    --fx-glass: linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), color-mix(in srgb, var(--accent) 2.5%, transparent));
    --fx-glass-shadow: none;
}

/* The light palette, « daylight »: every token of the block above has its counterpart
   here (a test checks it), since that block would otherwise override the light theme. */
:root[data-design="next"][data-theme="light"] {
    --bg: #EDF2F6;
    --surface: #F8FBFD;
    --surface-2: #E6EEF4;
    --line: #CCE0EC;
    --line-soft: #D8E6EF;
    --line-strong: #A6CBE0;
    /* Pale enough for a green or red figure to keep 4.5:1 on the row that is picked. */
    --selected: #E2EDF5;
    --field-line: #5F8BA3;

    --text: #0B1722;
    --text-dim: #3B4C5B;
    /* 4.5:1 on a chip too, which is filled with --line. */
    --text-muted: #4E5F6E;

    /* The same blue, deepened to 4.5:1 on a panel. */
    --accent: #0071AD;
    --accent-strong: #00608F;
    --accent-soft: #006498;
    --brand: #0071AD;

    --up: #077A4B;
    --down: #C81E2C;
    --down-strong: #C81E2C;
    --down-hover: #A31824;
    --warn: #9A5C00;

    --chart-1: #0071AD;
    --chart-2: #C27A00;
    --chart-3: #7A4FD0;
    --chart-4: #566776;
    --chart-5: #1F7A6A;
    --chart-6: #A8458F;
    --chart-7: #3AA0D8;
    --chart-8: #85703A;

    --chart-ground: #F3F7FA;
    --chart-grid: #DDE7EE;

    --chrome: #EDF2F6;
    --chrome-raised: #F8FBFD;
    --chrome-raised-hover: #E6EEF4;
    --tint: #00527F;
    --shadow-ink: rgba(11, 40, 64, 0.35);
    --scrim: rgba(11, 30, 46, 0.4);
    --on-warn: #FFFFFF;

    --fx-sans: 'Sora', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --fx-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
    --fx-halo: rgba(255, 255, 255, 0.9);
    /* Daylight: no glow, and a white glass that casts a shadow. */
    --fx-hero-glow: none;
    --fx-glass: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.62));
    --fx-glass-shadow: 0 34px 60px -34px rgba(11, 40, 64, 0.42);
}

/* The page: Sora, and a soft halo of the light in the top left corner, fixed behind the
   screens as they scroll. */
:root[data-design="next"] body {
    font-family: var(--fx-sans);
    background-image: radial-gradient(900px 560px at 14% -6%, var(--fx-halo), transparent 70%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

/* Controls take the page's font: a browser gives buttons and fields its own otherwise. */
:root[data-design="next"] button,
:root[data-design="next"] input,
:root[data-design="next"] select,
:root[data-design="next"] textarea {
    font-family: inherit;
}

/* A panel's title is a small label in capitals, as on Horizon's instruments. */
:root[data-design="next"] .tc-panel > h2 {
    font-family: var(--fx-mono);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* « Follow » is written in the page's text colour on the button blue: near black on a deep
   blue in the light theme. White holds 4.5:1 on that blue in both themes. */
:root[data-design="next"] .tc-track-button:not(.tc-track-on) {
    color: #fff;
}

/* Square corners: Horizon's lines are straight. Chips and round marks keep theirs. */
:root[data-design="next"] .tc-panel,
:root[data-design="next"] .tc-button,
:root[data-design="next"] .tc-icon-button,
:root[data-design="next"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
:root[data-design="next"] select,
:root[data-design="next"] textarea {
    border-radius: 2px;
}

/* ── The Portfolio, « Horizon 2 » (step 4) ─────────────────────────────────────────────
   The page keeps its markup and all its logic: this only moves its parts. On a wide screen
   the card stops being a box and its pieces become the top of the screen -- the total,
   large and thin, the week, month and year in a row, the allocation in a column on the
   right, then the history as a curve the full width of the screen -- and the assets take
   the full width below. The picked asset's panel is drawn under its own row (Portfolio.razor,
   AssetDetailRow) instead of in a right-hand column. Narrower than this, the page stacks
   as it does today, in Horizon's colours. */

/* The title above the figures and the panels' own titles are small labels. */
:root[data-design="next"] .tc-card-head h1,
:root[data-design="next"] .tc-card-allocation h2,
:root[data-design="next"] .tc-portfolio-history h2,
:root[data-design="next"] .tc-assets-title h2 {
    font-family: var(--fx-mono);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* The total: thin, as on an instrument. Its size is set for the wide layout below. */
:root[data-design="next"] .tc-card-amount {
    font-weight: 200;
    letter-spacing: -0.02em;
}

:root[data-design="next"] .tc-card-btc,
:root[data-design="next"] .tc-portfolio-since,
:root[data-design="next"] .tc-card-periods dd,
:root[data-design="next"] .tc-assets td.tc-numeric,
:root[data-design="next"] .tc-assets th {
    font-family: var(--fx-mono);
}

/* The note about DeFi is a sentence, not a figure. */
:root[data-design="next"] .tc-portfolio-defi {
    font-family: var(--fx-sans);
}

:root[data-design="next"] .tc-assets th {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
}

/* The picked asset's detail, under its row: a pane of glass with two lit corners. */
:root[data-design="next"] .tc-assets tr.tc-fx-detail-row,
:root[data-design="next"] .tc-assets tr.tc-fx-detail-row:hover {
    background: transparent;
    cursor: default;
}

:root[data-design="next"] .tc-assets tr.tc-fx-detail-row > td {
    padding: 4px 0 18px 46px;
    border-top: 0;
    white-space: normal;
    text-align: left;
}

:root[data-design="next"] .tc-fx-detail-row .tc-asset {
    position: relative;
    margin: 0;
    padding: 20px 24px 22px;
    border: 1px solid var(--line);
    background: var(--fx-glass);
    box-shadow: var(--fx-glass-shadow);
    font-family: var(--fx-sans);
    /* Its sections flow into as many columns as the row is wide. */
    columns: 300px 3;
    column-gap: 44px;
    /* Brought into view when it opens (design.js, reveal): its own row stays in sight
       above it, clear of the top bar. */
    scroll-margin: calc(var(--topbar-h) + 84px) 0 24px;
}

:root[data-design="next"] .tc-fx-detail-row .tc-asset::before,
:root[data-design="next"] .tc-fx-detail-row .tc-asset::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

:root[data-design="next"] .tc-fx-detail-row .tc-asset::before {
    top: -1px;
    left: -1px;
    border-top: 1px solid var(--accent);
    border-left: 1px solid var(--accent);
}

:root[data-design="next"] .tc-fx-detail-row .tc-asset::after {
    right: -1px;
    bottom: -1px;
    border-right: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

:root[data-design="next"] .tc-fx-detail-row .tc-asset > * {
    break-inside: avoid;
}

/* A title stays with what it names: the chart's period picker went to the foot of one
   column and its chart to the top of the next. */
:root[data-design="next"] .tc-fx-detail-row .tc-asset > h3,
:root[data-design="next"] .tc-fx-detail-row .tc-asset > .tc-asset-head,
:root[data-design="next"] .tc-fx-detail-row .tc-asset > .tc-asset-chart-head {
    break-after: avoid;
}

@media (max-width: 767.98px) {
    :root[data-design="next"] .tc-assets tr.tc-fx-detail-row > td {
        padding-left: 0;
    }

    :root[data-design="next"] .tc-fx-detail-row .tc-asset {
        padding: 16px 14px 18px;
    }
}

@media (min-width: 1001px) {
    /* One column: the top of the screen, then the assets and what moved. */
    :root[data-design="next"] .tc-portfolio-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    /* The right-hand column held the picked asset's panel: it is under its row now. */
    :root[data-design="next"] .tc-portfolio-grid > .tc-portfolio-side:last-child {
        display: none;
    }

    /* The assets and what moved are as tall as their rows: the page scrolls, not a box
       held to the window's height beside two other columns. */
    :root[data-design="next"] .tc-portfolio-main {
        display: block;
        max-height: none;
    }

    :root[data-design="next"] .tc-portfolio-main > .tc-panel + .tc-panel {
        margin-top: 22px;
    }

    /* The empty row before the history takes what the allocation needs when it is taller
       than the figures: the lines on the left then stay together. */
    :root[data-design="next"] .tc-portfolio-grid > .tc-portfolio-side:first-child {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
        grid-template-rows: auto auto auto auto 1fr auto;
        grid-template-areas:
            "head alloc"
            "fresh alloc"
            "total alloc"
            "periods alloc"
            ". alloc"
            "history history";
        column-gap: 48px;
        row-gap: 12px;
        align-items: start;
    }

    /* The card is no longer a box: its pieces take their places in the grid above. */
    :root[data-design="next"] .tc-portfolio-card {
        display: contents;
    }

    :root[data-design="next"] .tc-portfolio-card > .tc-card-head { grid-area: head; }
    :root[data-design="next"] .tc-portfolio-card > .tc-freshness { grid-area: fresh; }
    :root[data-design="next"] .tc-portfolio-card > .tc-card-body { grid-area: total; }
    :root[data-design="next"] .tc-portfolio-card > .tc-card-periods { grid-area: periods; }
    :root[data-design="next"] .tc-portfolio-card > .tc-card-allocation { grid-area: alloc; }

    /* Thirty days of curve gave the card its shape; the history right under says more. */
    :root[data-design="next"] .tc-portfolio-card > .tc-card-spark {
        display: none;
    }

    /* The history is the screen's horizon: no frame, the full width of the screen. */
    :root[data-design="next"] .tc-portfolio-side > .tc-portfolio-history {
        grid-area: history;
        margin: 8px 0 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    /* First steps, « to go further » and the simulator: a row each, under the horizon. */
    :root[data-design="next"] .tc-portfolio-side:first-child > :not(.tc-portfolio-card):not(.tc-portfolio-history) {
        grid-column: 1 / -1;
    }

    :root[data-design="next"] .tc-card-amount {
        font-size: clamp(56px, 6.4vw, 100px);
        line-height: 1.05;
        text-shadow: var(--fx-hero-glow);
    }

    /* The week, the month and the year, side by side under the total. */
    :root[data-design="next"] .tc-portfolio-card > .tc-card-periods {
        display: flex;
        flex-wrap: wrap;
        gap: 10px 44px;
        margin: 0;
        padding: 0;
        border: 0;
    }

    /* The four readings of the allocation on one line. */
    :root[data-design="next"] .tc-card-allocation-tabs .tc-segment {
        padding-inline: 6px;
        font-size: 12px;
    }

    /* « What if »: the slider that moves every price on the left, what it gives line by
       line on the right. A table the full width of the screen put each asset a metre away
       from its own figures. */
    :root[data-design="next"] .tc-portfolio-whatif {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
        grid-template-rows: auto auto 1fr;
        grid-auto-flow: row dense;
        column-gap: 56px;
        align-items: start;
    }

    :root[data-design="next"] .tc-portfolio-whatif > h2,
    :root[data-design="next"] .tc-portfolio-whatif > .tc-whatif-intro,
    :root[data-design="next"] .tc-portfolio-whatif > .tc-move-row {
        grid-column: 1;
    }

    :root[data-design="next"] .tc-portfolio-whatif > .tc-whatif {
        grid-column: 2;
        grid-row: 1 / span 3;
    }

    :root[data-design="next"] .tc-portfolio-whatif > .tc-whatif-total {
        grid-column: 2;
    }
}
