/* Tape wears the Vetros family — same surfaces, same accent, its own wordmark and its own
     accent step — so it reads as a sibling product, not a marketing page. Dark-only on purpose:
     this is a market app, read at 6am, and a light theme would be a second design to maintain. */
  /* Tuned for CRISP, which is a contrast-and-edges problem, not a type-size one:
     mid-grey text promoted a step (grey copy on dark is what reads "soft"), borders raised until
     they're actually visible, and every blur removed — no shadow stacks, no backdrop-filter, no
     gradient washes. Radii tightened rather than squared off; hard corners aren't what does it. */
  :root {
    /* Page sits BELOW the cards, and far enough below that the step is visible without a shadow:
       a near-black page (#080b11) against a lifted card (#161d27) is what separates the panels now
       that nothing is floating. Pure black also works and is one value away — it just leaves the
       Vetros blue-black family, so this stops just short of it. */
    --bg: #080b11; --surface: #10161e; --card: #161d27; --card-2: #1f2733;
    --border: #3d4653; --border-soft: #252d38;
    --fg: #eef1f6; --fg-strong: #ffffff; --muted: #97a0ae; --muted-2: #d6dae2;
    --accent: #3d5afe; --accent-2: #8aa0ff; --accent-soft: rgba(61, 90, 254, 0.16);

    /* Categorical slots — fixed order, never cycled. Validated on the #161d27 card surface:
       lightness band, chroma floor, CVD separation, normal-vision floor, contrast all pass. */
    --c1: #5b7cf0; --c2: #c07f16; --c3: #23a89f; --c4: #9163e0; --c5: #e05a86;
    /* Status. Reserved — never a series color. Red/green is the market convention and it is NOT
       CVD-separable, so every use ships with a sign and an arrow; color never carries it alone. */
    --up: #2ea260; --down: #e05545; --flat: #8891a1;
    /* Chart ink: axis labels sit between body and muted — legible without competing with data. */
    --axis: #a8b1bf; --grid: rgba(160, 170, 186, 0.16);

    --radius: 0.5rem; --radius-sm: 0.375rem;
    --shadow-md: none;   /* a card is defined by its border, not by a blur under it */
    --maxw: 1080px;
    --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  * { box-sizing: border-box; }
  /* `hidden` is display:none in the UA sheet, which ANY author display rule outranks. `.btn` is
     inline-flex, so the "See the live dashboard" button stayed visible after being hidden and
     rendered as a dead href="#". Anything hidden is hidden. */
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; background: var(--bg); color: var(--fg);
    font-family: var(--font-sans); font-size: 16px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; text-decoration: none; }
  .wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
  .mono { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.7rem; color: var(--muted); }

  /* ---- header ---- */
  header.top { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; }
  .top-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 60px; }
  .brand { display: flex; align-items: baseline; gap: 0.55rem; }
  .brand .wm { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.02em; color: var(--fg-strong); }
  .brand .tick { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent-2); border: 1px solid var(--border); border-radius: 999px; padding: 0.1rem 0.45rem; }
  .top-right { display: flex; align-items: center; gap: 1.1rem; }
  .top-right a.link { font-size: 0.86rem; color: var(--muted-2); }
  .top-right a.link:hover { color: var(--fg); }
  /* The page's only branding now the footer is gone: a product mark, not a credit line. */
  .badge { display: inline-flex; align-items: center; gap: 0.45rem; border: 1px solid var(--border);
           border-radius: 999px; padding: 0.3rem 0.7rem 0.3rem 0.45rem; font-size: 0.82rem;
           color: var(--muted-2); white-space: nowrap;
           transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease; }
  .badge:hover { color: var(--fg); border-color: var(--accent); background: var(--accent-soft); }
  .badge strong { color: var(--fg); font-weight: 600; }
  .badge .mark { width: 17px; height: 17px; }

  /* ---- hero / the day's claim ---- */
  .lede { padding: 34px 0 8px; }
  .stamp { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 1rem; }
  .badge-sample { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #f0c674; border: 1px solid rgba(240, 198, 116, 0.35); background: rgba(240, 198, 116, 0.1); border-radius: 999px; padding: 0.16rem 0.55rem; }
  /* A working note, not a front page. The reference points are a research memo and a notebook:
     the document is TITLED, not headlined, and everything after it is evidence in order. A
     display-size hed makes the page a publication with an opinion; this makes it an analysis
     somebody did, which is what it actually is. */
  h1 { font-size: clamp(1.15rem, 1.6vw, 1.4rem); font-weight: 600; line-height: 1.35; letter-spacing: -0.012em; margin: 0 0 0.7rem; color: var(--fg-strong); max-width: 58ch; }

  /* ---- stat tiles ---- */
  .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; margin: 1.6rem 0 2.6rem; }
  .tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem 1.05rem; }
  .tile .k { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .tile .v { font-size: 1.78rem; font-weight: 700; letter-spacing: -0.03em; color: var(--fg-strong); margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
  .tile .d { font-size: 0.86rem; margin-top: 0.15rem; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 0.3rem; }
  .tile .n { font-size: 0.78rem; color: var(--muted-2); margin-top: 0.3rem; }
  .tile .d .dl { color: var(--muted); font-weight: 400; }
  .tile .d { font-weight: 550; }
  .up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--flat); }
  /* A signed headline number beats the tile's own heading ink. */
  .tile .v.up { color: var(--up); } .tile .v.down { color: var(--down); } .tile .v.flat { color: var(--flat); }
  td.up { color: var(--up); } td.down { color: var(--down); } td.flat { color: var(--flat); }

  /* ---- sections ---- */
  section { padding: 42px 0; }
  /* A part break sits ON its first block, not between two equal gaps. */
  section.part { padding: 56px 0 0; }
  section.part + section { padding-top: 20px; }
  .sec-head > div > h2 { display: flex; align-items: baseline; gap: 0.55rem; }
  .sec-head h2 .num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-2);
                      font-weight: 500; }
  .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
  h2 { font-size: 1.16rem; font-weight: 650; letter-spacing: -0.02em; margin: 0; color: var(--fg-strong); }
  .sec-head p { margin: 0; font-size: 0.86rem; color: var(--muted-2); }

  /* ---- the brief ---- */
  .brief { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.3rem, 3vw, 2rem); }
  .brief p { margin: 0 0 1.15rem; font-size: 1.03rem; color: var(--fg); max-width: 72ch; }
  .brief p:last-of-type { margin-bottom: 0; }
  /* Now that a chip carries a chart's TITLE rather than a widget id, uppercase turns a helpful
     reference into shouting. Sentence case, still monospace so it reads as a reference. */
  .cite { display: inline-flex; align-items: center; gap: 0.25rem; font-family: var(--font-mono);
          font-size: 0.66rem; letter-spacing: 0.01em; color: var(--accent-2);
          background: var(--accent-soft); border: 1px solid rgba(61, 90, 254, 0.3);
          border-radius: 999px; padding: 0.1rem 0.45rem; margin-left: 0.35rem;
          vertical-align: 1px; cursor: pointer;
          transition: background 0.14s ease, color 0.14s ease; }
  .cite:hover { background: rgba(61, 90, 254, 0.26); color: #fff; }
  .brief-foot { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--border-soft); font-size: 0.82rem; color: var(--muted); display: flex; gap: 1.2rem; flex-wrap: wrap; }

  /* ---- the call ---- */
  .call { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
  .branch { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; background: var(--card); }
  .branch.confirms { border-left: 3px solid var(--up); }
  .branch.denies { border-left: 3px solid var(--down); }
  .branch .lbl { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
  .branch p { margin: 0.4rem 0 0; font-size: 0.97rem; color: var(--fg); }
  .call-meta { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; font-size: 0.84rem; color: var(--muted); }
  .pill { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 999px; padding: 0.12rem 0.5rem; border: 1px solid var(--border); }
  .pill.open { color: var(--accent-2); border-color: rgba(61, 90, 254, 0.35); background: var(--accent-soft); }
  .pill.confirmed { color: var(--up); border-color: rgba(46, 162, 96, 0.35); background: rgba(46, 162, 96, 0.1); }
  .pill.wrong { color: var(--down); border-color: rgba(224, 85, 69, 0.35); background: rgba(224, 85, 69, 0.1); }

  /* ---- the argument between the charts ----
     Body type, prose measure, no card. It has to read as the same voice as the brief and NOT as
     chart furniture, or the reader treats it as a caption and skips it. */
  .lede-para { font-size: 1.03rem; line-height: 1.62; color: var(--fg); max-width: 68ch; margin: 0 0 1.1rem; }

  /* ---- the closing ask ---- */
  .cta { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.6rem; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.1rem); }
  .cta h2 { margin-bottom: 0.5rem; }
  .cta p { margin: 0; font-size: 0.95rem; color: var(--muted-2); max-width: 58ch; }
  .cta-acts { display: flex; flex-direction: column; gap: 0.6rem; }
  .editions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem;
              padding-top: 0.9rem; border-top: 1px solid var(--border-soft); }
  .editions .k { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em;
                 text-transform: uppercase; color: var(--muted); width: 100%; }
  .editions a { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted-2);
                border: 1px solid var(--border); border-radius: 999px; padding: 0.14rem 0.5rem; }
  .editions a:hover { color: var(--fg); border-color: var(--accent); }
  .editions a[aria-current] { color: var(--accent-2); border-color: var(--accent); }
  /* The inline ask: quiet enough that it reads as part of the page, not an interruption. */
  .sub-inline { margin-top: 1.4rem; padding: 1rem 1.2rem; border: 1px solid var(--border-soft);
                border-radius: var(--radius); background: var(--card); max-width: 52ch; }
  .sub-inline .k { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
                   text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
  .sub { display: flex; gap: 0.5rem; }
  .sub input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--border);
               border-radius: 10px; padding: 0.6rem 0.8rem; color: var(--fg);
               font-family: inherit; font-size: 0.92rem; }
  .sub input::placeholder { color: var(--muted); }
  .sub input:focus { outline: none; border-color: var(--accent); }
  .sub .btn { white-space: nowrap; }
  .sub-note { font-size: 0.76rem; color: var(--muted); margin: 0; }
  .sub-note.ok { color: var(--up); }
  .sub-note.err { color: var(--down); }
  .btn { display: inline-flex; justify-content: center; align-items: center; padding: 0.62rem 1.1rem; border-radius: 10px; font-size: 0.92rem; font-weight: 550; background: var(--accent); color: #fff; border: 1px solid var(--accent); transition: filter 0.14s ease; }
  .btn:hover { filter: brightness(1.12); }
  .btn.ghost { background: none; color: var(--muted-2); border-color: var(--border); }
  .btn.ghost:hover { color: var(--fg); border-color: var(--accent); }

  /* ---- charts ---- */
  .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.2rem; }
  .card.flash, .tile.flash { animation: flash 1.1s ease; }
  /* The header is sticky, so a bare anchor jump parks the evidence underneath it. */
  .card, .tile { scroll-margin-top: 76px; }
  @keyframes flash { 0%, 100% { border-color: var(--border); } 22% { border-color: var(--accent); } }
  .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.2rem; flex-wrap: wrap; }
  .card-head h3 { font-size: 1rem; font-weight: 650; margin: 0; color: var(--fg-strong); letter-spacing: -0.015em; }
  .card-head .sub { font-size: 0.82rem; color: var(--muted-2); margin: 0.15rem 0 0; }
  .ranges { display: flex; gap: 0.3rem; }
  .ranges button { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 999px; padding: 0.18rem 0.6rem; cursor: pointer; transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease; }
  .ranges button:hover { color: var(--fg); }
  .ranges button[aria-pressed="true"] { color: var(--fg-strong); border-color: var(--accent); background: var(--accent-soft); }
  .plot { width: 100%; }
  #chart-tape .plot.price { height: 268px; }
  #chart-tape .plot.vol { height: 142px; margin-top: 6px; }
  #chart-dispersion .plot { height: 300px; }
  #chart-priors .plot { height: 260px; }
  .legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0.5rem 0 0.2rem; font-size: 0.8rem; color: var(--fg); }
  .legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
  .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
  .swatch.band { background: rgba(192, 127, 22, 0.26); border: 1px solid rgba(192, 127, 22, 0.5); }

  .embed-code { width: 100%; margin-top: 0.5rem; background: var(--bg); color: var(--muted-2);
                border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.7rem;
                font-family: var(--font-mono); font-size: 0.7rem; line-height: 1.5; resize: vertical; }
  details.table { margin-top: 0.7rem; border-top: 1px solid var(--border-soft); padding-top: 0.6rem; }
  details.table summary { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
  details.table summary:hover { color: var(--fg); }
  .tbl-scroll { overflow-x: auto; margin-top: 0.6rem; }
  table { border-collapse: collapse; width: 100%; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
  th, td { text-align: right; padding: 0.34rem 0.7rem; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
  th:first-child, td:first-child { text-align: left; }
  th { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }

  /* ---- structural + archive ---- */
  .struct { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
  .arch { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .arch a { display: grid; grid-template-columns: 108px 1fr auto; gap: 1rem; align-items: center; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border-soft); transition: background 0.14s ease; }
  .arch a:last-child { border-bottom: none; }
  .arch a:hover { background: var(--card-2); }
  .arch .d { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
  .arch .h { font-size: 0.94rem; color: var(--fg); }

  /* ---- footer ---- */
  footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 34px 0 44px; }
  .foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
  footer h4 { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 0.8rem; font-weight: 500; }
  footer p, footer li { font-size: 0.85rem; color: var(--muted); margin: 0 0 0.5rem; }
  footer ul { list-style: none; padding: 0; margin: 0; }
  .built { display: inline-flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border); border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.84rem; color: var(--muted-2); transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease; }
  .built:hover { color: var(--fg); border-color: var(--accent); background: var(--accent-soft); }
  .built .mark { width: 16px; height: 16px; }

  @media (max-width: 900px) {
    .tiles { grid-template-columns: repeat(2, 1fr); }
    .call, .struct, .foot-grid, .cta { grid-template-columns: 1fr; }
    .arch a { grid-template-columns: 1fr auto; }
    .arch .d { grid-column: 1 / -1; }
  }
  /* The header is the widest fixed-width row on the page — left alone it sets a min document
     width and the whole layout overflows sideways on a phone. Drop the credit link (it's in the
     footer) and tighten the rest instead of letting the body scroll horizontally. */
  @media (max-width: 620px) {
    .top-right { gap: 0.9rem; }
    .top-right a.desk { display: none; }
    .badge span { display: none; }                 /* the mark alone still reads as the product */
    .badge { padding: 0.3rem; }
    .wrap { width: min(100% - 1.6rem, var(--maxw)); }
    h1 { max-width: none; }
    .tiles { gap: 0.6rem; }
    .tile .v { font-size: 1.45rem; }
    .card { padding: 1rem 0.85rem 1.05rem; }
  }
  @media (prefers-reduced-motion: reduce) { .card.flash, .tile.flash { animation: none; } }

/* ---- new-edition pill ---- */
.refresh-pill { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-strong); background: var(--card); border: 1px solid var(--accent);
  border-radius: 999px; padding: 0.5rem 1rem; cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease; }
.refresh-pill:hover { background: var(--accent-soft); }

/* ---- KPI sparkline (same shape the canvas draws) ---- */
.tile .spark { margin-top: 0.55rem; height: 28px; color: var(--c1); }
.tile .spark svg { width: 100%; height: 28px; display: block; }

/* ---- authored page: the standfirst under the claim ---- */
/* The abstract: what this note looked at and what it found. Set as body prose with a rule down
   the side, the way a notebook's opening cell reads. */
.standfirst { font-size: 0.95rem; line-height: 1.65; color: var(--muted-2); max-width: 74ch;
              margin: 0 0 1.6rem; padding-left: 0.9rem; border-left: 2px solid var(--border); }

/* ---- sources the brief actually read ---- */
.sources { margin-top: 1.2rem; padding-top: 0.9rem; border-top: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 0.3rem; }
.sources .k { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem; }
.sources a { font-size: 0.86rem; color: var(--muted-2); }
.sources a:hover { color: var(--fg); }
.sources .when { color: var(--muted); }
