/* Axiomsight - Main Stylesheet */
/* Extracted from inline styles for better maintainability */

/* ============================================
   CSS Variables (Design Tokens)
   ============================================ */
:root {
  /* Backgrounds */
  --bg-base: #0f0f10;
  --bg-surface: #1a1a1c;
  --bg-raised: #252527;
  --bg-overlay: rgba(255,255,255,0.03);

  /* Text Colors */
  --text-primary: #e8e6e3;
  --text-secondary: #a8a5a0;
  --text-tertiary: #6b6863;

  /* Accent Colors */
  --accent-gold: #c9a961;
  --accent-gold-muted: #8b7644;
  --accent-positive: #5fb878;
  --accent-negative: #d47560;
  --accent-neutral: #7c91a6;

  /* Glass Morphism */
  --glass-bg: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.08);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.37);
  --glass-shadow-lg: 0 16px 48px rgba(0,0,0,0.45), 0 0 1px rgba(255,255,255,0.05);

  /* Border Radius */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Additional tokens for consistency */
  --accent-error: var(--accent-negative);
  --text-muted: var(--text-tertiary);

  /* Standardized blur values */
  --glass-blur: 12px;
  --glass-blur-sm: 8px;

  /* Additional radius tokens */
  --radius-md: 14px;
  --radius-lg: 16px;

  /* Chart-specific tokens */
  --chart-height: 400px;
  --chart-bg: rgba(0,0,0,0.2);
  --chart-border: rgba(255,255,255,0.06);

  /* Animation tokens */
  --animation-reveal: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base Styles
   ============================================ */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background: #0f0f10;
  background-image: radial-gradient(ellipse at top, #1a1220 0%, #0f0f10 40%, #0f1419 100%);
  color: var(--text-primary);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.01em;
}

/* ============================================
   Typography
   ============================================ */
h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-primary);
}

h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

p {
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ============================================
   Layout
   ============================================ */
.wrap {
  max-width: 1600px;
  margin: 0 auto;
  padding: 64px 48px;
}

/* ============================================
   Header & Navigation
   ============================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15,15,16,0.85);
  backdrop-filter: blur(12px) saturate(180%);
  transition: all var(--transition-base);
}

header.scrolled {
  box-shadow: var(--glass-shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  display: none;
}

h1.brand-text {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e8e6e3 0%, #c9a961 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all var(--transition-base);
  cursor: pointer;
}

h1.brand-text:hover {
  letter-spacing: 0.32em;
}

nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur-sm));
  -webkit-backdrop-filter: blur(var(--glass-blur-sm));
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

nav a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,169,97,0.08), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

nav a:hover {
  border-color: var(--accent-gold);
  color: var(--text-primary);
  box-shadow: 0 0 20px rgba(201,169,97,0.15);
}

nav a:hover::before {
  opacity: 1;
}

/* ============================================
   Glass Cards
   ============================================ */
.glass-card {
  display: block;
  text-decoration: none;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px;
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(201,169,97,0.06), transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.glass-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201,169,97,0.2);
  box-shadow: var(--glass-shadow-lg), inset 0 1px 0 rgba(255,255,255,0.08);
}

.glass-card:hover::before {
  opacity: 1;
}

/* ============================================
   Chart Container
   ============================================ */
.chart-container {
  width: 100%;
  height: 420px;
  min-height: 360px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(var(--glass-blur-sm));
  -webkit-backdrop-filter: blur(var(--glass-blur-sm));
  transition: all var(--transition-base);
  letter-spacing: 0.02em;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(201,169,97,0.2);
  background: rgba(201,169,97,0.08);
}

.btn.active {
  border-color: var(--accent-gold);
  background: rgba(201,169,97,0.12);
  color: var(--accent-gold);
}

/* ============================================
   Tabs
   ============================================ */
.main-tabs {
  display: flex;
  gap: 0;
  margin: 24px 0;
  border-bottom: 1px solid var(--glass-border);
}

.main-tabs button {
  background: transparent;
  border: none;
  padding: 16px 32px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.main-tabs button::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-gold);
  transform: translateX(-50%);
  transition: width var(--transition-base);
}

.main-tabs button:hover {
  color: var(--text-primary);
}

.main-tabs button.active {
  color: var(--accent-gold);
  font-weight: 600;
}

.main-tabs button.active::before {
  width: 100%;
}

/* ============================================
   Utilities
   ============================================ */
.meta {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  margin: 12px 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}

/* ============================================
   Reusable Components
   ============================================ */

