/* GoldMarket.lk v2.6: tracker reliability + final UX polish */

:root {
  --gm-v26-focus: 0 0 0 3px color-mix(in srgb, var(--gm-gold) 22%, transparent);
}

/* Keep financial values visually dominant and supporting information quieter. */
.v25-hero-top {
  margin-bottom: 22px;
}

.v25-hero .hero-lead {
  max-width: 650px;
}

.pulse-summary-card {
  max-width: 380px;
  justify-self: end;
}

.pulse-summary-copy span {
  line-height: 1.45;
}

.unit-switch button:focus-visible,
.today-karat-switch button:focus-visible,
.purity-switch button:focus-visible,
.period-switch button:focus-visible,
.mobile-unit-toggle:focus-visible,
.pulse-summary-card:focus-visible,
.comparison-link:focus-visible {
  outline: 0;
  box-shadow: var(--gm-v26-focus) !important;
}

/* Rate cards */
.rate-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.v25-rate-card {
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

@media (hover: hover) {
  .v25-rate-card:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 212, 135, .23);
    box-shadow: 0 34px 90px rgba(0, 0, 0, .23);
  }
}

/* Market Pulse: concise, scannable and truthful about cron vs source updates. */
.market-pulse-strip {
  margin-top: 18px;
}

.pulse-metric {
  min-width: 0;
}

.pulse-metric strong {
  overflow-wrap: anywhere;
}

.pulse-metric .metric-sub {
  line-height: 1.4;
}

.drawer-status {
  margin-bottom: 4px;
}

.verification-check .js-countdown,
.verification-check .js-relative-time {
  display: inline;
  color: #d6cfc3;
  font-weight: 750;
}

/* Today board */
.today-primary em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .68rem;
  font-style: normal;
  font-weight: 650;
}

.today-stat strong {
  font-variant-numeric: tabular-nums;
}

.today-points small {
  white-space: nowrap;
}

/* Chart: never draw a fake trend when there is only one data point. */
.chart-wrap {
  display: grid;
  place-items: stretch;
}

.chart-wrap > canvas,
.chart-empty-state {
  grid-area: 1 / 1;
}

.chart-empty-state {
  min-height: 275px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  text-align: center;
}

.chart-empty-state[hidden] {
  display: none !important;
}

.chart-empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--gold-deep);
}

.chart-empty-state strong {
  margin-top: 5px;
  color: var(--text);
  font-size: .96rem;
}

.chart-empty-state span {
  max-width: 470px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.55;
}

.period-switch button[data-days="0"] {
  min-width: 42px;
}

/* Recent moves */
.change-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}

.change-delta small {
  font-size: .62rem;
  font-weight: 800;
  opacity: .85;
}

/* Comparison and trust should support the rate, not compete with it. */
.v25-comparison-panel {
  margin-top: 16px;
}

.trust-strip {
  margin-top: 12px;
  opacity: .94;
}

/* Calculator polish */
.weight-presets button,
.mobile-unit-toggle {
  touch-action: manipulation;
}

.weight-presets button:hover {
  border-color: color-mix(in srgb, var(--gold) 38%, var(--line));
  color: var(--text);
}

/* Mobile tracker follows the same 8g / 1g preference as the hero. */
.mobile-rate-bar {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto !important;
}

.mobile-rate-bar > a span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 800;
}

.mobile-rate-bar > a small {
  color: var(--muted);
  font-size: .56rem;
  font-weight: 750;
}

.mobile-unit-toggle {
  appearance: none;
  -webkit-appearance: none;
  min-width: 46px;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--gold) 12%, var(--surface));
  color: var(--gold-deep);
  font: inherit;
  font-size: .67rem;
  font-weight: 900;
  cursor: pointer;
}

.mobile-unit-toggle:hover {
  background: color-mix(in srgb, var(--gold) 19%, var(--surface));
}

.mobile-pulse.state-active .pulse-dot,
.mobile-pulse.state-fresh .pulse-dot {
  background: #48d39a;
}

.mobile-pulse.state-delayed .pulse-dot {
  background: #e5b75b;
}

.mobile-pulse.state-stale .pulse-dot {
  background: #e16b6b;
}

/* Prevent long values or labels from causing horizontal overflow. */
.rate-card,
.comparison-panel,
.today-board,
.v25-chart-card,
.v25-calculator-card,
.changes-card,
.methodology-shell {
  min-width: 0;
}

body {
  overflow-x: hidden;
}

@media (max-width: 1199.98px) {
  .pulse-summary-card {
    max-width: 560px;
    justify-self: start;
  }
}

@media (max-width: 991.98px) {
  .market-pulse-strip {
    gap: 8px;
  }

  .pulse-metric {
    padding: 13px;
  }

  .mobile-rate-bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto !important;
  }
}

@media (max-width: 575.98px) {
  .hero-status-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .v25-unit-toolbar {
    position: sticky;
    top: 63px;
    z-index: 8;
    margin-inline: -4px;
    padding: 8px 4px;
    background: color-mix(in srgb, var(--gm-hero) 91%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .rate-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .comparison-row {
    overflow: hidden;
  }

  .chart-empty-state {
    min-height: 245px;
    padding: 24px 18px;
  }

  .mobile-pulse {
    display: none !important;
  }

  .mobile-rate-bar {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 48px !important;
  }

  .mobile-rate-bar > a {
    min-width: 0;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 2px !important;
    padding: 8px 10px !important;
  }

  .mobile-rate-bar > a strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .v25-rate-card,
  .pulse-summary-card,
  .rate-changed {
    transition: none !important;
    animation: none !important;
  }
}
