/* ═══════════════════════════════════════════════════════════════════════════
   Alpha Station — Apple Aesthetic × Consulting Structure
   SF Pro feel, pill badges, soft radii, structured editorial layout
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Apple-ish palette ── */
  --bg:         #f5f5f7;
  --surface:    #ffffff;
  --surface-2:  #fafafa;
  --border:     rgba(0,0,0,0.06);
  --border-md:  rgba(0,0,0,0.10);
  --text:       #1d1d1f;
  --text2:      #6e6e73;
  --text3:      #86868b;
  --text4:      #aeaeb2;
  --green:      #34c759;
  --green-soft: rgba(52,199,89,0.10);
  --red:        #ff3b30;
  --red-soft:   rgba(255,59,48,0.10);
  --amber:      #ff9500;
  --amber-soft: rgba(255,149,0,0.10);
  --blue:       #007aff;
  --accent:     #1d1d1f;
  --gold:       #bf8a30;
  --gold-soft:  rgba(191,138,48,0.10);

  /* ── Fonts ── */
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', sans-serif;
  --font-display: 'Source Serif 4', Georgia, 'PingFang SC', serif;
  --font-mono:    'IBM Plex Mono', 'SF Mono', 'Menlo', monospace;

  /* ── Spacing ── */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;

  /* ── Radii ── */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 100px;

  /* ── Shadows (Apple soft) ── */
  --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04), 0 0 0 0.5px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.08), 0 0 0 0.5px rgba(0,0,0,0.04);

  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ═══ Reset ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ═══ Typography ═══ */
h1, h2, h3 { font-family: var(--font-display); color: var(--text); letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 700; }
.section-label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.number { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ═══ Layout ═══ */
main {
  flex: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6);
  width: 100%;
}
@media (max-width: 768px) { main { padding: var(--sp-4); } }

/* ═══ Navigation — frosted glass ═══ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
}
.nav-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand a {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.nav-accent {
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 2px 6px;
  border-radius: var(--r-pill);
  margin-left: 6px;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.nav-links {
  display: flex;
  gap: var(--sp-5);
}
.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text2);
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }
.language-toggle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text3);
  background: transparent;
  border: 1px solid var(--border-md);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.15s;
}
.language-toggle:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-md);
}

/* ═══ Page Header ═══ */
.page-header {
  text-align: center;
  padding: var(--sp-6) 0 var(--sp-3);
}
.page-header .section-label { margin-bottom: var(--sp-1); }

/* ═══ Date Picker ═══ */
.date-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0 var(--sp-5);
}
.date-picker label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.date-picker select {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 5px 12px;
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

/* ═══ Index Tiles — pill strip (consulting layout) ═══ */
.index-bar-wrapper {
  display: flex;
  gap: 0;
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.index-tile {
  flex: 1;
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
  border-right: 0.5px solid var(--border);
  transition: background 0.15s;
}
.index-tile:last-child { border-right: none; }
.index-tile:hover { background: var(--surface-2); }
.index-tile-ticker {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.index-tile-price {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
  letter-spacing: -0.02em;
}
.index-tile-change {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 1px;
}
.change-up { color: var(--green); }
.change-down { color: var(--red); }
.change-flat { color: var(--text4); }

/* ═══ Sentiment Strip — single card, compact ═══ */
.sentiment-strip {
  display: grid;
  grid-template-columns: 200px 1px 1fr;
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
  overflow: hidden;
}
.sentiment-strip .divider {
  background: var(--border);
}
.sentiment-left {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.sentiment-score {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
}
.sentiment-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 2px;
}
.sentiment-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: var(--sp-3);
  overflow: hidden;
  position: relative;
}
.sentiment-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--ease);
}
.sentiment-sublabel {
  font-size: 0.62rem;
  color: var(--text4);
  margin-top: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sentiment-right {
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.breadth-item {
  padding: var(--sp-3) var(--sp-3);
  text-align: center;
  border-bottom: 0.5px solid var(--border);
  border-right: 0.5px solid var(--border);
}
.breadth-item:nth-child(3n) { border-right: none; }
.breadth-item:nth-last-child(-n+3) { border-bottom: none; }
.breadth-item-label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.breadth-item-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
@media (max-width: 768px) {
  .sentiment-strip { grid-template-columns: 1fr; }
  .sentiment-strip .divider { height: 1px; width: 100%; }
  .sentiment-right { grid-template-columns: repeat(2, 1fr); }
  .breadth-item:nth-child(2n) { border-right: none; }
  .breadth-item:nth-child(3n) { border-right: 0.5px solid var(--border); }
}

/* ═══ Card ═══ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  border: 0.5px solid var(--border);
  transition: box-shadow 0.2s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ═══ Section Title ═══ */
.chart-title {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-4);
}

/* ═══ Gauge ═══ */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2) 0;
}
.gauge-svg { max-width: 150px; height: auto; }
.gauge-score {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}
.gauge-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* ═══ Key Insight Box (consulting style) ═══ */
.insight-box {
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-top: var(--sp-4);
}
.insight-box .section-label { color: var(--gold); margin-bottom: var(--sp-1); }
.insight-box p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.6;
}

