/* ═══════════════════════════════════════════════════════════════
   DECRED.SUPPLY — terminal / IBM Carbon aesthetic
   ═══════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  /* Carbon Gray 100 theme */
  --blue-deep: #161616;
  --blue-bg: #262626;
  --blue-mid: #6929c4;   /* Carbon Purple 70 */
  --blue-light: #1192e8; /* Carbon Cyan 50 */
  --white: #f4f4f4;

  /* Alpha ramp over --white, expressed with color-mix */
  --w95: color-mix(in srgb, var(--white) 95%, transparent);
  --w80: color-mix(in srgb, var(--white) 80%, transparent);
  --w60: color-mix(in srgb, var(--white) 60%, transparent);
  --w40: color-mix(in srgb, var(--white) 40%, transparent);
  --w25: color-mix(in srgb, var(--white) 25%, transparent);
  --w15: color-mix(in srgb, var(--white) 15%, transparent);
  --w08: color-mix(in srgb, var(--white) 8%, transparent);
  --w04: color-mix(in srgb, var(--white) 4%, transparent);

  --teal: #009d9a; /* Carbon Teal 50 */
  --red: #fa4d56;
  --gold: #f1c21b;

  --font-mono: 'IBM Plex Mono', ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Ubuntu Mono", "Source Code Pro", "Fira Mono", "Consolas", "Courier New", monospace;
  --font-sans: var(--font-mono); /* monospace everywhere for the terminal look */

  --max-w: 1200px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--blue-deep);
  color: var(--white);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ═══ LOADING SPLASH ═══ */
.splash {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--w60);
  text-align: center;
}

.splash-dots::after {
  content: '';
  animation: dots 1.4s steps(1, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* Base wrapper */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 44px 4ch 72px;
}

/* ═══ HEADER ═══ */
.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--w15);
  margin-bottom: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--w80);
  text-transform: uppercase;

  &::after {
    content: ' █';
    color: var(--teal);
    animation: blinkCursor 1s step-end infinite;
  }
}

.logo-img {
  height: 32px;
  width: auto;
}

.logo-tag {
  transform: translateY(1px);
}

.logo-dim {
  font-weight: 400;
  color: var(--w40);
}

.logo-sep {
  color: var(--w25);
  margin: 0 2px;
}

@keyframes blinkCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.header-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w40);
  text-align: right;
  line-height: 1.7;
  transform: translateY(1px);
}

.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  margin-right: 5px;
  vertical-align: middle;
  animation: sonarPulse 2s infinite;
}

#header-status.offline .live-dot {
  background: var(--gold);
  animation: none;
}

@keyframes sonarPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 157, 154, 0.7); transform: scale(1); }
  70% { box-shadow: 0 0 0 6px rgba(0, 157, 154, 0); transform: scale(1.1); }
  100% { box-shadow: 0 0 0 0 rgba(0, 157, 154, 0); transform: scale(1); }
}

/* ═══ HERO ═══ */
.hero {
  text-align: center;
  margin-bottom: 28px;
}

.hero-number {
  font-family: var(--font-sans);
  font-size: clamp(120px, 22vw, 220px);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -6px;
  color: var(--white);
  position: relative;
  display: inline-flex;
  align-items: baseline;
  text-shadow: 0 0 20px rgba(17, 146, 232, 0.4), 0 0 40px rgba(17, 146, 232, 0.2);
}

.hero-pct {
  font-size: 0.35em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--w60);
  margin-left: 8px;
  vertical-align: baseline;
}

.glitch-anim {
  animation: dataGlitch 0.2s steps(2, end);
}

@keyframes dataGlitch {
  0% { transform: translate(0, 0); opacity: 1; }
  25% { transform: translate(-2px, 1px); opacity: 0.8; }
  50% { transform: translate(1px, -2px); opacity: 1; color: var(--blue-light); }
  75% { transform: translate(-1px, 2px); opacity: 0.9; }
  100% { transform: translate(0, 0); opacity: 1; }
}

.hero-word {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--w60);
  text-transform: uppercase;
  margin-top: 8px;
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--w95);
  margin-top: 20px;
  line-height: 1.6;
}

