/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121821;
  --text: #e8eef5;
  --muted: #8b98a8;
  --accent: #8ec5ff;
  --alert: #f59e0b;
  --border: #243041;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  --footer-height: 2.85rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(142, 197, 255, 0.2), transparent 40%),
    radial-gradient(circle at bottom right, rgba(245, 158, 11, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
}

.site-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--footer-height);
  box-sizing: border-box;
}

.metrics {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 0.45rem 0.75rem 0.65rem;
  display: grid;
  gap: 0.45rem;
  height: calc(100vh - var(--footer-height));
  height: calc(100dvh - var(--footer-height));
  grid-template-rows: auto minmax(0, 1fr);
  box-sizing: border-box;
}

.metrics__header {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
}

.metrics__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.metrics__view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, black);
}

.metrics__view-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.55rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.metrics__view-toggle-btn svg {
  width: 1rem;
  height: 0.7rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.metrics__view-toggle-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.metrics__view-toggle-btn--active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

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

.metrics__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.75rem;
}

.metrics__domain {
  margin: 0;
  color: var(--alert);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.metrics__brand {
  margin: 0;
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}

.metrics__promise {
  margin: 0;
  font-size: clamp(0.78rem, 1.4vw, 0.92rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.2;
}

.metrics__subtitle {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.metrics__subtitle a {
  color: var(--accent);
  text-decoration: none;
}

.metrics__subtitle a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.metrics__main {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.metrics__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: 100%;
  min-height: 0;
  flex: 1;
}

.metrics[data-view="2"] .metrics__grid {
  grid-template-rows: minmax(0, 1fr);
}

.metrics[data-view="4"] .metrics__grid {
  grid-template-rows: 1fr 1fr;
}

.metrics[data-view="2"] .metrics__cell[data-charts="secondary"] {
  display: none;
}

.metrics__cell {
  min-width: 0;
  min-height: 0;
  display: flex;
}

.metrics__cell .metric-chart {
  flex: 1;
  width: 100%;
}

.metric-chart {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.metric-chart:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 1px;
}

.metric-chart:focus:not(:focus-visible) {
  outline: none;
}

.metric-chart--active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.metric-chart__header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  flex: 0 0 auto;
}

.metric-chart__title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.metric-chart__title-link {
  color: inherit;
  text-decoration: none;
}

.metric-chart__title-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.metric-chart__swap {
  display: none;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}

.metrics__cell[data-chart-slot="companion"][data-charts="primary"] .metric-chart__swap {
  display: flex;
}

.metrics__cell[data-chart-slot="companion"][data-charts="primary"] .metric-chart__title {
  display: none;
}

.metric-chart__swap-select {
  appearance: none;
  min-width: 0;
  max-width: 100%;
  padding: 0 1.45rem 0 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 6.25L8 10.75L12.5 6.25' stroke='%239aa8b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 0.85rem 0.85rem;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  cursor: pointer;
}

.metric-chart__swap-select:hover,
.metric-chart__swap-select:focus {
  color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 6.25L8 10.75L12.5 6.25' stroke='%238ec5ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  outline: none;
}

.metric-chart__swap-about {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.metric-chart__swap-about:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.metric-chart__levels {
  display: none;
}

.metric-chart--active .metric-chart__levels,
.metric-chart--solo .metric-chart__levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.55rem;
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.62rem;
}

.metric-chart__levels li {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.metric-chart__levels span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
}

.metric-chart__latest {
  display: grid;
  justify-items: end;
  gap: 0;
}

.metric-chart__latest-label {
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-chart__latest-value {
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1;
}

.metric-chart__latest-date {
  display: none;
}

.metric-chart__canvas-wrap {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  border-top: 1px solid var(--border);
}

.metric-chart__canvas {
  height: 100%;
  width: 100%;
}

.metric-chart__band-badge {
  position: absolute;
  top: 0.45rem;
  right: 3.25rem;
  z-index: 4;
  pointer-events: none;
  padding: 0.2rem 0.45rem;
  border: 1px solid color-mix(in srgb, var(--band-color) 55%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--band-color) 18%, rgba(15, 20, 25, 0.88));
  color: var(--band-color);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.metric-chart__level-labels {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 4;
  width: 5.5rem;
  pointer-events: none;
}

.metric-chart__alert-labels {
  position: absolute;
  inset: 0 0 0 auto;
  z-index: 5;
  width: 5.75rem;
  pointer-events: none;
}

.metric-chart__alert-label {
  position: absolute;
  top: 0;
  right: 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.12rem 0.15rem 0.12rem 0.35rem;
  border-radius: 4px;
  background: #f59e0b;
  color: #111827;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.metric-chart__alert-label--active {
  outline: 1px solid #fff7ed;
}

.metric-chart__alert-label-value {
  font-variant-numeric: tabular-nums;
}

.metric-chart__alert-label-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(17, 24, 39, 0.18);
  color: #111827;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.metric-chart__alert-label-clear:hover {
  background: rgba(17, 24, 39, 0.32);
  color: #7f1d1d;
}

.metric-chart__level-label {
  position: absolute;
  top: 0;
  left: 0.35rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: rgba(15, 20, 25, 0.82);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1.2;
}

.metric-chart__tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
  min-width: 4.75rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  color: #1f2937;
  font-family: var(--font);
  line-height: 1.2;
}

.metric-chart__tooltip[hidden] {
  display: none;
}

.metric-chart__tooltip-date {
  color: #6b7280;
  font-size: 0.68rem;
  margin-bottom: 0.1rem;
}

.metric-chart__tooltip-value {
  color: #111827;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--mono);
}

.metric-chart__tooltip-level {
  margin-top: 0.15rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
}

.metric-chart__tooltip-level[hidden] {
  display: none;
}

.metric-chart__subscribe {
  flex: 0 0 auto;
  padding: 0.35rem 0.55rem 0.4rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 80%, #0b0f14);
}

.metric-chart__subscribe-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.metric-chart__subscribe-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
}

