@font-face {
  font-family: 'ET Book';
  src: url('fonts/et-book-roman-lining.woff2') format('woff2'),
       url('fonts/et-book-roman-lining.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  background: #fffff8;
  color: #111;
  font-size: 1.1rem;
  line-height: 1.618;
}
.content-columns canvas { max-width: 100%; }

/* Two-column layout on wide screens */
@media (min-width: 1100px) {
  body { max-width: 1280px; padding: 2rem 2.5rem; }
  .content-columns {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
  }
  .content-columns > #fundamentals {
    flex: 0 1 420px;
    min-width: 0;
    margin-bottom: 0;
  }
  .content-columns > #price-action {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
  }
  /* Single-column metrics when in side-by-side layout */
  .content-columns .metrics-group {
    grid-template-columns: 1fr;
  }
}

/* Two-row layout: prices full-width on top, fund + analysis side-by-side below */
@media (min-width: 1100px) and (max-width: 1399px) {
  .content-columns { flex-wrap: wrap; justify-content: center; }
  .content-columns > #price-action { flex: 0 0 100%; order: 1; margin-bottom: 1.5rem; }
  .content-columns > #fundamentals { order: 2; }
  .content-columns > #analysis { flex: 0 1 380px; order: 3; }
}

/* Three-column layout on extra-wide screens */
@media (min-width: 1400px) {
  body { max-width: 1680px; }
  .content-columns { gap: 2.5rem; }
  .content-columns > #fundamentals {
    flex-basis: 360px;
    order: 1;
  }
  .content-columns > #price-action {
    order: 2;
  }
  .content-columns > #analysis {
    flex: 0 1 380px;
    min-width: 0;
    margin-bottom: 0;
    order: 3;
  }
  .content-columns .metrics-group {
    grid-template-columns: 1fr;
  }
}

/* Narrative synthesis */
.narrative-synthesis {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #333;
  margin: 0 0 1.2rem 0;
}

/* Context sparkline */
.context-chart {
  margin: 0.3rem 0 1.4rem 0;
}
.context-chart canvas {
  display: block;
}
.context-chart-label {
  font-size: 0.85rem;
  color: #767676;
  margin-bottom: 0.2rem;
}

h1 {
  font-weight: normal;
  font-size: 2.2rem;
  letter-spacing: 0.01em;
  margin: 0 0 0.4rem 0;
}

h2 {
  font-variant: small-caps;
  font-weight: normal;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  margin: 0 0 0.8rem 0;
  color: #333;
}

p {
  margin: 0 0 0.6rem 0;
}

section {
  margin: 0 0 3rem 0;
}

.mono {
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.9em;
}

.sidenote {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

canvas.range { vertical-align: middle; display: block; margin: 0.5rem 0; }

/* Charts */
.full-width-chart {
  margin: 0 0 1rem 0;
}
.full-width-chart canvas {
  display: block;
}
.chart-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.25rem;
}

/* Crosshair label (below canvas, zero layout impact) */
.crosshair-label {
  display: block;
  font: 11px Georgia, serif;
  color: #767676;
  line-height: 14px;
  height: 0;
  overflow-x: clip;
  overflow-y: visible;
  white-space: nowrap;
  pointer-events: none;
}

/* Standalone chart rows — thin Tufte rule separates chart-text pairs */
.standalone-row {
  margin: 1rem 0;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.standalone-label {
  font-size: 0.95rem;
  color: #444;
  margin-bottom: 0.2rem;
}
.standalone-label .mono {
  margin-left: 0.5em;
}
.standalone-row canvas {
  display: block;
}

/* Fundamentals metrics */
.metrics-grid {
  max-width: 100%;
  margin-bottom: 2rem;
}
.metrics-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 2rem;
  margin: 0;
  padding: 0;
}
.metric {
  display: flex;
  align-items: baseline;
  font-size: 0.95rem;
}
.metric-label {
  font-family: Georgia, 'Times New Roman', serif;
  color: #444;
  white-space: nowrap;
}
.metric-label::after {
  content: '';
  flex: 1;
  order: 1;
  border-bottom: 1px dotted #ccc;
  margin: 0 0.4em;
  position: relative;
  bottom: 0.15em;
}
.metric-value {
  font-family: 'ET Book', Georgia, serif;
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 0.9em;
  text-align: right;
  white-space: nowrap;
  order: 2;
  margin: 0;
}

