/* ============================================================
   AEM market notes - shared stylesheet
   Canonical tokens and components. Edit here, not in a note.
   Notes link this file and add only their own bespoke chart CSS.
   ============================================================ */

html { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; }
h1, h2, p, figure, ol, ul { margin: 0; }

:root {
    --ground:      #E9ECEC;
    --paper:       #FBFCFC;
    --ink:         #0B2327;
    --ink-2:       #33484C;
    --muted:       #5E7275;
    --hairline:    #DCE3E4;
    --hairline-2:  #EDF1F1;
    --deep:        #0B2327;
    --deep-2:      #144147;
    --gold:        #EDA100;
    --data:        #0A8F63;
    --data-hi:     #A96A00;
    --data-track:  #E4EAEA;
    --pos:         #0A8F63;
    --neg:         #A33A34;
    --shadow:      0 1px 2px rgba(11,35,39,.05), 0 8px 28px -12px rgba(11,35,39,.16);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --ground:     #0A1416;
      --paper:      #101F22;
      --ink:        #E8EFEF;
      --ink-2:      #BCCACB;
      --muted:      #8CA0A2;
      --hairline:   #23383B;
      --hairline-2: #1A2C2F;
      --deep:       #071417;
      --deep-2:     #0F3237;
      --gold:       #F0B341;
      --data:       #29A176;
      --data-hi:    #BE8A2E;
      --data-track: #1C3033;
      --pos:        #29A176;
      --neg:        #D8756C;
      --shadow:     0 1px 2px rgba(0,0,0,.3), 0 8px 28px -12px rgba(0,0,0,.55);
    }
  }
  :root[data-theme="dark"] {
    --ground:     #0A1416;
    --paper:      #101F22;
    --ink:        #E8EFEF;
    --ink-2:      #BCCACB;
    --muted:      #8CA0A2;
    --hairline:   #23383B;
    --hairline-2: #1A2C2F;
    --deep:       #071417;
    --deep-2:     #0F3237;
    --gold:       #F0B341;
    --data:       #29A176;
    --data-hi:    #BE8A2E;
    --data-track: #1C3033;
    --pos:        #29A176;
    --neg:        #D8756C;
    --shadow:     0 1px 2px rgba(0,0,0,.3), 0 8px 28px -12px rgba(0,0,0,.55);
  }

  * { box-sizing: border-box; }

  body {
    background: var(--ground);
    color: var(--ink);
    font-family: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.62;
    margin: 0;
    padding: 0 20px 72px;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
  }

  .wrap { max-width: 760px; margin: 0 auto; }

  /* ---------- hero ---------- */
  .hero {
    background: var(--deep);
    background-image: linear-gradient(158deg, var(--deep-2) 0%, var(--deep) 62%);
    color: #fff;
    margin: 0 -20px 0;
    padding: 30px 24px 34px;
  }
  .hero-inner { max-width: 760px; margin: 0 auto; }
  .hero img.mark { height: 30px; width: auto; display: block; opacity: .95; }
  .hero-meta {
    display: flex; flex-wrap: wrap; gap: 10px 18px;
    align-items: baseline; justify-content: space-between;
    margin-top: 26px;
  }
  .eyebrow {
    font-size: 10.5px; font-weight: 700; letter-spacing: .17em;
    text-transform: uppercase;
  }
  .hero .eyebrow { color: var(--gold); }
  .hero-date { font-size: 12.5px; color: #93AFB2; letter-spacing: .02em; }
  .hero h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400; font-style: normal;
    font-size: clamp(27px, 5.4vw, 39px);
    line-height: 1.16; letter-spacing: -.012em;
    margin: 12px 0 0; text-wrap: balance; color: #fff;
  }
  .hero .standfirst {
    color: #B6CBCD; font-size: 16.5px; line-height: 1.58;
    margin: 14px 0 0; max-width: 60ch;
  }
  .hero .standfirst strong { color: #fff; font-weight: 600; }

  /* ---------- kpi row ---------- */
  .kpis {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
    border-radius: 3px; overflow: hidden;
    margin: 26px 0 0; box-shadow: var(--shadow);
  }
  .kpi { background: var(--paper); padding: 17px 16px 16px; }
  .kpi .eyebrow { color: var(--muted); display: block; }
  .kpi .fig {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(24px, 4.6vw, 31px);
    line-height: 1.05; margin-top: 9px; letter-spacing: -.015em;
    color: var(--ink); display: block;
  }
  .kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
  .kpi .fig.hi { color: var(--data-hi); }
  .kpi .fig.dn { color: var(--neg); }
  @media (max-width: 620px) {
    .kpis { grid-template-columns: 1fr; }
  }

  /* ---------- sections ---------- */
  section { margin-top: 42px; }
  section > .eyebrow {
    color: var(--data); display: block; margin-bottom: 9px;
  }
  h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 400; font-size: clamp(21px, 3.6vw, 25px);
    line-height: 1.25; letter-spacing: -.01em;
    margin: 0 0 14px; text-wrap: balance; color: var(--ink);
  }
  p { margin: 0 0 15px; max-width: 66ch; color: var(--ink-2); }
  p strong { color: var(--ink); font-weight: 600; }
  .lede { font-size: 17px; color: var(--ink); }
  a { color: var(--data); }
  a:focus-visible, .bar:focus-visible {
    outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px;
  }

  /* ---------- tables ---------- */
  .scroll { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
  table {
    border-collapse: collapse; width: 100%; min-width: 440px;
    font-size: 14.5px; background: var(--paper);
  }
  caption {
    caption-side: top; text-align: left; font-size: 12.5px; color: var(--muted);
    padding: 0 0 8px; line-height: 1.45;
  }
  th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--hairline-2); }
  th:first-child, td:first-child { text-align: left; }
  thead th {
    font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
    color: var(--muted); border-bottom: 1px solid var(--hairline);
    background: var(--paper); white-space: nowrap;
  }
  tbody tr:last-child td { border-bottom: 1px solid var(--hairline); }
  tr.emph td { background: rgba(169,106,0,.075); font-weight: 600; color: var(--ink); }
  tr.tot td { font-weight: 700; color: var(--ink); border-bottom: none; }
  td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
  td .sm { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

  /* ---------- chart ---------- */
  figure { margin: 0 0 18px; }
  .chart {
    background: var(--paper); border: 1px solid var(--hairline); border-radius: 3px;
    padding: 20px 18px 14px; box-shadow: var(--shadow);
  }
  .chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
  .chart-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
  .chart-unit { font-size: 11.5px; color: var(--muted); letter-spacing: .03em; }
  .plot {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px;
    align-items: end; height: 190px; position: relative;
    border-bottom: 1px solid var(--hairline);
  }
  .bar {
    position: relative; display: block; width: 100%; height: 100%;
    background: none; border: none; padding: 0; cursor: default;
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .bar .fill {
    background: var(--data);
    border-radius: 3px 3px 0 0;
    width: 100%;
    transition: filter .15s ease;
  }
  .bar.hi .fill { background: var(--data-hi); }
  .bar:hover .fill, .bar:focus-visible .fill { filter: brightness(1.12); }
  .bar .val {
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--h) + 6px);
    font-size: 11px; font-weight: 600; color: var(--ink);
    white-space: nowrap; letter-spacing: -.01em;
  }
  .bar .tip {
    position: absolute; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--h) + 6px);
    font-size: 11px; font-weight: 600; color: var(--ink);
    white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s ease;
  }
  .bar:hover .tip, .bar:focus-visible .tip { opacity: 1; }
  .xaxis {
    display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px;
    margin-top: 7px; font-size: 11px; color: var(--muted); text-align: center;
  }
  .xaxis span.on { color: var(--data-hi); font-weight: 700; }
  figcaption { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.5; max-width: 66ch; }
  @media (prefers-reduced-motion: reduce) {
    .bar .fill, .bar .tip { transition: none; }
  }

  /* ---------- evidence list ---------- */
  ol.ev { list-style: none; counter-reset: ev; padding: 0; margin: 0 0 16px; }
  ol.ev li {
    counter-increment: ev; position: relative; padding: 0 0 15px 40px;
    color: var(--ink-2); max-width: 64ch;
  }
  ol.ev li::before {
    content: counter(ev); position: absolute; left: 0; top: 1px;
    font-family: Georgia, serif; font-size: 13px; color: var(--data);
    width: 25px; height: 25px; line-height: 24px; text-align: center;
    border: 1px solid var(--hairline); border-radius: 50%; background: var(--paper);
  }
  ol.ev li strong { color: var(--ink); font-weight: 600; }

  /* ---------- flow timeline ---------- */
  .flow { border-left: 2px solid var(--hairline); padding-left: 20px; margin: 0 0 18px; }
  .flow-step { position: relative; padding-bottom: 20px; }
  .flow-step:last-child { padding-bottom: 0; }
  .flow-step::before {
    content: ""; position: absolute; left: -26px; top: 6px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--data); border: 2px solid var(--paper);
    box-shadow: 0 0 0 1px var(--hairline);
  }
  .flow-step.end::before { background: var(--data-hi); }
  .flow-date {
    font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); display: block; margin-bottom: 2px;
  }
  .flow-step p { margin: 0; max-width: 62ch; }
  .flow-step .book {
    font-family: Georgia, serif; font-size: 15px; color: var(--ink);
    display: block; margin-top: 4px;
  }

  /* ---------- callout ---------- */
  .read {
    background: var(--paper); border: 1px solid var(--hairline);
    border-top: 3px solid var(--data);
    border-radius: 3px; padding: 22px 22px 8px; box-shadow: var(--shadow);
  }
  .read h2 { margin-top: 0; }
  .read p:last-child { margin-bottom: 14px; }

  /* ---------- footer ---------- */
  footer {
    margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--hairline);
    font-size: 12.5px; color: var(--muted); line-height: 1.6;
  }
  footer p { color: var(--muted); font-size: 12.5px; max-width: 68ch; margin-bottom: 10px; }
  footer .rule-note { font-style: italic; }

