/* ============================================================
   CHART.CSS — Nonchalant Coin Chart Page
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;800&family=DM+Serif+Display:ital@1&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface2: #171717;
  --text: #E0DDD8;
  --text-dim: rgba(224,221,216,0.45);
  --text-muted: rgba(224,221,216,0.22);
  --border: rgba(224,221,216,0.08);
  --border-strong: rgba(224,221,216,0.16);
  --accent: #E2FF4A;
  --accent-dim: rgba(226,255,74,0.08);
}

/* ============================================================
   GLOBAL RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Grain texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  opacity: 0.025;
  mix-blend-mode: overlay;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .sr {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.65s ease, transform 0.65s ease;
  }
  .sr.in {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 56px;
  background: rgba(10,10,10,0.9);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

@supports (backdrop-filter: blur(1px)) {
  .navbar {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    background: rgba(10,10,10,0.75);
  }
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-link {
  display: flex;
  align-items: baseline;
  text-decoration: none;
}

.logo-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--text);
}

.logo-coin {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.nav-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  transition: color 0.2s;
  cursor: pointer;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link-active {
  color: var(--accent) !important;
}

.nav-cta {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent);
  cursor: pointer;
}

.blink {
  animation: blink 1.1s step-end infinite;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 1px;
  background: var(--text);
}

/* ============================================================
   MOBILE NAV OVERLAY
   ============================================================ */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 32px 48px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.nav-open .nav-overlay {
  opacity: 1;
  visibility: visible;
}

body.nav-open {
  overflow: hidden;
}

.nav-overlay-link {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(36px, 10vw, 56px);
  letter-spacing: 0.05em;
  color: var(--text);
  cursor: pointer;
  line-height: 1.1;
}

.nav-overlay-active {
  color: var(--accent);
}

.nav-overlay-close {
  position: absolute;
  top: 24px;
  right: 32px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
}

.overlay-cta {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
}

.overlay-cta .nav-cta {
  font-size: 13px;
  letter-spacing: 0.15em;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.chart-header {
  padding-top: 56px;
}

.chart-header .container {
  padding-top: 80px;
  padding-bottom: 40px;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 32px;
}

.chart-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.chart-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 8vw, 88px);
  line-height: 0.9;
  color: var(--text);
}

/* CA Meta block */
.ca-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding-bottom: 8px;
}

.ca-meta[hidden] {
  display: none;
}

.ca-meta-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.ca-meta-address {
  display: flex;
  align-items: center;
  gap: 0;
}

#ca-truncated {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

#copy-ca-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 10px;
  padding: 0;
  transition: opacity 0.15s;
}

#copy-ca-btn:hover {
  opacity: 0.7;
}

.ca-meta-chain {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

.chart-divider {
  border-top: 1px solid var(--border);
  margin-top: 28px;
}

/* ============================================================
   STATS BAR
   ============================================================ */
.chart-wrapper[hidden] {
  display: none;
}

#chart-wrapper[hidden],
#chart-placeholder[hidden] {
  display: none !important;
}

.stats-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  padding: 20px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  padding: 0 32px;
  border-right: 1px solid var(--border);
}

.stat-item:first-child {
  padding-left: 0;
}

.stat-item:last-child {
  border-right: none;
}

.stat-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  display: block;
  margin-bottom: 6px;
}

.stat-value {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  display: block;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
  width: 100%;
  height: 700px;
  border: 1px solid var(--border-strong);
  border-top: none;
  background: var(--surface);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chart-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  position: absolute;
  inset: 0;
}

#chart-iframe[hidden] {
  display: none;
}

/* Chart loading state */
.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.chart-loading-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.2em;
}

.chart-loading-line {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(224,221,216,0.16) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  display: block;
}

/* Chart error state */
.chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding: 32px;
}

.chart-error[hidden] {
  display: none;
}

.chart-error-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
}

.chart-error-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}

#chart-retry-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 10px 20px;
  cursor: pointer;
  margin-top: 8px;
  transition: color 0.15s, border-color 0.15s;
}

#chart-retry-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Chart caption */
.chart-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.chart-caption span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.12em;
}

/* ============================================================
   NO CA PLACEHOLDER
   ============================================================ */
.chart-placeholder {
  padding-bottom: 120px;
}

.chart-placeholder[hidden] {
  display: none;
}

.placeholder-inner {
  width: 100%;
  min-height: 60vh;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 48px;
}

.placeholder-line {
  width: 60px;
  height: 1px;
  background: var(--border-strong);
  display: block;
}

.placeholder-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 44px);
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.02em;
}

.placeholder-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-align: center;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 0;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.footer-logo .logo-name {
  color: var(--text);
  font-size: 13px;
}

.footer-logo .logo-coin {
  color: var(--accent);
  font-size: 13px;
}

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--text);
}

.footer-disclaimer {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* ============================================================
   RESPONSIVE — 1100px
   ============================================================ */
@media (max-width: 1100px) {
  .stat-item {
    padding: 0 20px;
  }
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
  /* Nav */
  .nav-links {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .container {
    padding: 0 24px;
  }

  .navbar-inner {
    padding: 0 24px;
  }

  /* Header */
  .chart-header .container {
    padding-top: 48px;
    padding-bottom: 28px;
  }

  .chart-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .ca-meta {
    align-items: flex-start;
  }

  /* Stats bar — 2x2 grid */
  .stats-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }

  .stat-item {
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stat-item:nth-child(1),
  .stat-item:nth-child(3) {
    border-right: 1px solid var(--border);
  }

  .stat-item:nth-child(3),
  .stat-item:nth-child(4) {
    border-bottom: none;
  }

  .stat-item:first-child {
    padding-left: 16px;
  }

  .stat-value {
    font-size: 15px;
  }

  /* Chart */
  .chart-container {
    height: 600px;
  }

  /* Footer */
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .footer-nav {
    gap: 16px;
  }
}

/* ============================================================
   MEME POPUP
   ============================================================ */
.meme-popup {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.meme-popup.open {
  opacity: 1;
  visibility: visible;
}
.meme-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,0.92);
  cursor: pointer;
}
.meme-popup-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 56px 48px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}
.meme-popup-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.meme-popup-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 8vw, 72px);
  line-height: 0.9;
  color: var(--text);
  margin-bottom: 28px;
}
.meme-popup-body {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.8;
  margin-bottom: 32px;
}
.meme-popup-line {
  width: 40px;
  height: 1px;
  background: var(--border-strong);
  margin: 0 auto 20px;
}
.meme-popup-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 36px;
}
.meme-popup-close {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 10px 24px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.meme-popup-close:hover {
  color: var(--text);
  border-color: var(--accent);
}
@media (max-width: 768px) {
  .meme-popup-box {
    padding: 40px 28px;
  }
}