/* Metrics group sub-headers */
.metrics-group-header {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  color: #aaa;
  font-size: 0.75rem;
  font-weight: normal;
  margin: 0.6rem 0 0.1rem;
}
.metrics-group-header:first-child {
  margin-top: 0;
}

/* Header layout */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.header-name {
  margin: 0;
  font-variant: small-caps;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  font-weight: normal;
  color: #111;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 75%;
  overflow-wrap: break-word;
  word-break: break-word;
}
.header-ticker-input {
  font-family: Georgia, 'Times New Roman', serif;
  font-variant: small-caps;
  font-size: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  color: inherit;
  border: none;
  background: transparent;
  outline: none;
  padding: 0;
  margin: 0;
  text-transform: uppercase;
  width: 5ch;
  cursor: text;
}
.header-ticker-input::selection {
  background: rgba(45, 106, 46, 0.15);
}

.header-price-group {
  text-align: right;
  flex-shrink: 0;
}

.header-price {
  font-family: 'ET Book', Georgia, serif;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  color: #111;
}

.header-change {
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.88rem;
  margin-left: 0.6em;
  letter-spacing: 0;
}

.change-up   { color: #2d6a2e; }
.change-down { color: #8b2500; }
.change-flat { color: #666; }

.header-meta {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  margin: 0.15rem 0 0 0;
}

.status-msg {
  font-style: italic;
  color: #666;
  margin: 4rem 0;
}

/* Shared utility classes */
.help-hint {
  cursor: help;
  border-bottom: 1px dotted #ccc;
}
.subtle-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,0.25);
  text-underline-offset: 2px;
}
.muted-annotation {
  font-family: Georgia, serif;
  font-size: 0.78rem;
  color: #999;
}
.indicator-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 0.4em;
  order: 4;
  flex-shrink: 0;
}
.microsparkline {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.3em;
  width: 50px;
  height: 12px;
  order: 5;
  flex-shrink: 0;
}

/* Momentum display */
.momentum-line {
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.82rem;
  line-height: 1.6;
}
.momentum-window {
  margin-right: 1.5em;
  white-space: nowrap;
}
.momentum-label {
  font-variant: small-caps;
  font-family: Georgia, serif;
  color: #767676;
}

/* Section sub-headers with divider rule */
h2.section-divider {
  margin-top: 1.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* Annual Financials grid */
.fin-grid {
  display: grid;
  row-gap: 0.15rem;
  column-gap: 0;
  align-items: center;
  margin-top: 0.4rem;
}
.fin-header {
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.68rem;
  color: #999;
  text-align: right;
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}
.fin-header-ttm {
  color: #777;
  font-weight: 600;
}
.fin-label {
  font-family: Georgia, serif;
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fin-value {
  font-family: 'ET Book', Georgia, serif;
  font-size: 0.75rem;
  color: #444;
  text-align: right;
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}
.fin-value-ttm {
  color: #333;
  font-weight: 600;
}
.fin-spark {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Small multiples (trend grids, peer grids) */
.small-multiples {
  display: grid;
  gap: 0.5rem 1.2rem;
}
.micro-label {
  font-size: 0.78rem;
  font-family: 'ET Book', Georgia, serif;
  margin-bottom: 0.1rem;
}
.range-annotation {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #999;
  font-family: 'ET Book', Georgia, serif;
  margin-top: 0.15rem;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: #fffff8;
  color: #111;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  text-decoration: underline;
}
.skip-link:focus {
  top: 0.5rem;
}

@media (max-width: 480px) {
  .metrics-group { grid-template-columns: 1fr; }
}

footer {
  margin-top: 3rem;
  padding-top: 1rem;
  color: #999;
  font-size: 0.8rem;
  text-align: center;
}

@media print {
  body { background: white; max-width: none; }
  .content-columns { display: block !important; }
  .content-columns > #fundamentals,
  .content-columns > #price-action,
  .content-columns > #analysis { flex: none; width: 100%; }
  .status-msg { color: #999; }
  .header-ticker-input { display: none; }
  .skip-link { display: none; }
  .sidenote { color: #444; }
  section { break-inside: avoid; }
  dl { break-inside: avoid; }
}