/* ═══ Chart Container ═══ */
.chart-container {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.chart-canvas { max-height: 360px; }
.chart-attribution {
  font-size: 0.62rem;
  color: var(--text4);
  text-align: right;
  margin-top: var(--sp-2);
}

/* ═══ Heatmap Cells ═══ */
.heatmap-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}
.heatmap-cell-value-10 { background: var(--green); color: #fff; }
.heatmap-cell-value-9  { background: rgba(52,199,89,0.8); color: #fff; }
.heatmap-cell-value-8  { background: var(--green-soft); color: #1a8d3e; }
.heatmap-cell-value-7  { background: rgba(52,199,89,0.06); color: #2a9d4e; }
.heatmap-cell-value-6  { background: var(--amber-soft); color: #b37a00; }
.heatmap-cell-value-5  { background: var(--surface-2); color: var(--text3); }
.heatmap-cell-value-4  { background: rgba(255,59,48,0.05); color: #d1332a; }
.heatmap-cell-value-3  { background: rgba(255,59,48,0.10); color: #d1332a; }
.heatmap-cell-value-2  { background: rgba(255,59,48,0.18); color: #c0261d; }
.heatmap-cell-value-1  { background: var(--red); color: #fff; }
.heatmap-cell-value-0  { background: #cc2920; color: #fff; }

/* ═══ Data Table ═══ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.data-table thead { border-bottom: 2px solid var(--text); }
.data-table th {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: var(--sp-2) var(--sp-3);
  text-align: right;
}
.data-table th:first-child { text-align: left; }
.data-table td {
  padding: 0;
  text-align: right;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}
.data-table td:first-child { padding: var(--sp-2) var(--sp-3); }
.data-table td:first-child { text-align: left; font-weight: 600; color: var(--text); }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.table-ticker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}

/* ═══ Stock Cards ═══ */
.stock-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
@media (max-width: 960px) { .stock-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stock-cards { grid-template-columns: 1fr; } }

.stock-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--surface);
  border-radius: var(--r-md);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  color: inherit;
}
.stock-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stock-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.stock-card-ticker {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}
.stock-card-name { font-size: 0.68rem; color: var(--text3); margin-top: 1px; }
.stock-card-change {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
}
.stock-card-indicators {
  display: flex;
  gap: var(--sp-4);
  font-size: 0.75rem;
}
.indicator { display: flex; gap: var(--sp-2); align-items: center; }
.indicator-label { color: var(--text3); font-size: 0.65rem; font-weight: 500; }
.indicator-value { font-family: var(--font-mono); font-weight: 600; font-size: 0.72rem; color: var(--text); }
.stock-card-rating {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 0.5px solid var(--border);
  margin-top: auto;
}
.rating-score { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; color: var(--gold); }
.rating-label { font-size: 0.62rem; color: var(--text4); }

/* ═══ Summary Card ═══ */
.summary-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  border-left: 3px solid var(--gold);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-5);
}
.summary-card-title { font-size: 0.68rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-2); }
.summary-card-text { font-size: 0.88rem; line-height: 1.6; }

/* ═══ Rating Slider ═══ */
.rating-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-md);
  outline: none;
}
.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.rating-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: none;
}
.rating-display { display: flex; align-items: baseline; gap: var(--sp-3); margin-top: var(--sp-3); }
.rating-avg { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; }
.rating-avg-bullish { color: var(--green); }
.rating-avg-neutral { color: var(--amber); }
.rating-avg-bearish { color: var(--red); }
.rating-count { font-size: 0.72rem; color: var(--text3); }
.rating-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: var(--sp-2); }
.rating-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s var(--ease); }

