/* ═══════════════════════════════════════════════════════════════════════
   EXALYTICS — theme "Ledger Pro"

   Design principles, so future edits stay coherent:
     · Chrome is neutral. Colour is reserved for data and for direction.
       Buttons are ink, never brand — a CTA must not out-shout a chart.
     · Two-tier accent: --accent passes AA for text (5.3:1); --accent-bright
       carries graphics (3.8:1). Using one mid-teal for both is what pushes
       most products into failing link contrast.
     · Every figure is tabular. Columns that don't align read as amateur.
     · Sans for interface, serif only where the content is written prose.
   ═══════════════════════════════════════════════════════════════════════ */

/* Latin subsets, self-host later — see docs/design-mockup for the rationale. */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@600;700;800;900&family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
    /* ── Surfaces & ink ─────────────────────────────────────────────── */
    --paper:        #F7F8F9;
    --paper-band:   #EFF2F4;
    --paper-deep:   #E7EBEE;
    --surface:      #FFFFFF;
    --on-accent:    #FFFFFF;   /* text sitting on an accent or ink fill */

    --ink:          #1F2630;   /* 14.3:1 — a dark grey, deliberately not black.
                                  Pure black on a light page reads harsh and
                                  cheap; every serious editorial product (FT,
                                  Economist, Bloomberg) sets type in a tinted
                                  near-black instead. */
    --ink-2:        #38424F;   /*  9.4:1 */
    --ink-3:        #616C7A;   /*  5.2:1 — smallest text still passes AA */
    --ink-4:        #97A1AD;   /*  2.6:1 — disabled and placeholders only */

    --rule:         #E4E8EC;
    --rule-2:       #C9D1D9;

    /* ── Accent ─────────────────────────────────────────────────────── */
    --accent:        #0B7A68;
    --accent-bright: #0D9488;
    --accent-glow:   #14B8A6;
    --accent-deep:   #08554A;
    --accent-tint:   #CFEBE5;
    --accent-wash:   #F0FAF8;

    /* ── Data series — matched lightness so no series shouts ────────── */
    --d-1: #0D9488;   /* teal   */
    --d-2: #2E5FC4;   /* navy   */
    --d-3: #C6890F;   /* ochre  */
    --d-4: #C2415A;   /* rose   */
    --d-5: #6B7793;   /* slate  */
    --d-6: #A6AEB9;   /* grey   */

    /* ── Direction of a number. Never decoration. ───────────────────── */
    --pos:       #10795A;
    --pos-tint:  #DEF3EA;
    --neg:       #BE3448;
    --neg-tint:  #FBE9EC;
    --warn:      #8A6212;
    --warn-tint: #FBF0DA;

    /* ── Type ───────────────────────────────────────────────────────── */
    --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
    --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    /* Brand only — the logo lock-up and the company name. Interface, headings,
       prose, and figures all stay on --sans / --serif / --mono. */
    --brand: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    /* ── Display scale ──────────────────────────────────────────────────
       There was no shared scale: page titles ranged from 34px to 88px and
       every sheet invented its own. One fluid ramp, used everywhere. */
    --fs-hero: clamp(34px, 3.6vw, 50px);   /* home hero only        */
    --fs-h1:   clamp(28px, 2.9vw, 40px);   /* page titles           */
    --fs-h2:   clamp(23px, 2.2vw, 30px);   /* section headings      */
    --fs-h3:   clamp(18px, 1.6vw, 22px);   /* card headings         */
    --fs-stat: clamp(26px, 2.4vw, 32px);   /* headline figures      */
    --fs-lede: clamp(16px, 1.4vw, 19px);   /* standfirst / intro    */

    /* ── Geometry & elevation ───────────────────────────────────────── */
    --r:    10px;
    --r-sm: 6px;
    --maxw: 1240px;

    --lift:   0 1px 2px rgba(11, 15, 20, .05), 0 1px 3px rgba(11, 15, 20, .04);
    --lift-2: 0 2px 4px rgba(11, 15, 20, .04), 0 14px 34px -14px rgba(11, 15, 20, .2);
    --lift-3: 0 4px 8px rgba(11, 15, 20, .05), 0 28px 60px -24px rgba(11, 15, 20, .3);
    --ring:   0 0 0 3px rgba(13, 148, 136, .26);
    --shadow-card: var(--lift);

    /* ── Legacy aliases ─────────────────────────────────────────────────
       Kept so the ~110 pre-existing var(--color-*) references keep resolving.
       New code should use the tokens above; these can be retired once the
       remaining call sites are migrated. */
    --color-page:        var(--paper);
    --color-surface:     var(--surface);
    --color-soft-blue:   var(--paper-band);
    --color-soft-blue-2: var(--paper);
    --color-navy:        var(--ink);
    --color-muted:       var(--ink-3);
    --color-border:      var(--rule);
    --color-primary:     var(--accent);
    --color-green:       var(--pos);
    --color-orange:      var(--d-3);
    --color-red:         var(--neg);
    --color-violet:      var(--d-5);

    --blue:       var(--accent);
    --muted:      var(--ink-3);
    --hair:       var(--rule);
    --footer:     var(--ink);
    --footer-div: rgba(255, 255, 255, .12);

    color-scheme: light;
    accent-color: var(--accent-bright);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* ── Display type is sans; serif is reserved for published prose ──────
   Headings sit a step darker than body copy. Everything rendering at one
   value is what made the page read as flat black — the hierarchy should
   come from weight AND tone, not weight alone. */