/* Info box component */
.info-box {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 12px 0 24px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.info-box strong {
  color: var(--text-primary);
}

/* Page intro text */
.page-intro {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
  margin: 8px 0 16px;
}

/* Toggle button group */
.toggle-group {
  display: flex;
  gap: 12px;
  margin: 28px 0 36px;
  padding: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  width: fit-content;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.toggle-group button {
  background: transparent;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition-base);
  font-family: inherit;
  letter-spacing: 0.02em;
}

.toggle-group button:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}

.toggle-group button.active {
  background: rgba(201,169,97,0.12);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-weight: 600;
}

.toggle-group button:active {
  transform: scale(0.98);
}

/* Unified chart container */
.chart-box {
  width: 100%;
  height: var(--chart-height);
  border-radius: var(--radius-sm);
  background: var(--chart-bg);
  border: 1px solid var(--chart-border);
  overflow: hidden;
}

/* Data card (for positions/momentum) */
.data-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.data-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-lg);
  border-color: rgba(255,255,255,0.12);
}

/* Card header layout */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 500;
}

.card-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Rank badge */
.rank-badge {
  background: rgba(201,169,97,0.15);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* Meta row */
.meta-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.meta-label {
  color: var(--text-secondary);
}

.meta-value {
  color: var(--accent-gold);
  font-weight: 600;
}

/* Snapshot value colors */
.snapshot-value.positive {
  color: var(--accent-positive);
}

.snapshot-value.negative {
  color: var(--accent-negative);
}

/* Loading state */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-error {
  color: var(--accent-negative);
}

/* Data grid layouts */
.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 1024px) {
  .data-grid {
    gap: 20px;
  }
  .chart-box {
    height: 380px;
  }
  .data-card {
    padding: 22px;
  }
}

@media (max-width: 768px) {
  .data-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .chart-box {
    height: 360px;
  }
  .data-card {
    padding: 20px;
  }
  .toggle-group {
    width: 100%;
    justify-content: center;
  }
  .toggle-group button {
    flex: 1;
    padding: 12px 18px;
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 540px) {
  .chart-box {
    height: 340px;
  }
  .data-card {
    padding: 16px;
  }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Reveal animation classes */
.reveal {
  opacity: 0;
  animation: fadeUp var(--animation-reveal) forwards;
}

.reveal-delay-1 { animation-delay: 0.1s; }
.reveal-delay-2 { animation-delay: 0.2s; }
.reveal-delay-3 { animation-delay: 0.3s; }
.reveal-delay-4 { animation-delay: 0.4s; }

/* Loading shimmer effect */
.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 25%,
    rgba(255,255,255,0.08) 50%,
    var(--glass-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ============================================
   Lightbox
   ============================================ */
.lb {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.24);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: saturate(105%) blur(2px);
}

.lb.show {
  display: flex;
  animation: fadeIn .12s ease-out;
}

.lb-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
}

.lb-img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border: var(--border) solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  animation: popIn .1s ease-out;
}

.lb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -34px;
  display: flex;
  justify-content: space-between;
  color: #4b5563;
  font-size: 12px;
}

.lb-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f3f4f6;
  border: var(--border) solid var(--line);
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

.lb-prev { left: -56px; }
.lb-next { right: -56px; }

.lb-close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f3f4f6;
  border: var(--border) solid var(--line);
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

@keyframes popIn {
  from { transform: scale(.992); opacity: .98; }
  to { transform: scale(1); opacity: 1; }
}

body.modal-open {
  overflow: hidden;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1400px) {
  .wrap {
    padding: 48px 32px;
    max-width: 1400px;
  }
}

@media (max-width: 1024px) {
  .wrap {
    padding: 32px 24px;
  }
  .chart-container {
    height: 380px;
    min-height: 320px;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }
  .wrap {
    padding: 24px 20px;
  }
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
  }
  h1 {
    font-size: 16px;
    letter-spacing: 0.24em;
  }
  h2 {
    font-size: 20px;
  }
  h3 {
    font-size: 16px;
  }
  .glass-card {
    padding: 24px;
  }
  .chart-container {
    height: 320px;
    min-height: 280px;
  }
  .main-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .main-tabs button {
    padding: 14px 20px;
    font-size: 13px;
    white-space: nowrap;
  }
  nav {
    gap: 8px;
  }
  nav a {
    padding: 10px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 20px 16px;
  }
  h1 {
    font-size: 15px;
    letter-spacing: 0.22em;
  }
  .glass-card {
    padding: 20px;
  }
  .main-tabs button {
    padding: 12px 16px;
    font-size: 12px;
  }
}