/* ═══ Buttons ═══ */
.btn-primary {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--text);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══ Footer ═══ */
footer {
  background: var(--text);
  color: rgba(255,255,255,0.45);
  padding: var(--sp-6) var(--sp-6);
  font-size: 0.68rem;
  line-height: 1.7;
  text-align: center;
  margin-top: auto;
}
.footer-disclaimer { margin-bottom: var(--sp-2); }
.footer-links { display: flex; justify-content: center; gap: var(--sp-5); margin-top: var(--sp-3); }
.footer-links a { color: rgba(255,255,255,0.35); transition: color 0.15s; }
.footer-links a:hover { color: rgba(255,255,255,0.7); }

/* ═══ Date Navigation ═══ */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0 var(--sp-5);
}
.date-center { text-align: center; }
.date-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.date-select {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text3);
  background: transparent;
  border: none;
  cursor: pointer;
  margin-top: 2px;
  outline: none;
}
.date-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.date-arrow:hover { background: var(--text); color: #fff; border-color: var(--text); }
.date-arrow:disabled { opacity: 0.25; cursor: not-allowed; }
.date-arrow:disabled:hover { background: var(--surface); color: var(--text2); border-color: var(--border); }

/* ═══ Loading Skeleton ═══ */
.skeleton-strip {
  background: linear-gradient(90deg, var(--border-lt) 25%, rgba(255,255,255,0.6) 50%, var(--border-lt) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease infinite;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══ Chart Header ═══ */
.chart-header {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.chart-subtitle {
  font-size: 0.65rem;
  color: var(--text4);
}

/* ═══ Mobile Hamburger ═══ */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
@media (max-width: 640px) {
  .nav-hamburger { display: block; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    background: rgba(10,22,40,0.97);
    backdrop-filter: blur(20px);
    padding: var(--sp-4) var(--sp-6);
    gap: var(--sp-3);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: 99;
  }
  .language-toggle { display: none; }
  .nav-links.open .language-toggle { display: block; }
}

/* ═══ Footer (refined) ═══ */
.footer-content {
  max-width: 1120px;
  margin: 0 auto;
}
.footer-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
  font-size: 0.65rem;
}
.footer-meta a { color: rgba(255,255,255,0.4); transition: color 0.15s; }
.footer-meta a:hover { color: rgba(255,255,255,0.7); }
.footer-meta span { color: rgba(255,255,255,0.2); }
.footer-copyright {
  margin-top: var(--sp-3);
  font-size: 0.6rem;
  opacity: 0.3;
}

/* ═══ Nav active link ═══ */
.nav-links a.active {
  color: rgba(255,255,255,0.95);
  font-weight: 600;
}

/* ═══ Print ═══ */
@media print {
  .nav, footer { display: none; }
  .card, .chart-container { box-shadow: none; border: 1px solid #ddd; }
}
