:root {
  --bg0: #061018;
  --bg1: #0b1c28;
  --ink: #e8f1f4;
  --muted: #8aa0ab;
  --line: rgba(232, 241, 244, 0.12);
  --accent: #2fd6a8;
  --accent-dim: rgba(47, 214, 168, 0.18);
  --warm: #f0b429;
  --down: #ff6b6b;
  --up: #2fd6a8;
  --font-brand: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(47, 214, 168, 0.16), transparent 55%),
    radial-gradient(900px 600px at 90% 8%, rgba(240, 180, 41, 0.1), transparent 50%),
    linear-gradient(165deg, var(--bg0) 0%, var(--bg1) 48%, #07141f 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: drift 18s var(--ease) infinite alternate;
}

.orb-a {
  width: 42vw;
  height: 42vw;
  left: -8%;
  top: 18%;
  background: rgba(47, 214, 168, 0.22);
}

.orb-b {
  width: 36vw;
  height: 36vw;
  right: -10%;
  top: -5%;
  background: rgba(56, 140, 180, 0.28);
  animation-delay: -6s;
  animation-duration: 22s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, 6%, 0) scale(1.08); }
}

.topbar,
main,
.foot {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  animation: rise 0.9s var(--ease) both;
}

.brand-mark {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 22, 32, 0.45);
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(47, 214, 168, 0.55);
  animation: pulse 2s ease-out infinite;
}

.live-pill.stale .live-dot {
  background: var(--warm);
  animation: none;
}

.live-pill.err .live-dot {
  background: var(--down);
  animation: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 214, 168, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(47, 214, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 214, 168, 0); }
}

.source-link {
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.source-link:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.hero {
  min-height: calc(100vh - 5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 6vh, 4rem) clamp(1.25rem, 4vw, 3rem) 4rem;
  max-width: 1100px;
}

.hero-brand {
  margin: 0 0 1.5rem;
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: clamp(4.5rem, 14vw, 9.5rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  background: linear-gradient(120deg, #f4fbf8 10%, var(--accent) 55%, var(--warm) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise 1s var(--ease) 0.05s both;
}

.hero-title {
  margin: 0;
  max-width: 14ch;
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  animation: rise 1s var(--ease) 0.18s both;
}

.hero-sub {
  margin: 1.1rem 0 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.65;
  animation: rise 1s var(--ease) 0.28s both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  animation: rise 1s var(--ease) 0.38s both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s;
}

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

.btn.primary {
  background: var(--accent);
  color: #042018;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
}

.hero-stamp {
  margin-top: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  animation: rise 1s var(--ease) 0.48s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

section {
  padding: 4.5rem clamp(1.25rem, 4vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
}

.section-head {
  margin-bottom: 1.75rem;
}

.section-head.row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-brand);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.tenor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  overflow: hidden;
}

.tenor {
  background: rgba(7, 20, 31, 0.72);
  padding: 1.35rem 1.2rem 1.25rem;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background 0.3s;
  animation: rise 0.8s var(--ease) both;
}

.tenor:hover {
  background: rgba(12, 34, 48, 0.9);
}

.tenor-name {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tenor-value {
  margin-top: 1.2rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  letter-spacing: -0.03em;
  tabular-nums: true;
  font-variant-numeric: tabular-nums;
}

.tenor-delta {
  margin-top: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tenor-delta.up { color: var(--up); }
.tenor-delta.down { color: var(--down); }
.tenor-delta.flat { color: var(--muted); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.select-wrap select {
  appearance: none;
  min-width: 8.5rem;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 14px) calc(50% - 2px) / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 10px) calc(50% - 2px) / 6px 6px no-repeat,
    rgba(8, 22, 32, 0.7);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}

.select-wrap select:focus {
  outline: 1px solid var(--accent);
}

.chart-stage {
  position: relative;
  height: min(420px, 58vh);
  padding: 1rem 0.5rem 0.5rem;
  border-top: 1px solid var(--line);
}

.chart-stage.short {
  height: min(320px, 45vh);
}

.foot {
  padding: 2.5rem clamp(1.25rem, 4vw, 3rem) 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.foot a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
}

.foot a:hover {
  border-bottom-color: var(--accent);
}

.foot .muted {
  opacity: 0.75;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .tenor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: auto;
    padding-top: 2.5rem;
    padding-bottom: 3rem;
  }

  .tenor-grid {
    grid-template-columns: 1fr 1fr;
  }

  .source-link {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