.metric-chart__subscribe-lead,
.metric-chart__subscribe-when {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.metric-chart__subscribe-lead {
  color: var(--text);
  font-weight: 600;
}

.metric-chart__subscribe-cond {
  display: inline-flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  min-width: 0;
}

.metric-chart__alerts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  margin: 0;
}

.metric-chart__alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.1rem 0.15rem 0.1rem 0.45rem;
  border: 1px solid color-mix(in srgb, var(--alert) 40%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--alert) 12%, transparent);
  color: var(--alert);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.metric-chart__alert-chip:hover {
  border-color: var(--alert);
  background: color-mix(in srgb, var(--alert) 18%, transparent);
}

.metric-chart__alert-chip--active {
  border-color: var(--alert);
  background: color-mix(in srgb, var(--alert) 24%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--alert) 35%, transparent);
}

.metric-chart__alert-chip strong {
  font-weight: 600;
}

.metric-chart__clear-alert {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--alert) 70%, var(--muted));
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.metric-chart__clear-alert:hover {
  color: #fca5a5;
  background: color-mix(in srgb, #fca5a5 16%, transparent);
}

.metric-chart__subscribe-empty[hidden],
.metric-chart__subscribe-form[hidden] {
  display: none;
}

.metric-chart__email-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.metric-chart__email {
  flex: 1 1 10rem;
  min-width: 8rem;
  max-width: 16rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0f1419;
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  line-height: 1.2;
}

.metric-chart__email::placeholder {
  color: #6b7787;
}

.metric-chart__email:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 1px;
}

.metric-chart__send {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0.28rem 0.65rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #061018;
  font: inherit;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.2;
  cursor: pointer;
}

.metric-chart__send:hover {
  filter: brightness(1.08);
}

.metric-chart__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.metric-chart__subscribe-status {
  margin: 0.3rem 0 0;
  color: #86efac;
  font-size: 0.68rem;
}

.metric-chart__subscribe-status--error {
  color: #fca5a5;
}

.metrics__empty {
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.metrics__empty code {
  color: var(--alert);
  font-family: var(--mono);
}

@media (min-width: 1100px) {
  .metrics {
    gap: 0.5rem;
    padding: 0.5rem 1rem 0.75rem;
  }

  .metrics__brand {
    font-size: 1.65rem;
  }

  .metrics__promise {
    font-size: 0.92rem;
  }

  .metrics__subtitle {
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .metrics {
    padding: 0.35rem 0.5rem 0.5rem;
    gap: 0.35rem;
  }

  .metrics__grid {
    gap: 0.45rem;
  }

  .metrics[data-view="2"] .metrics__grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(12rem, 1fr));
  }

  .metrics[data-view="4"] .metrics__grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(12rem, auto));
    height: auto;
  }

  .metrics[data-view="4"] {
    height: auto;
    min-height: calc(100dvh - var(--footer-height));
  }

  .metric-chart__level-labels {
    width: 0;
    overflow: hidden;
  }

  .metric-chart__alert-labels {
    width: 4.75rem;
  }

  .metric-chart__latest-label {
    display: none;
  }
}

.indicator-page {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
  display: grid;
  gap: 1.5rem;
}

.indicator-page__header {
  display: grid;
  gap: 0.45rem;
}

.indicator-page__home-link {
  color: inherit;
  text-decoration: none;
}

.indicator-page__home-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.indicator-page__eyebrow {
  margin: 0.35rem 0 0;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.indicator-page__title {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.indicator-page__lead {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.indicator-page__reading {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  margin-top: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 88%, black);
}

.indicator-page__reading-label,
.indicator-page__reading-date {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.indicator-page__reading-value,
.indicator-page__reading-band {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.1;
}

.indicator-page__reading-band {
  font-size: 1.1rem;
}

.indicator-page__reading-date {
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}

.indicator-page__chart .metric-chart {
  min-height: 28rem;
}

.indicator-page__chart .metric-chart__canvas-wrap {
  min-height: 18rem;
}

.indicator-page__copy h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.indicator-page__copy h2:first-child {
  margin-top: 0;
}

.indicator-page__copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 42rem;
}

.indicator-page__bands {
  display: grid;
  gap: 0.85rem;
  margin: 0.75rem 0 0;
}

.indicator-page__bands dt {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.indicator-page__bands dd {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 42rem;
}

.indicator-page__related h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.indicator-page__related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.indicator-page__related li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 80%, black);
}

.indicator-page__related a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.indicator-page__related a:hover {
  color: var(--accent);
}

.indicator-page__related span {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.indicator-page__all {
  margin: 0.85rem 0 0;
}

.indicator-page__all a {
  color: var(--accent);
  text-decoration: none;
}

.indicator-page__all a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (max-width: 640px) {
  .indicator-page {
    padding: 0.75rem 0.75rem 2rem;
  }

  .indicator-page__chart .metric-chart {
    min-height: 24rem;
  }

  .indicator-page__chart .metric-chart__level-labels {
    width: 5.5rem;
    overflow: visible;
  }
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, black);
  backdrop-filter: blur(8px);
}

.site-footer__nav {
  max-width: 1600px;
  margin: 0 auto;
  min-height: var(--footer-height);
  padding: 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  box-sizing: border-box;
}

.site-footer__brand {
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-footer__brand:hover {
  color: var(--accent);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer__links a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  :root {
    --footer-height: 3.25rem;
  }

  .site-footer__nav {
    padding: 0 0.75rem;
  }
}