/* ═══ THE RATIO ═══ */
.ratio-block {
  text-align: center;
  padding: 64px 20px;
}

.ratio-text {
  font-family: var(--font-sans);
  font-size: clamp(20px, 3.5vw, 26px);
  font-weight: 300;
  line-height: 1.6;
  color: var(--w60);
  max-width: 600px;
  margin: 0 auto;

  & strong:not(.ratio-accent) {
    font-weight: 600;
    color: var(--white);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
  }
}

.ratio-accent {
  font-weight: 600;
  color: var(--teal);
  text-shadow: 0 0 10px rgba(0, 157, 154, 0.3);
}

/* ═══ TICKER ═══ */
.ticker {
  display: flex;
  align-items: baseline;
  gap: 32px;
  flex-wrap: wrap;
  padding: 20px 0;
  border-top: 1px solid var(--w15);
  border-bottom: 1px solid var(--w15);
  margin-bottom: 72px;
}

.ticker-item {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--w40);

  & .v {
    font-weight: 600;
    color: var(--w95);
    text-shadow: 0 0 5px rgba(17, 146, 232, 0.4);
  }
}

/* ═══ SECTION LABELS ═══ */
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--w80);
  text-transform: uppercase;
  margin-bottom: 24px;
}

/* ═══ SQUEEZE BAR ═══ */
.squeeze-section {
  margin-bottom: 72px;
}

.squeeze-stage {
  position: relative;
}

.squeeze-bar {
  position: relative;
  width: 100%;
  height: 76px;
  background: var(--w04);
  border: 1px solid var(--w15);
  display: flex;
  overflow: hidden;
}

.sq-segment {
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
  transition: width 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.sq-staked {
  background: var(--blue-mid);
  border-right: 1px solid var(--w25);
  z-index: 3;
}

.sq-treasury {
  background: var(--blue-light);
  border-right: 1px solid var(--w25);
  z-index: 2;

  & .sq-label {
    padding: 0;
    text-align: center;
    width: 100%;
  }
}

/* THE LIQUID SLIVER — thin, dim, precarious */
.sq-liquid {
  background: rgba(0, 10, 40, 0.6);
  position: relative;
  z-index: 4;

  &::before,
  &::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--red);
    box-shadow: 0 0 8px rgba(255, 131, 137, 0.4);
    animation: edgePulse 2s ease-in-out infinite;
  }

  &::before { left: 0; }
  &::after { right: 0; animation-delay: 0.5s; }
}

@keyframes edgePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.sq-unmined {
  background: repeating-linear-gradient(-45deg,
      transparent, transparent 3px, var(--w04) 3px, var(--w04) 4px);
  z-index: 1;
  flex: 1;
}

.sq-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w60);
  padding: 0 14px;
  white-space: nowrap;
  letter-spacing: 0.02em;

  & b {
    color: var(--white);
    font-weight: 600;
  }
}

.sq-label-right {
  margin-left: auto;
  text-align: right;
}

.sq-liquid-label {
  position: absolute;
  bottom: calc(100% + 8px);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red);
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
}

.sq-treasury-label {
  position: absolute;
  top: calc(100% + 8px);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--blue-light);
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: translateX(-50%);
  opacity: 0;
  z-index: 10;
}

.sq-liquid-label.show,
.sq-treasury-label.show {
  animation: labelFadeUp 0.4s ease-out 0.4s forwards;
}

.sq-treasury-marker {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 6px;
  background: var(--blue-light);
}

@keyframes labelFadeUp {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.legend {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w80);
}

.legend-sw {
  width: 10px;
  height: 10px;
  border: 1px solid var(--w25);
  flex-shrink: 0;

  &.stk { background: var(--blue-mid); }
  &.trs { background: var(--blue-light); }
  &.liq { background: rgba(0, 10, 40, 0.6); border-color: var(--red); }
  &.unm { background: transparent; }
}

/* ═══ WHY THIS MATTERS ═══ */
.why-section {
  margin-bottom: 72px;
}

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px 64px;
}

.why-cell {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--w15);
  transition: transform 0.2s ease;

  &:hover { transform: translateY(-2px); }
}