/* ============================================================
   SHARED COMPONENTS
   Everything above this line is the note base. Everything below
   is reusable furniture available to any note.
   ============================================================ */

/* -- generic logo mark (hero, footer, landing) -- */
.mark { height: 30px; width: auto; display: block; opacity: .95; }

/* -- toolbar (reveal data tables etc) -- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
button.ghost {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
  background: transparent; border: 1px solid var(--hairline);
  border-radius: 3px; padding: 6px 12px; cursor: pointer;
}
button.ghost:hover { color: var(--ink); border-color: var(--muted); }
button.ghost:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; }

/* -- wide measure, for chart-led notes -- */
.wrap.wide { max-width: 1000px; }
.hero.wide .hero-inner { max-width: 1000px; }

/* -- chart legend -- */
.legend {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin: 0 0 16px; padding: 0; font-size: 12.5px; color: var(--ink-2);
}
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 11px; height: 11px; border-radius: 2px; flex: none; }

/* -- source / provenance line -- */
.src { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }

/* -- two-up layout, stacks on small screens -- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* -- floating tooltip for interactive SVG charts -- */
.tip-float {
  position: absolute; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%);
  background: var(--deep); color: #fff; font-size: 12px; line-height: 1.45;
  padding: 7px 10px; border-radius: 3px; white-space: nowrap;
  box-shadow: var(--shadow); transition: opacity .12s ease; z-index: 5;
}
.tip-float.on { opacity: 1; }
.tip-float b { font-weight: 700; }

