.market-data {
  --max-width: 1152px;
  --data-rule: #2c3338;
  --data-hero-image: url("../assets/precious-metals.webp");
}

.market-data .nav-links a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .55em;
}

.data-label {
  font-family: var(--font-heading);
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.data-label {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.data-label::before {
  content: "";
  width: 1.8rem;
  height: 1px;
  background: currentColor;
}

.data-intro {
  position: relative;
  isolation: isolate;
  margin-top: var(--nav-height);
  padding: clamp(3.5rem, 6.5vw, 6.25rem) 0;
  background: #101113;
  border-bottom: 1px solid var(--data-rule);
}

.data-intro::before {
  position: absolute;
  content: "";
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(90deg, #0e1012 7%, rgba(14,16,18,.98) 29%, rgba(14,16,18,.82) 41%, rgba(14,16,18,.2) 59%, transparent 73%), var(--data-hero-image);
  background-size: cover;
  background-position: center, right center;
}

.data-intro-copy {
  max-width: 40rem;
}

.data-intro h1 {
  color: #fbfaf7;
  font-size: clamp(3.35rem, 5.65vw, 5.4rem);
  font-weight: 500;
  line-height: .99;
  letter-spacing: -.06em;
}

.data-lead {
  max-width: 31rem;
  margin: 1.5rem 0 1.8rem;
  color: #d3d6d8;
  font-size: 1.125rem;
  line-height: 1.6;
}

.data-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem 1.6rem;
}

.data-button,
.data-text-link {
  font-size: 1rem;
  font-weight: 600;
}

.data-button {
  display: inline-block;
  padding: .75rem 1.25rem;
  background: var(--accent);
  border-radius: 4px;
  color: #071915;
}

.data-button:hover {
  background: #50e3c5;
  color: #071915;
}

.data-text-link {
  display: inline-block;
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: #81928e;
  text-underline-offset: .3em;
}

.data-text-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.data-example,
.data-access {
  padding: clamp(3rem, 5.75vw, 5rem) 0;
}

.data-example {
  scroll-margin-top: var(--nav-height);
}

.access-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  align-items: center;
  column-gap: clamp(2rem, 8vw, 8rem);
  row-gap: 2rem;
}

.example-copy h2,
.data-access h2 {
  font-size: clamp(2.25rem, 3.4vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 500;
}

.example-copy > p:not(.data-label),
.access-layout > div > p:not(.data-label) {
  font-size: 1.0625rem;
  color: #b9bdc4;
  line-height: 1.68;
}

.example-copy > p:not(.data-label) {
  margin-top: 1.15rem;
}

.access-layout .data-button {
  margin-top: 1.45rem;
}

.example-copy { max-width: 48rem; }
.data-example > .container { max-width: 96rem; }

.edition-panel {
  --panel-edge: #2d4246;
  --panel-text: #b9c8cb;
  margin-top: 2rem;
  padding: clamp(1rem, 2.5vw, 2rem);
  min-width: 0;
  background: #101a1e;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.edition-panel [hidden] { display: none; }
.edition-header, .metal-strip dt, .metal-strip dd, .sample-controls, .chart-controls, .curve-key {
  display: flex;
  align-items: center;
  gap: .6rem 1rem;
  flex-wrap: wrap;
}
.edition-header { justify-content: space-between; }
.edition-header h3 { font-size: 1.6rem; }
.sample-label { padding: .2rem .7rem; border: 1px solid #675a3e; border-radius: 1rem; color: #efd196; font-size: .875rem; }
.edition-panel .panel-note, .edition-view > p { color: var(--panel-text); font-size: .95rem; }
.edition-header + p { margin-top: .35rem; }
.metal-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin: 1.2rem 0; border-block: 1px solid var(--panel-edge); }
.metal-strip > div { padding: .9rem 1rem; border-inline-start: 1px solid var(--panel-edge); }
.metal-strip > div:first-child { border-inline-start: 0; }
.metal-strip dt { color: #e3e8e9; font-size: .95rem; gap: .5rem; }
.metal-strip dt small { color: var(--panel-text); font-size: .8rem; }
.metal-strip dd { font: 500 clamp(1.25rem, 2.25vw, 1.85rem)/1.35 var(--font-heading); }
.metal-strip dd small { font: 500 .875rem var(--font-body); }
.positive { color: #85d6bd; }
.negative { color: #efa89e; }
.edition-menu { display: flex; flex-wrap: wrap; gap: .25rem .6rem; padding-bottom: .75rem; border-bottom: 1px solid var(--panel-edge); }
.edition-menu button { padding: .55rem .75rem; background: transparent; border: 1px solid transparent; border-radius: .3rem; color: #c4ced0; font: 500 .925rem var(--font-body); cursor: pointer; }
.edition-menu button:hover { background: #213034; }
.edition-menu button[aria-pressed="true"] { background: #163731; border-color: #35665b; color: #96ecd5; }
.edition-body { padding-top: 1.2rem; }
.edition-view + .edition-view:not([hidden]) { margin-top: 0; }
.edition-view h3 { font-size: 1.35rem; }
.edition-view > p { margin: .45rem 0 1rem; max-width: 52rem; }
.sample-controls, .chart-controls { margin: .85rem 0; }
.sample-controls label, .chart-controls label { color: var(--panel-text); font-size: .875rem; }
.edition-view select { max-width: 100%; font: inherit; color: #edf1f1; background: #17252a; border: 1px solid #496064; border-radius: .3rem; padding: .35rem .4rem; margin-left: .25rem; }
.context-columns { display: grid; grid-template-columns: minmax(0,.95fr) minmax(0,1.05fr); gap: clamp(1rem, 3vw, 2.5rem); align-items: start; }
.rate-layout { display: grid; grid-template-columns: minmax(0, 2.7fr) minmax(16rem, 1fr); gap: 1.25rem; align-items: start; }
.rate-matrix { min-width: 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.sample-table { width: 100%; border-collapse: collapse; font-size: .95rem; white-space: nowrap; }
.sample-table caption { text-align: left; color: var(--panel-text); padding: .5rem 0; font-size: .875rem; }
.sample-table th, .sample-table td { padding: .55rem .65rem; text-align: right; border-bottom: 1px solid var(--panel-edge); }
.sample-table thead th { background: #18262b; color: #becaca; font-size: .82rem; font-weight: 600; }
.sample-table tbody th { font-weight: 500; }
.sample-table th:first-child { text-align: left; }
.sample-table .volume-credit { color: #d8e6e3; }
#rate-table { border-collapse: separate; border-spacing: 0; min-width: 47rem; table-layout: fixed; }
#rate-table th, #rate-table td { text-align: center; padding: .43rem .3rem; }
#rate-table th:first-child { position: sticky; left: 0; z-index: 1; width: 3.4rem; text-align: left; background: #142125; border-right: 1px solid var(--panel-edge); padding-left: .55rem; }
#rate-table td { border-inline-end: 1px solid #26363b; }
#rate-table .chart-market { background: #152d2e; }
#rate-table th button { background: transparent; border: 0; padding: .25rem; color: #edf2f1; font: 600 .95rem var(--font-heading); cursor: pointer; }
#rate-table th button:hover, #rate-table th button[aria-pressed="true"] { color: #89e6ce; }
#rate-table th button small { display: block; color: #becbce; font-size: .76rem; font-weight: 500; }
.side-labels, .quote-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
.side-labels { color: #b1c2c3; font-size: .75rem; font-weight: 500; }
.quote-pair { font-size: .94rem; font-weight: 600; line-height: 1.4; }
.quote-pair > span { display: inline-flex; justify-content: center; align-items: center; gap: .2rem; }
.quote-meta { display: flex; justify-content: space-around; gap: .2rem; margin-bottom: .2rem; color: #b6c3c5; font-size: .72rem; line-height: 1.3; }
#rate-table td > .daily-change { display: block; font-size: .77rem; color: #b6c3c5; }
.liquidity-gauge { display: inline-flex; flex: none; flex-direction: column-reverse; align-items: center; justify-content: center; gap: 1px; width: .6rem; }
.liquidity-gauge i { height: 2px; border-radius: 1px; background: #3d4b4d; }
.liquidity-gauge i:nth-child(1) { width: 3px; }
.liquidity-gauge i:nth-child(2) { width: 4px; }
.liquidity-gauge i:nth-child(3) { width: 6px; }
.liquidity-gauge i:nth-child(4) { width: 8px; }
.liquidity-gauge i:nth-child(5) { width: 9px; }
.liquidity-gauge[data-level="1"] { color: #eb9598; }
.liquidity-gauge[data-level="2"] { color: #e6b184; }
.liquidity-gauge[data-level="3"] { color: #e2cd87; }
.liquidity-gauge[data-level="4"] { color: #b7d69a; }
.liquidity-gauge[data-level="5"] { color: #8ad2ae; }
.liquidity-gauge .filled { background: currentColor; }
.sample-chart { min-width: 0; background: #0e171a; border: 1px solid var(--panel-edge); border-radius: .4rem; padding: 1rem; }
.sample-chart figcaption { font-family: var(--font-heading); font-weight: 600; }
.sample-chart svg { display: block; width: 100%; height: auto; }
.sample-chart svg text { fill: #bdc9cb; font: 12px var(--font-body); }
.chart-grid { stroke: #334548; }
.level-line { stroke: #74dfc1; stroke-width: 2.8; }
.prior-line { stroke: #a3acba; stroke-width: 2; stroke-dasharray: 6 5; }
.level-point { fill: #74dfc1; }
.curve-key { color: var(--panel-text); font-size: .8rem; }
.curve-key span::before { content: ""; display: inline-block; width: 1rem; border-top: 2px solid #74dfc1; margin-right: .4rem; vertical-align: middle; }
.curve-key span + span::before { border-top: 2px dashed #a3acba; }
#sample-csv { display: inline-block; font-size: .875rem; margin-top: .75rem; text-decoration: underline; text-underline-offset: .2rem; }
.edition-view .panel-note { margin: .9rem 0 0; }
.context-columns { margin-top: 1rem; }
.context-columns h4 { margin-bottom: .45rem; }
.context-columns p, .calendar-examples dd { color: var(--panel-text); }
.calendar-examples > div { padding: .3rem 0; border-bottom: 1px solid var(--panel-edge); }
.calendar-examples dd { font-size: .875rem; }

.data-access {
  background: #101b1b;
  border-top: 1px solid #263d3a;
}

.access-layout {
  align-items: start;
}

@media (min-width: 769px) and (max-width: 1100px) {
  .data-intro::before {
    background-image: linear-gradient(90deg, #0e1012 0%, rgba(14,16,18,.96) 32%, rgba(14,16,18,.77) 54%, transparent 83%), var(--data-hero-image);
  }
}

@media (max-width: 1199px) {
  .rate-layout { grid-template-columns: minmax(0, 1fr); }
  .sample-chart { width: min(100%, 43rem); }
}

@media (max-width: 768px) {
  .market-data .container {
    padding-inline: 1.4rem;
  }

  .data-intro {
    padding: 0 0 2.5rem;
  }

  .data-intro::before {
    position: static;
    display: block;
    height: clamp(9rem, 34vw, 15rem);
    margin-bottom: 1.7rem;
    background-image: linear-gradient(0deg, #101113 0%, transparent 28%), var(--data-hero-image);
    background-position: center, right 48%;
  }

  .data-intro h1 {
    font-size: clamp(2.9rem, 10.5vw, 4rem);
  }

  .data-lead {
    font-size: 1.0625rem;
  }

  .rate-layout, .context-columns,
  .access-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .access-layout {
    row-gap: 1.2rem;
  }

  .metal-strip { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metal-strip > div { padding: .65rem .55rem; }
  .metal-strip > div:nth-child(odd) { border-inline-start: 0; }
  .metal-strip > div:nth-child(n+3) { border-top: 1px solid var(--panel-edge); }
  .edition-menu { gap: .2rem; }
  .edition-menu button { padding: .55rem; }
  .sample-controls, .chart-controls { gap: .5rem; }
  .sample-chart { padding: .75rem; }
  .sample-table th, .sample-table td { padding: .45rem; }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