.why-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--blue-light);
  margin-bottom: 14px;
  letter-spacing: 0.1em;
}

.why-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  color: var(--w95);
  margin-bottom: 16px;
  line-height: 1.4;
}

.why-desc {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.85;
  color: var(--w60);

  & strong {
    color: var(--w80);
    font-weight: 500;
  }
}

/* ═══ COMPARISON TABLES ═══ */
.compare-section {
  margin-bottom: 72px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;

  & th {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.15em;
    color: var(--w40);
    text-transform: uppercase;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--w25);
  }

  & td {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--w60);
    padding: 24px 16px;
    border-bottom: 1px solid var(--w08);
    vertical-align: middle;
  }

  & tr:last-child td {
    border-bottom: 1px solid var(--w25);
  }

  & .asset-name {
    font-weight: 600;
    color: var(--w95);
  }

  & .cmp-strong {
    color: var(--white);
    font-weight: 700;
  }
}

.compare-bar-wrap {
  width: 100%;
  max-width: 180px;
  height: 8px;
  background: var(--w08);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.compare-bar-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill-dcr {
  background: var(--white);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.fill-other {
  background: var(--w25);
}

.highlight-row td {
  background: linear-gradient(90deg, rgba(105, 41, 196, 0.15) 0%, rgba(105, 41, 196, 0.05) 100%);
  border-top: 1px solid rgba(105, 41, 196, 0.2);
  border-bottom: 1px solid rgba(105, 41, 196, 0.4);

  &:first-child {
    box-shadow: inset 3px 0 0 var(--teal);
  }
}

.highlight-row .asset-name {
  color: var(--white);
  text-shadow: 0 0 8px rgba(105, 41, 196, 0.6);
}

.compare-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w25);
  margin-top: 12px;
  line-height: 1.6;
}

.table-wrapper,
.sankey-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sankey-wrapper {
  padding-bottom: 20px;
}

/* ═══ METRICS GRID ═══ */
.metrics-section {
  margin-bottom: 72px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.metric {
  padding: 16px 0;
  border-bottom: 1px solid var(--w15);
  transition: opacity 0.3s ease;

  &:hover { opacity: 0.8; }
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--w40);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  letter-spacing: -1px;
}

.metric-unit {
  font-size: 16px;
  font-weight: 400;
  color: var(--w40);
}

.metric-years {
  font-size: 0.45em;
  opacity: 0.7;
  margin-left: 8px;
  vertical-align: middle;
}

.metric-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w40);
  margin-top: 8px;

  & .hl { color: var(--blue-light); font-weight: 500; }
  & .pos { color: var(--teal); }
}

.metric-sub-dim {
  margin-top: 4px;
  opacity: 0.7;
}

/* ═══ HISTORICAL CHART ═══ */
.chart-section {
  margin-bottom: 72px;
}

.chart-wrap {
  background: var(--blue-bg);
  border: 1px solid var(--w15);
  padding: 28px 24px 20px;
  position: relative;

  & canvas {
    width: 100% !important;
    display: block;
  }
}

.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 0;
  color: var(--w40);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.chart-loading-bar {
  width: 120px;
  height: 2px;
  background: var(--w08);
  border-radius: 1px;
  overflow: hidden;
  position: relative;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: var(--teal);
    animation: loadSlide 1.2s ease-in-out infinite;
  }
}

@keyframes loadSlide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.chart-legend {
  display: flex;
  gap: 28px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--w08);
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w60);
}

.chart-legend-sw {
  width: 12px;
  height: 3px;
  border-radius: 1px;
  flex-shrink: 0;
}

.chart-sw-locked { background: var(--teal); height: 4px; }
.chart-sw-circ { background: var(--w25); border-top: 1px dashed var(--w40); height: 0; }
.chart-sw-liquid { background: var(--red); }

/* Crosshair tooltip drawn by js/chart.js */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 20;
  background: rgba(22, 22, 22, 0.95);
  border: 1px solid var(--w15);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w80);
  white-space: nowrap;
}

.ct-title {
  color: var(--white);
  font-weight: 700;
  margin-bottom: 8px;
}

.ct-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.7;
}

.ct-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══ SANKEY ═══ */
.sankey-section {
  margin-bottom: 72px;
}

