/* ============================================================================
   TradingViewer — site stylesheet
   One file, no dependencies, no build step.

   Design rules this file follows (and deliberately breaks AI-default habits):
   · hairline borders and a single accent instead of gradients, glows, glass
   · nested radii are concentric: outer = inner + gap, derived with calc()
   · type scale is restrained; no display type above 2.6rem
   · no entrance animations, no scroll effects, no hover lift
   · real data density instead of three identical icon cards

   Layers: reset → tokens → base → layout → components → print
   Baseline: Chrome/Edge 111+, Safari 16.4+, Firefox 113+
   ============================================================================ */

@layer reset, tokens, base, layout, components, print;

/* ---------------------------------------------------------------------------
   RESET
   --------------------------------------------------------------------------- */

@layer reset {

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    min-block-size: 100dvh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  img,
  svg,
  video {
    display: block;
    max-inline-size: 100%;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  p,
  h1,
  h2,
  h3,
  h4 {
    overflow-wrap: break-word;
  }

  ul[role="list"],
  ol[role="list"] {
    list-style: none;
    padding: 0;
  }

  :target {
    scroll-margin-block-start: 5rem;
  }
}

/* ---------------------------------------------------------------------------
   TOKENS
   --------------------------------------------------------------------------- */

@layer tokens {

  :root {
    color-scheme: dark;

    /* Surfaces — near-neutral, 2–3% chroma so nothing reads as "purple AI". */
    --bg: oklch(0.170 0.009 265);
    --bg-raised: oklch(0.196 0.010 265);
    --surface: oklch(0.214 0.011 265);
    --surface-hover: oklch(0.240 0.012 265);

    --line: oklch(0.286 0.012 265);
    --line-soft: oklch(0.242 0.011 265);

    --text: oklch(0.886 0.007 265);
    --text-muted: oklch(0.706 0.009 265);
    --text-faint: oklch(0.566 0.010 265);

    --accent: oklch(0.588 0.196 264);
    --accent-hover: oklch(0.640 0.180 264);
    --accent-ink: oklch(0.995 0 0);

    --up: oklch(0.662 0.116 176);
    --down: oklch(0.618 0.188 22);

    /* Type */
    --font: "Segoe UI Variable Text", "Segoe UI", -apple-system,
      BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
    --font-tight: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI",
      -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas,
      "Liberation Mono", monospace;

    --fs-xs: 0.8125rem;
    --fs-sm: 0.875rem;
    --fs-md: 0.9375rem;
    --fs-lg: 1.0625rem;
    --fs-xl: 1.25rem;
    --fs-2xl: clamp(1.4375rem, 1.30rem + 0.55vw, 1.75rem);
    --fs-3xl: clamp(1.875rem, 1.58rem + 1.20vw, 2.5rem);

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --sp-8: clamp(3rem, 2.2rem + 3vw, 5rem);

    /* Radii — every nested corner is derived, never hardcoded twice.
       Concentric rule: outer = inner + gap. */
    --r-1: 4px;
    --r-2: 6px;
    --r-3: 8px;
    --r-4: 12px;
    --r-5: 16px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --t-fast: 120ms;
    --t-base: 180ms;

    --container: 70rem;
    --container-wide: 86rem;
    --container-text: 44rem;
    --header-h: 3.5rem;

    /* Single source for the application icon. The file sits at the site root,
       this stylesheet lives in assets/css/, hence two levels up. Rename the
       file and only this line needs to change. */
    --app-icon: url("../../ico.jpg");
  }

  [data-theme="light"] {
    color-scheme: light;

    --bg: oklch(0.987 0.002 265);
    --bg-raised: oklch(1 0 0);
    --surface: oklch(1 0 0);
    --surface-hover: oklch(0.965 0.003 265);

    --line: oklch(0.892 0.005 265);
    --line-soft: oklch(0.937 0.004 265);

    --text: oklch(0.232 0.010 265);
    --text-muted: oklch(0.470 0.010 265);
    --text-faint: oklch(0.590 0.009 265);

    --accent: oklch(0.520 0.192 264);
    --accent-hover: oklch(0.470 0.196 264);

    --up: oklch(0.540 0.113 176);
    --down: oklch(0.545 0.190 22);
  }
}

/* ---------------------------------------------------------------------------
   BASE
   --------------------------------------------------------------------------- */

@layer base {

  html {
    background-color: var(--bg);
    accent-color: var(--accent);
    scrollbar-color: var(--line) transparent;
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  body {
    font-family: var(--font);
    font-size: var(--fs-md);
    color: var(--text);
    background-color: var(--bg);
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-tight);
    line-height: 1.2;
    letter-spacing: -0.014em;
    text-wrap: balance;
  }

  h1 {
    font-size: var(--fs-3xl);
    letter-spacing: -0.022em;
    line-height: 1.1;
  }

  h2 {
    font-size: var(--fs-2xl);
    letter-spacing: -0.016em;
  }

  h3 {
    font-size: var(--fs-lg);
    letter-spacing: -0.01em;
  }

  p {
    text-wrap: pretty;
  }

  a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color var(--t-fast) var(--ease);

    &:hover {
      color: var(--accent-hover);
    }
  }

  strong,
  b {
    font-weight: 620;
    color: var(--text);
  }

  small {
    font-size: var(--fs-xs);
  }

  code,
  kbd,
  samp {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 0.1em 0.34em;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-1);
    background-color: var(--surface);
    color: var(--text);
  }

  hr {
    border: 0;
    border-block-start: 1px solid var(--line-soft);
    margin-block: var(--sp-6);
  }

  ::selection {
    background-color: color-mix(in oklch, var(--accent) 32%, transparent);
  }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r-1);
  }

  :where(a, button, summary):focus:not(:focus-visible) {
    outline: none;
  }

  ::-webkit-scrollbar {
    inline-size: 10px;
    block-size: 10px;
  }

  ::-webkit-scrollbar-thumb {
    background-color: var(--line);
    border: 3px solid var(--bg);
    border-radius: var(--r-2);
  }

  .sr-only {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: absolute;
    inset-block-start: var(--sp-2);
    inset-inline-start: 50%;
    translate: -50% -200%;
    z-index: 100;
    padding: var(--sp-2) var(--sp-4);
    background-color: var(--accent);
    color: var(--accent-ink);
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: var(--r-2);
    text-decoration: none;

    &:focus-visible {
      translate: -50% 0;
    }
  }

}