h1, h2, h3, h4 {
    color: var(--ink);
    font-family: var(--sans);
    font-weight: 650;
    letter-spacing: -0.028em;
    text-wrap: balance;
}

h1 { letter-spacing: -0.036em; line-height: 1.08; }
h2 { line-height: 1.14; }
h3 { line-height: 1.25; }

/* The hero markup hardcodes <br> after every word, forcing five lines at every
   width. Suppressing them lets text-wrap: balance pick the breaks.
   Direct children ONLY: the <br> inside the accent <span> has no whitespace
   around it in the markup, so hiding that one would weld "&" to "Visualized". */
.hero-copy h1 > br { display: none; }
p  { text-wrap: pretty; }

::selection {
    color: var(--accent-deep);
    background: var(--accent-tint);
}

/* The codebase had exactly one :focus-visible rule before this. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

body {
    min-height: 100%;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink-2);
    background: var(--color-page);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
}

button {
    border: 0;
}

.primary-button,
.secondary-button,
.light-button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 28px;
    border-radius: var(--r);
    font-weight: 650;
    text-align: center;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.primary-button:hover,
.secondary-button:hover,
.light-button:hover,
.btn:hover {
    transform: translateY(-2px);
}

/* Primary action is ink, not brand. On a page whose job is a chart, the CTA
   should recede; the accent stays available for data and for links. */
.primary-button,
.btn,
.btn-pill {
    color: var(--on-accent);
    background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 82%, #fff) 0%, var(--ink) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .13),
        0 1px 2px rgba(11, 15, 20, .22),
        0 8px 18px -8px rgba(11, 15, 20, .4);
}

.primary-button:hover,
.btn:hover,
.btn-pill:hover {
    background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 74%, #fff) 0%, var(--ink) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .16),
        0 2px 4px rgba(11, 15, 20, .24),
        0 14px 26px -10px rgba(11, 15, 20, .45);
}

/* A pressed state is what makes a button feel physical. There was none. */
.primary-button:active,
.btn:active,
.btn-pill:active,
.secondary-button:active,
.light-button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, .28);
}

.secondary-button {
    color: var(--ink);
    border: 1px solid var(--rule-2);
    background: var(--surface);
    box-shadow: var(--lift);
}

.secondary-button:hover {
    border-color: var(--ink-3);
}

.light-button {
    color: var(--ink);
    background: var(--surface);
    box-shadow: var(--lift);
}

/* Every figure in a data product is tabular. Non-negotiable. */
table td,
table th,
.metric-card strong,
.hero-stats dt,
.price strong {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.not-found {
    max-width: 960px;
    margin: 64px auto;
    padding: 0 24px;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }
}

/* --- Site Layout (Navbar & Footer) --- */
.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 0;
    background: color-mix(in srgb, var(--paper) 72%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: 0 1px 0 var(--rule), 0 1px 14px rgba(11, 15, 20, .04);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 8px 40px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    text-decoration: none;
}

/* The mark is drawn as SVG (Components/Shared/ExalyticsLogo.razor and the
   matching Pages/Shared/_ExalyticsLogo.cshtml partial). It replaced a crop of
   the square PNG lock-up, which was soft at nav size and repeated the wordmark
   that already sits beside it. */
.exalytics-logo {
    display: block;
    flex: 0 0 auto;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(16, 165, 245, 0.22);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.brand:hover .exalytics-logo {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 165, 245, 0.34);
}

/* Brand typeface, used for the company name only. */
.wordmark {
    color: var(--ink);
    font-family: var(--brand);
    font-size: 23px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    text-transform: lowercase;
}

.ai {
    display: inline-block;
    margin-left: 0.035em;
    padding: 0;
    border-radius: 0;
    color: #1677e8;
    background: none;
    font-family: inherit;
    font-size: 1em;
    font-weight: inherit;
    letter-spacing: inherit;
    box-shadow: none;
    vertical-align: baseline;
    transform: none;
}

.nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(26px, 3.4vw, 46px);
}

.nav-item {
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    transition: color 160ms ease;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.active {
    color: var(--ink);
}

.nav-item.active {
    box-shadow: inset 0 -2px 0 var(--accent-bright);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 22px;
    white-space: nowrap;
}

.nav-login {
    color: var(--ink);
    font-size: 15px;
    font-weight: 650;
}

.nav-user {
    max-width: 210px;
    overflow: hidden;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.profile-menu {
    position: relative;
}

.profile-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    list-style: none;
    cursor: pointer;
}

.profile-menu summary::-webkit-details-marker {
    display: none;
}

.profile-menu summary:focus-visible {
    outline: 3px solid rgba(22, 157, 242, 0.24);
    outline-offset: 3px;
}

.profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 3px solid var(--surface);
    border-radius: 999px;
    color: var(--on-accent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 76%, #fff), var(--accent));
    box-shadow: 0 0 0 1px var(--paper-deep), 0 7px 18px -10px rgba(23, 55, 94, 0.7);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.profile-avatar.large {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-width: 2px;
    font-size: 15px;
}

.profile-popover {
    position: absolute;
    top: calc(100% + 14px);
    right: 0;
    z-index: 120;
    width: min(340px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid var(--paper-deep);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: 0 24px 60px -24px rgba(23, 55, 94, 0.45);
}

.profile-popover::before {
    position: absolute;
    top: -7px;
    right: 17px;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--paper-deep);
    border-left: 1px solid var(--paper-deep);
    content: "";
    background: var(--surface);
    transform: rotate(45deg);
}

.profile-popover-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 22px 17px;
}

.profile-popover-head div {
    min-width: 0;
}

.profile-popover-head strong,
.profile-popover-head span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-popover-head strong {
    color: var(--ink);
    font-size: 16px;
}

.profile-popover-head span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.profile-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 18px 12px;
    padding: 11px 13px;
    border-radius: var(--r);
    color: var(--ink-2);
    background: var(--paper);
    font-size: 12px;
    font-weight: 650;
}

.profile-plan-row a {
    color: var(--blue);
}

.profile-menu-links {
    padding: 6px 10px 10px;
    border-bottom: 1px solid var(--paper-band);
}

.profile-menu-links a,
.profile-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    border-radius: var(--r);
    color: var(--ink-2);
    font-size: 14px;
    font-weight: 600;
}

.profile-menu-links a:hover,
.profile-menu-links a:focus-visible,
.profile-logout:hover,
.profile-logout:focus-visible {
    color: var(--ink);
    background: var(--paper);
}

.profile-menu-links a > span,
.profile-logout > span {
    width: 22px;
    color: var(--blue);
    text-align: center;
}

.profile-logout {
    margin: 8px 10px;
    color: var(--ink-3);
}

.btn-pill {
    min-height: 50px;
    padding: 0 24px;
    border-radius: var(--r);
    font-size: 15px;
}

.footer {
    padding: 56px 40px 30px;
    background: var(--footer);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 40px;
    max-width: var(--maxw);
    margin: 0 auto;
}

.footer-brand {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--on-accent);
    font-family: var(--brand);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.footer-blurb {
    max-width: 280px;
    margin: 0;
    color: var(--ink-4);
    font-size: 14px;
    line-height: 1.6;
}

.footer-h {
    margin-bottom: 16px;
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.footer-links a {
    color: var(--rule-2);
    font-size: 14px;
    transition: color 160ms ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--on-accent);
}

.footer-copy {
    max-width: var(--maxw);
    margin: 36px auto 0;
    padding-top: 22px;
    border-top: 1px solid var(--footer-div);
    color: var(--ink-3);
    font-size: 13px;
}

@media (max-width: 980px) {
    .nav-inner {
        flex-wrap: wrap;
        padding-right: 24px;
        padding-left: 24px;
    }

    .brand {
        min-width: 0;
    }

    .nav-center {
        order: 3;
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .nav-inner {
        justify-content: center;
        gap: 14px;
        padding: 10px 18px 16px;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }

    .nav-center {
        justify-content: flex-start;
        gap: 22px;
        overflow-x: auto;
        padding: 6px 0 2px;
    }

    .nav-right {
        gap: 14px;
    }

    .profile-popover {
        position: fixed;
        top: 86px;
        right: 16px;
    }

    .btn-pill {
        min-height: 44px;
        padding: 0 16px;
        font-size: 14px;
    }

    .footer {
        padding-right: 24px;
        padding-left: 24px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 34px;
    }
}