.sankey-container {
  display: flex;
  align-items: stretch;
  height: 280px;
  background: var(--blue-deep);
  border: 1px solid var(--w15);
  padding: 24px;
}

.sankey-col {
  display: flex;
  flex-direction: column;
}

.sankey-source {
  width: 140px;
  justify-content: center;
}

.sankey-target {
  width: 180px;
}

.sankey-middle {
  flex: 1;
  padding: 0 4px;
  display: flex;
}

.sankey-svg {
  width: 100%;
  height: 100%;

  & path {
    opacity: 0.6;
    transition: opacity 0.3s;

    &:hover { opacity: 0.9; }
  }
}

.path-miners { fill: var(--w40); }
.path-treasury { fill: var(--blue-light); }
.path-stakers { fill: var(--blue-mid); }

.sankey-node {
  background: var(--blue-bg);
  border: 1px solid var(--w15);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.s-node-source {
  height: 100%;
  border-color: var(--w40);
  background: var(--w04);
}

.s-node-miners {
  height: 15%;
  margin-bottom: 2%;

  & .sankey-node-val { font-size: 16px; color: var(--w60); }
}

.s-node-treasury {
  height: 25%;
  margin-bottom: 2%;
  border-color: rgba(17, 146, 232, 0.4);
  background: rgba(17, 146, 232, 0.05);

  & .sankey-node-val { font-size: 20px; color: var(--blue-light); }
}

.s-node-stakers {
  height: 56%;
  border-color: var(--blue-mid);
  background: rgba(105, 41, 196, 0.05);
}

.sankey-node-val {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.sankey-node-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w60);
  text-transform: uppercase;
  margin-top: 8px;
}

.hl-stakers {
  color: var(--blue-mid);
  font-size: 32px;
}

/* ═══ CLOSING ═══ */
.closing {
  border-top: 1px solid var(--w15);
  padding-top: 40px;
  margin-bottom: 72px;

  & p {
    font-family: var(--font-mono);
    font-size: 18px;
    line-height: 2;
    color: var(--w60);
    max-width: 800px;
  }

  & strong {
    font-weight: 600;
    color: var(--w95);
  }

  & .acc {
    color: var(--blue-light);
    font-weight: 500;
  }
}

/* ═══ FOOTER ═══ */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-left {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--w25);
  line-height: 1.7;
}

.footer-right {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--w25);
  text-transform: uppercase;
}

/* ═══ LOAD ANIMATION (staggered reveal) ═══ */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.6s ease-out forwards;
}

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.25s; }
.delay-3 { animation-delay: 0.4s; }
.delay-4 { animation-delay: 0.55s; }
.delay-5 { animation-delay: 0.7s; }
.delay-6 { animation-delay: 0.85s; }
.delay-7 { animation-delay: 1s; }
.delay-8 { animation-delay: 1.15s; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 720px) {
  .page { padding: 28px 20px 48px; }

  .header {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 56px;
  }

  .header-meta { text-align: left; }
  .hero-number { letter-spacing: -3px; }
  .hero-sub { font-size: 15px; }
  .ratio-text { font-size: 20px; }
  .ticker { gap: 16px; }
  .why-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .compare-bar-wrap { max-width: 100px; }
  .compare-table { min-width: 600px; }
  .sankey-container { min-width: 600px; }

  .sq-label {
    font-size: 9px;
    padding: 0 6px;
    letter-spacing: 0;
  }

  .sq-treasury-label { display: none; } /* hide on mobile (overrides the reveal animation) */
  .legend { gap: 12px; }
  .why-title { font-size: 18px; }
  .why-desc { font-size: 14px; }
  .footer { flex-direction: column; }
}

@media (max-width: 480px) {
  .hero-number { font-size: 80px; letter-spacing: -2px; }
  .hero-word { font-size: 20px; }
  .metrics { grid-template-columns: 1fr; }
  .ticker { flex-direction: column; gap: 8px; }
  .ratio-block { padding: 40px 10px; }
}

/* ═══ REDUCED MOTION ═══ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }

  .sq-liquid-label,
  .sq-treasury-label {
    opacity: 1;
  }
}