/* ---------------------------------------------------------------------------
   LAYOUT
   --------------------------------------------------------------------------- */

@layer layout {

  .container {
    inline-size: min(100% - 2 * var(--sp-4), var(--container));
    margin-inline: auto;
    container-type: inline-size;
  }

  .container--wide {
    inline-size: min(100% - 2 * var(--sp-4), var(--container-wide));
    margin-inline: auto;
    container-type: inline-size;
  }

  .container--text {
    inline-size: min(100% - 2 * var(--sp-4), var(--container-text));
    margin-inline: auto;
  }

  /* Sections are separated by a hairline, not by floating cards. */
  .section {
    padding-block: var(--sp-8);
    border-block-start: 1px solid var(--line-soft);
    container-type: inline-size;
  }

  .section--flush {
    border-block-start: 0;
  }

  .stack {
    display: flex;
    flex-direction: column;
    gap: var(--stack-gap, var(--sp-3));
  }

  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cluster-gap, var(--sp-3));
  }

  .grid {
    display: grid;
    gap: var(--grid-gap, var(--sp-4));
    grid-template-columns: repeat(var(--grid-cols, 1), minmax(0, 1fr));
  }

  .grid--auto {
    grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
  }

  .section-head {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    max-inline-size: 54ch;
    margin-block-end: var(--sp-6);
  }

  .section-head p {
    color: var(--text-muted);
    max-inline-size: 58ch;
  }

  .eyebrow {
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
  }

  .lead {
    font-size: var(--fs-lg);
    line-height: 1.55;
    color: var(--text-muted);
    max-inline-size: 56ch;
  }
}