/* -- landing card (site root, 404) -- */
.eyebrow.quiet { color: var(--muted); }
.wrap.landing { max-width: 620px; min-height: 78vh; display: flex; align-items: center; }
.landing-card {
  background: var(--paper); border: 1px solid var(--hairline);
  border-top: 3px solid var(--gold); border-radius: 3px;
  padding: 40px 38px; box-shadow: var(--shadow); width: 100%;
}
.landing-card .mark { margin-bottom: 26px; }
.landing-card h1 {
  font-family: Georgia, "Times New Roman", serif; font-weight: 400;
  font-size: clamp(24px, 4vw, 32px); line-height: 1.18;
  letter-spacing: -.012em; margin: 0 0 14px; color: var(--ink);
}
.landing-card p { color: var(--ink-2); }
.landing-card p + p { margin-top: 12px; }
.landing-card .contact { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--hairline-2); font-size: 13.5px; color: var(--muted); }

@media (max-width: 620px) {
  .grid-2 { grid-template-columns: 1fr; }
  .landing-card { padding: 30px 22px; }
}

/* -- print: force the light palette, drop the furniture -- */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --ground: #FFFFFF; --paper: #FFFFFF; --ink: #0B2327; --ink-2: #33484C;
    --muted: #5E7275; --hairline: #DCE3E4; --hairline-2: #EDF1F1;
    --deep: #0B2327; --deep-2: #144147; --gold: #B37A00;
    --data: #0A6B4B; --data-hi: #8A5600; --data-track: #E4EAEA;
    --pos: #0A6B4B; --neg: #8E322D; --shadow: none;
  }
  body { padding: 0; font-size: 11pt; }
  .wrap { max-width: none; }
  .toolbar, .tip-float { display: none !important; }
  .chart, .read, .kpi, .landing-card { box-shadow: none; border: 1px solid #DCE3E4; }
  figure, .chart, table, .read, .kpi { break-inside: avoid; page-break-inside: avoid; }
  h2 { break-after: avoid; page-break-after: avoid; }
  a { color: inherit; text-decoration: underline; }
  footer { break-before: avoid; }
}