/* ---------------------------------------------------------------------------
   COMPONENTS
   --------------------------------------------------------------------------- */

@layer components {

  /* — header ---------------------------------------------------------------- */

  .site-header {
    position: sticky;
    inset-block-start: 0;
    z-index: 50;
    background-color: var(--bg);
    border-block-end: 1px solid var(--line-soft);
  }

  @supports (background-color: color-mix(in oklch, black, white)) {
    .site-header {
      background-color: color-mix(in oklch, var(--bg) 88%, transparent);
    }

    @supports (backdrop-filter: blur(1px)) {
      .site-header {
        backdrop-filter: blur(12px);
      }
    }
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    block-size: var(--header-h);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-tight);
    font-size: var(--fs-md);
    font-weight: 620;
    letter-spacing: -0.012em;
    color: var(--text);
    text-decoration: none;
  }

  /* The application icon itself, straight from App.ico — not a redrawn glyph.
     Drawn as a background rather than <img> so a missing file degrades to
     empty space instead of a broken-image box. */
  .brand-mark {
    inline-size: 1.75rem;
    block-size: 1.75rem;
    flex: none;
    border-radius: var(--r-2);
    background-image: var(--app-icon);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
  }

  .nav a {
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--r-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease),
      background-color var(--t-fast) var(--ease);

    &:hover {
      color: var(--text);
      background-color: var(--surface);
    }

    &[aria-current="page"] {
      color: var(--text);
    }
  }

  .header-tools {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    flex: none;
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
    inline-size: 2rem;
    block-size: 2rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--r-2);
    background-color: transparent;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--t-fast) var(--ease),
      background-color var(--t-fast) var(--ease),
      border-color var(--t-fast) var(--ease);

    &:hover {
      color: var(--text);
      background-color: var(--surface);
      border-color: var(--line-soft);
    }

    & svg {
      inline-size: 1rem;
      block-size: 1rem;
    }
  }

  .nav-details {
    display: none;
    position: relative;

    & > summary {
      list-style: none;
      cursor: pointer;

      &::-webkit-details-marker {
        display: none;
      }
    }

    &[open] > summary {
      color: var(--text);
      background-color: var(--surface);
      border-color: var(--line);
    }

    & nav {
      position: absolute;
      inset-block-start: calc(100% + var(--sp-2));
      inset-inline-end: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-inline-size: 12rem;
      padding: var(--sp-1);
      background-color: var(--bg-raised);
      border: 1px solid var(--line);
      border-radius: var(--r-3);
      box-shadow: 0 12px 32px -12px oklch(0 0 0 / 0.55);
    }

    & nav a {
      padding: var(--sp-2) var(--sp-3);
      border-radius: calc(var(--r-3) - var(--sp-1));
    }
  }

  @container (width < 52rem) {
    .nav--desktop {
      display: none;
    }

    .nav-details {
      display: block;
    }
  }

  /* — buttons --------------------------------------------------------------- */

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    block-size: 2.5rem;
    padding-inline: var(--sp-4);
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background-color: var(--surface);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: 560;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color var(--t-fast) var(--ease),
      border-color var(--t-fast) var(--ease),
      color var(--t-fast) var(--ease);

    & svg {
      inline-size: 1rem;
      block-size: 1rem;
      flex: none;
    }

    &:hover {
      background-color: var(--surface-hover);
      border-color: var(--text-faint);
      color: var(--text);
    }
  }

  .button--primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);

    &:hover {
      background-color: var(--accent-hover);
      border-color: var(--accent-hover);
      color: var(--accent-ink);
    }
  }

  .button--quiet {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-muted);
    padding-inline: var(--sp-2);

    &:hover {
      background-color: var(--surface);
      border-color: var(--line-soft);
      color: var(--text);
    }
  }

  /* — hero ------------------------------------------------------------------ */

  .hero {
    position: relative;
    padding-block: var(--sp-8) var(--sp-7);
    overflow: clip;
  }

  /* Graph-paper grid, faded out. A charting product deserves graph paper,
     not a diffused colour blob. */
  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
      linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
      linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
    background-size: 56px 56px;
    opacity: 0.55;
    mask-image: radial-gradient(90% 70% at 50% 0%, black 0%, transparent 78%);
    pointer-events: none;
  }

  /* Copy on top, the application window below at full container width.
     A two-column hero halved the window's width and made it unreadable —
     a product shot has to be big enough to actually read the numbers. */
  .hero-stack {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
  }

  .hero-copy {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    align-items: flex-start;
  }

  .hero-copy h1 {
    max-inline-size: 26ch;
  }

  /* :not(.hero-meta) — the metadata line is also a direct <p> child and must
     keep its own small, faint styling. */
  .hero-copy > p:not(.hero-meta) {
    max-inline-size: 62ch;
    color: var(--text-muted);
    font-size: var(--fs-lg);
    line-height: 1.55;
  }

  .hero-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-3);
    padding-block-start: var(--sp-1);
  }

  /* Metadata as a plain line with separators — no pill badges. */
  .hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-faint);

    & > * + *::before {
      content: "·";
      margin-inline-end: var(--sp-2);
      color: var(--line);
    }
  }

  /* — application preview ---------------------------------------------------
     A faithful rendering of the real window — title bar, header, watchlist,
     stats card, chart, status bar — at a fixed dark palette taken from the
     app's own theme tokens. A screenshot should not follow the site theme, so
     none of these colours reference the page variables.

     Everything is sized in em inside a container query, one em = 10px at a
     1000px reference width, so the whole window stays proportionally correct
     instead of recomposing at each breakpoint.
     ---------------------------------------------------------------------- */

  .mock {
    margin: 0;
    container-type: inline-size;
    inline-size: 100%;
  }

  .mk {
    --mk-last: #089981;

    /* One em = 10px at a 1000px container. The floor of 8px keeps the window
       from collapsing into a thumbnail on phones; the 14px cap stops it from
       turning into a billboard on a 4K display. */
    font-size: clamp(8px, 1.05cqi, 14px);
    display: flex;
    flex-direction: column;
    border: 1px solid #2a2e39;
    border-radius: var(--r-3);
    background-color: #0e1117;
    color: #d1d4dc;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.25;
    overflow: clip;
    user-select: none;
    box-shadow: 0 30px 60px -44px oklch(0 0 0 / 0.8);
  }

  /* — title bar — */

  .mk-title {
    display: flex;
    align-items: center;
    gap: 0.7em;
    block-size: 3.4em;
    padding-inline: 1em;
    border-block-end: 1px solid #1e222d;
  }

  .mk-logo {
    inline-size: 1.9em;
    block-size: 1.9em;
    flex: none;
    border-radius: 0.35em;
    background-image: var(--app-icon);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .mk-title span {
    font-size: 1em;
    font-weight: 600;
  }

  .mk-winbtns {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 1.1em;
    color: #5d606b;
  }

  .mk-winbtns svg {
    inline-size: 1em;
    block-size: 1em;
  }

  /* — header — */

  .mk-head {
    display: flex;
    align-items: center;
    gap: 0.7em;
    block-size: 5.2em;
    padding-inline: 1em;
    border-block-end: 1px solid #1e222d;
  }

  .mk-search {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    inline-size: 17em;
    block-size: 2.6em;
    padding-inline: 0.85em;
    border: 1px solid #2a2e39;
    border-radius: 0.5em;
    background-color: #1e222d;
    color: #5d606b;
  }

  .mk-search svg {
    inline-size: 1.1em;
    block-size: 1.1em;
    flex: none;
  }

  .mk-pill,
  .mk-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    flex: none;
    block-size: 2.6em;
    border-radius: 0.5em;
    background-color: #1e222d;
  }

  .mk-pill {
    padding-inline: 0.85em;
    color: #d1d4dc;
    font-weight: 600;
  }

  .mk-tool {
    inline-size: 2.6em;
    background-color: transparent;
    color: #868993;
  }

  .mk-pill svg,
  .mk-tool svg {
    inline-size: 1.15em;
    block-size: 1.15em;
  }

  .mk-quote {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.75em;
    flex: none;
    block-size: 3.3em;
    padding-inline: 0.9em;
    border: 1px solid #2a2e39;
    border-radius: 0.55em;
    background-color: #131722;
  }

  .mk-quote .s {
    font-weight: 700;
  }

  .mk-live {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.2em 0.5em;
    border-radius: 1em;
    background-color: rgb(8 153 129 / 0.14);
    color: #089981;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.05em;
  }

  .mk-live i {
    inline-size: 0.5em;
    block-size: 0.5em;
    border-radius: 50%;
    background-color: currentColor;
    animation: mk-pulse 2.6s ease-in-out infinite;
  }

  .mk-q-price {
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .mk-q-chg {
    font-size: 0.95em;
    font-variant-numeric: tabular-nums;
    color: #089981;
  }

  .mk-q-chg.is-down {
    color: #f23645;
  }

  /* — body: watchlist + stats on the left, chart on the right — */

  .mk-body {
    display: grid;
    grid-template-columns: 23em minmax(0, 1fr);
    /* Pinned rather than intrinsic: six watchlist rows plus the 24h card add
       up to ~35.4em, and the chart column needs a definite height for the
       flat SVG viewBox to map onto. */
    block-size: 35.5em;
  }

  .mk-side {
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid #1e222d;
    background-color: #131722;
    min-inline-size: 0;
  }

  .mk-side-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
    block-size: 2.6em;
    flex: none;
    padding-inline: 0.9em;
    border-block-end: 1px solid #1e222d;
    font-weight: 600;
  }

  .mk-side-h svg {
    inline-size: 1.1em;
    block-size: 1.1em;
    color: #868993;
  }

  .mk-side-h .ic {
    color: #2962ff;
  }

  .mk-watch {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .mk-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.1em 0.6em;
    padding: 0.62em 0.9em;
  }

  .mk-row b {
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .mk-row small {
    color: #5d606b;
    font-size: 0.85em;
  }

  .mk-row .p {
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-size: 1em;
    font-variant-numeric: tabular-nums;
    text-align: end;
    transition: color 500ms ease-out;
  }

  .mk-row .d {
    font-size: 0.85em;
    text-align: end;
    color: #868993;
    font-variant-numeric: tabular-nums;
    transition: color 600ms ease-out;
  }

  .mk-row.is-up .d {
    color: #089981;
  }

  .mk-row.is-down .d {
    color: #f23645;
  }

  .mk-row.flash-up .p {
    color: #089981;
  }

  .mk-row.flash-down .p {
    color: #f23645;
  }

  .mk-stats {
    margin: auto 0 0;
    border-block-start: 1px solid #1e222d;
  }

  .mk-stats .h {
    display: flex;
    align-items: center;
    gap: 0.5em;
    block-size: 2.4em;
    padding-inline: 0.9em;
    border-block-end: 1px solid #1e222d;
    font-weight: 600;
  }

  .mk-stats .h svg {
    inline-size: 1.1em;
    block-size: 1.1em;
    color: #2962ff;
  }

  .mk-stats dl {
    margin: 0;
    padding: 0.2em 0;
  }

  .mk-stats div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6em;
    padding: 0.42em 0.9em;
  }

  .mk-stats dt {
    color: #868993;
    font-size: 0.95em;
  }

  .mk-stats dd {
    margin: 0;
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-size: 0.95em;
    font-variant-numeric: tabular-nums;
  }

  /* — chart — */

  .mk-chart {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5.4em;
    min-inline-size: 0;
    background-color: #131722;
  }

  .mk-plot {
    position: relative;
    min-inline-size: 0;
    block-size: 100%;
  }

  .mk-plot svg {
    display: block;
    inline-size: 100%;
    block-size: 100%;
  }

  .mk-grid {
    stroke: #1e222d;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
  }

  .mk-c.up {
    color: #089981;
  }

  .mk-c.down {
    color: #f23645;
  }

  .mk-c .mk-b {
    fill: currentColor;
  }

  .mk-c .mk-w {
    stroke: currentColor;
    stroke-width: 1.4;
    vector-effect: non-scaling-stroke;
  }

  .mk-c .mk-v {
    fill: currentColor;
    opacity: 0.32;
  }

  .mk-price {
    stroke: var(--mk-last);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    vector-effect: non-scaling-stroke;
    opacity: 0.85;
  }

  .mk-axis {
    position: relative;
    border-inline-start: 1px solid #1e222d;
  }

  /* :not(.mk-tag) — the price badge is also a span in this column and must
     keep its own box, or the label rule wins on specificity. */
  .mk-axis span:not(.mk-tag) {
    position: absolute;
    inset-inline-start: 0.55em;
    translate: 0 -50%;
    color: #5d606b;
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-size: 0.9em;
    font-variant-numeric: tabular-nums;
  }

  .mk-tag {
    position: absolute;
    inset-inline: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    block-size: 1.6em;
    translate: 0 -50%;
    background-color: var(--mk-last);
    color: #0e1117;
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-size: 0.88em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: top 240ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .mk-legend {
    position: absolute;
    inset-block-start: 0.85em;
    inset-inline-start: 1em;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.9em;
    font-size: 0.92em;
    color: #868993;
    pointer-events: none;
  }

  .mk-legend b {
    color: #d1d4dc;
    font-size: 1.05em;
  }

  .mk-legend .v {
    color: #d1d4dc;
    font-family: "Trebuchet MS", ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
  }

  /* — status bar — */

  .mk-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
    block-size: 2.3em;
    flex: none;
    padding-inline: 1em;
    border-block-start: 1px solid #1e222d;
    color: #5d606b;
    font-size: 0.95em;
  }

  .mk-status .r {
    color: #5d606b;
  }

  @keyframes mk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
  }

  /* Narrow hero column: drop the side panel, keep the chart readable. */
  @container (width < 34rem) {
    .mk-body {
      grid-template-columns: minmax(0, 1fr);
    }

    .mk-side {
      display: none;
    }
  }

  @container (width < 26rem) {
    .mk-search {
      display: none;
    }

    .mk-head .mk-tool {
      display: none;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .mk-live i {
      animation: none;
    }
  }

  /* — feature list: hairline rows, not a card grid ------------------------- */

  .features {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border-block-start: 1px solid var(--line-soft);
  }

  @container (width >= 48rem) {
    .features {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: var(--sp-6);
    }
  }

  .feature {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--sp-3) var(--sp-4);
    align-items: start;
    padding-block: var(--sp-5);
    border-block-end: 1px solid var(--line-soft);

    & svg {
      inline-size: 1.125rem;
      block-size: 1.125rem;
      margin-block-start: 0.2rem;
      color: var(--text-faint);
    }

    & h3 {
      font-family: var(--font);
      font-size: var(--fs-md);
      font-weight: 620;
      letter-spacing: -0.006em;
      margin-block-end: var(--sp-1);
    }

    & p {
      font-size: var(--fs-sm);
      color: var(--text-muted);
      line-height: 1.6;
      max-inline-size: 42ch;
    }
  }

  /* — specification table --------------------------------------------------- */

  .specs {
    inline-size: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
    text-align: start;

    & th,
    & td {
      padding-block: var(--sp-3);
      padding-inline-end: var(--sp-4);
      border-block-end: 1px solid var(--line-soft);
      vertical-align: baseline;
    }

    & th {
      inline-size: 34%;
      font-weight: 500;
      color: var(--text-faint);
      text-align: start;
    }

    & td {
      color: var(--text);
    }

    & tr:last-child th,
    & tr:last-child td {
      border-block-end: 0;
    }

    & .mono {
      font-family: var(--font-mono);
      font-size: 0.9em;
    }
  }

  /* On narrow screens the two-column spec table becomes stacked rows:
     a 34% label column with wrapped Russian text reads badly. */
  @container (width < 30rem) {
    .specs th,
    .specs td {
      display: block;
      inline-size: auto;
      padding-block: 0;
      border-block-end: 0;
    }

    .specs th {
      padding-block-start: var(--sp-3);
      font-size: var(--fs-xs);
    }

    .specs td {
      padding-block-end: var(--sp-3);
      border-block-end: 1px solid var(--line-soft);
    }
  }

  /* — panels & callouts ----------------------------------------------------- */

  .panel {
    padding: var(--sp-5);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    background-color: var(--surface);
  }

  .spec-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);

    & dt {
      font-size: var(--fs-xs);
      font-weight: 500;
      color: var(--text-faint);
    }

    & dd {
      margin: 0;
      font-size: var(--fs-sm);
      color: var(--text);
    }
  }

  .callout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--sp-3);
    padding: var(--sp-4);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-3);
    background-color: var(--surface);

    & svg {
      inline-size: 1rem;
      block-size: 1rem;
      color: var(--text-faint);
      margin-block-start: 0.2rem;
    }

    & p {
      margin: 0;
      font-size: var(--fs-sm);
      color: var(--text-muted);
      line-height: 1.6;
    }
  }

  /* — FAQ ------------------------------------------------------------------- */

  .faq {
    border-block-start: 1px solid var(--line-soft);
  }

  .faq details {
    border-block-end: 1px solid var(--line-soft);

    &[open] > summary::after {
      rotate: 180deg;
    }
  }

  .faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding-block: var(--sp-4);
    font-size: var(--fs-md);
    font-weight: 560;
    cursor: pointer;
    list-style: none;
    transition: color var(--t-fast) var(--ease);

    &:hover {
      color: var(--text);
    }

    &::-webkit-details-marker {
      display: none;
    }

    /* Chevron drawn with borders: crisp at any DPR, no icon font. */
    &::after {
      content: "";
      flex: none;
      inline-size: 0.5rem;
      block-size: 0.5rem;
      margin-inline-end: 0.15rem;
      border-inline-end: 1.5px solid var(--text-faint);
      border-block-end: 1.5px solid var(--text-faint);
      rotate: 45deg;
      translate: 0 -0.1rem;
      transition: rotate var(--t-base) var(--ease);
    }
  }

  .faq-body {
    padding-block-end: var(--sp-5);
    max-inline-size: 68ch;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: 1.65;

    & > * + * {
      margin-block-start: var(--sp-3);
    }

    & ul,
    & ol {
      padding-inline-start: 1.15rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }
  }

  /* — closing block --------------------------------------------------------- */

  .closing {
    display: grid;
    gap: var(--sp-4);
    padding-block: var(--sp-6);
    border-block-start: 1px solid var(--line-soft);
  }

  @container (width >= 44rem) {
    .closing {
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: center;
    }
  }

  .closing p {
    color: var(--text-muted);
    max-inline-size: 52ch;
  }

  /* — legal pages ----------------------------------------------------------- */

  .legal-shell {
    display: grid;
    gap: var(--sp-7);
    grid-template-columns: minmax(0, 1fr);
    padding-block: var(--sp-7) var(--sp-8);
  }

  @container (width >= 60rem) {
    .legal-shell {
      grid-template-columns: 13rem minmax(0, 1fr);
      align-items: start;
      gap: var(--sp-7);
    }
  }

  .toc {
    display: none;
    position: sticky;
    inset-block-start: calc(var(--header-h) + var(--sp-4));
    max-block-size: calc(100dvh - var(--header-h) - 3rem);
    overflow: auto;
  }

  @container (width >= 60rem) {
    .toc {
      display: block;
    }
  }

  .toc h2 {
    font-family: var(--font);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-block-end: var(--sp-2);
  }

  .toc ol {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .toc a {
    display: block;
    padding: 0.3rem 0 0.3rem var(--sp-3);
    font-size: var(--fs-xs);
    line-height: 1.45;
    color: var(--text-faint);
    text-decoration: none;
    border-inline-start: 1px solid var(--line-soft);
    transition: color var(--t-fast) var(--ease),
      border-color var(--t-fast) var(--ease);

    &:hover {
      color: var(--text);
    }

    &[aria-current="true"] {
      color: var(--text);
      border-inline-start-color: var(--accent);
    }
  }

  .prose {
    max-inline-size: 70ch;
    color: var(--text-muted);
    font-size: var(--fs-md);
    line-height: 1.7;

    & > * + * {
      margin-block-start: var(--sp-4);
    }

    & h2 {
      font-size: var(--fs-xl);
      margin-block-start: var(--sp-6);
      color: var(--text);
    }

    & h2:first-child {
      margin-block-start: 0;
    }

    & h3 {
      font-size: var(--fs-md);
      font-weight: 620;
      margin-block-start: var(--sp-5);
      color: var(--text);
    }

    & ul,
    & ol {
      padding-inline-start: 1.15rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    & li::marker {
      color: var(--text-faint);
    }

    & table {
      inline-size: 100%;
      border-collapse: collapse;
      font-size: var(--fs-sm);
      border-block-start: 1px solid var(--line-soft);
    }

    & th,
    & td {
      padding: var(--sp-3) var(--sp-3) var(--sp-3) 0;
      text-align: start;
      vertical-align: top;
      border-block-end: 1px solid var(--line-soft);
    }

    & th {
      font-weight: 560;
      color: var(--text);
    }

    & a {
      text-decoration: underline;
    }
  }

  .legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    font-size: var(--fs-xs);
    color: var(--text-faint);
    padding-block-end: var(--sp-4);
    border-block-end: 1px solid var(--line-soft);

    & > * + *::before {
      content: "·";
      margin-inline-end: var(--sp-2);
      color: var(--line);
    }
  }

  /* — footer ---------------------------------------------------------------- */

  .site-footer {
    margin-block-start: var(--sp-8);
    border-block-start: 1px solid var(--line-soft);
    padding-block: var(--sp-6) var(--sp-5);
    font-size: var(--fs-sm);
  }

  .footer-grid {
    display: grid;
    gap: var(--sp-5);
    grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));

    & h3 {
      font-family: var(--font);
      font-size: var(--fs-xs);
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-faint);
      margin-block-end: var(--sp-3);
    }

    & ul {
      list-style: none;
      padding: 0;
      display: flex;
      flex-direction: column;
      gap: var(--sp-2);
    }

    & a {
      color: var(--text-muted);
      text-decoration: none;

      &:hover {
        color: var(--text);
      }
    }
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-inline-size: 40ch;
    color: var(--text-faint);
    font-size: var(--fs-sm);
    line-height: 1.6;
  }

  .footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2) var(--sp-4);
    margin-block-start: var(--sp-5);
    padding-block-start: var(--sp-4);
    border-block-start: 1px solid var(--line-soft);
    font-size: var(--fs-xs);
    color: var(--text-faint);
  }

  /* — utilities ------------------------------------------------------------- */

  .text-muted {
    color: var(--text-muted);
  }

  .text-faint {
    color: var(--text-faint);
  }

  .mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }

  .prose > section {
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
  }
}

/* ---------------------------------------------------------------------------
   PRINT — reviewers print the policy
   --------------------------------------------------------------------------- */

@layer print {

  @media print {
    :root {
      --bg: #fff;
      --bg-raised: #fff;
      --surface: #fff;
      --text: #111;
      --text-muted: #333;
      --text-faint: #555;
      --line: #ccc;
      --line-soft: #ddd;
      color-scheme: light;
    }

    .site-header,
    .site-footer,
    .toc,
    .hero::before,
    .skip-link {
      display: none !important;
    }

    body {
      font-size: 11pt;
      line-height: 1.5;
    }

    .legal-shell {
      display: block;
      padding-block: 0;
    }

    .prose {
      max-inline-size: none;
    }

    .prose > section {
      content-visibility: visible;
    }

    a[href^="http"]::after {
      content: " (" attr(href) ")";
      font-size: 0.85em;
      color: #555;
      word-break: break-all;
    }

    h2,
    h3 {
      break-after: avoid;
    }

    table,
    .callout {
      break-inside: avoid;
    }
  }
}

/* ---------------------------------------------------------------------------
   Top level, outside every layer: @view-transition is only honoured here.
   --------------------------------------------------------------------------- */

@view-transition {
  navigation: auto;
}
