/* ─── Variables ─────────────────────────────────────────────── */
:root {
  --bg-0: #04070f;
  --bg-1: #080d1a;
  --bg-2: #0d1528;
  --bg-card: #111d35;
  --bg-glass: rgba(13, 21, 40, 0.72);

  --gold: #c9943a;
  --gold-bright: #f0c04a;
  --gold-dim: rgba(201, 148, 58, 0.18);
  --silver: #9aa8c0;
  --silver-dim: rgba(154, 168, 192, 0.15);
  --blue-accent: #1c3560;
  --blue-mid: #2a4a80;
  --blue-glow: rgba(42, 74, 128, 0.4);

  --text-primary: #e4eaf5;
  --text-secondary: #7a8faf;
  --text-muted: #4a5a72;

  --border-gold: rgba(201, 148, 58, 0.28);
  --border-silver: rgba(154, 168, 192, 0.12);

  --shadow-gold: 0 0 28px rgba(201, 148, 58, 0.22), 0 0 60px rgba(201, 148, 58, 0.08);
  --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.55), 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-text: 0 2px 12px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --transition-fade: opacity 0.7s ease, transform 0.7s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-0);
  color: var(--text-primary);
  font-family: 'Georgia', 'Times New Roman', serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── Background decoration ────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(28, 53, 96, 0.35) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 10% 90%, rgba(201, 148, 58, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 30% 30% at 90% 15%, rgba(42, 74, 128, 0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Subtle grid overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(154, 168, 192, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 168, 192, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Layout wrapper ────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Header ────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border-gold);
  gap: 12px;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-title {
  font-family: 'Georgia', serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: var(--shadow-gold);
  line-height: 1;
}

.brand-subtitle {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.clock {
  font-family: 'Courier New', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
  text-shadow: var(--shadow-gold);
  line-height: 1;
}

.clock-date {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Ticker bar ────────────────────────────────────────────── */
.ticker-bar {
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-silver);
  position: relative;
}

.ticker-bar::before,
.ticker-bar::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40px;
  z-index: 2;
}
.ticker-bar::before { left: 0; background: linear-gradient(90deg, var(--bg-0), transparent); }
.ticker-bar::after  { right: 0; background: linear-gradient(-90deg, var(--bg-0), transparent); }

.ticker-track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: ticker-scroll 32s linear infinite;
  will-change: transform;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.ticker-sym { color: var(--silver); font-weight: 700; }
.ticker-val { color: var(--text-primary); }
.ticker-chg.up   { color: #4ade80; }
.ticker-chg.down { color: #f87171; }

/* ─── Main content ──────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 0 24px;
  gap: 28px;
}

/* ─── Quote counter row ─────────────────────────────────────── */
.quote-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.quote-index {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.category-tag {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
}

/* ─── Chart decoration strip ────────────────────────────────── */
.chart-strip {
  width: 100%;
  height: 56px;
  opacity: 0.55;
  filter: drop-shadow(0 0 6px rgba(201, 148, 58, 0.3));
}

/* ─── Quote card ────────────────────────────────────────────── */
.quote-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 52px 56px 44px;
  position: relative;
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(240, 192, 74, 0.07);
  overflow: hidden;
}

.quote-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--gold) 30%, var(--gold-bright) 50%, var(--gold) 70%, transparent 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.quote-card::after {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 80px;
  background: radial-gradient(ellipse at 50% 0%, rgba(201, 148, 58, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Large decorative quotation mark */
.quote-mark {
  position: absolute;
  top: 20px;
  left: 32px;
  font-family: Georgia, serif;
  font-size: 9rem;
  line-height: 1;
  color: var(--gold-dim);
  pointer-events: none;
  user-select: none;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.quote-inner {
  position: relative;
  z-index: 1;
}

/* Quote text — fade wrapper */
.quote-fade {
  opacity: 1;
  transform: translateY(0);
  transition: var(--transition-fade);
  will-change: opacity, transform;
}

.quote-fade.exiting {
  opacity: 0;
  transform: translateY(-12px);
}

.quote-fade.entering {
  opacity: 0;
  transform: translateY(12px);
}

.quote-text {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: clamp(1.45rem, 3.2vw, 2.15rem);
  line-height: 1.55;
  color: var(--text-primary);
  text-shadow: var(--shadow-text);
  font-style: italic;
  letter-spacing: 0.01em;
  margin-bottom: 32px;
}

/* Decorative rule before attribution */
.attribution-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.attribution-rule::before,
.attribution-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold));
}
.attribution-rule::after {
  background: linear-gradient(-90deg, transparent, var(--border-gold));
}

.attribution-diamond {
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(201, 148, 58, 0.6);
}

.quote-author {
  font-family: 'Courier New', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(240, 192, 74, 0.3);
}

.quote-context {
  font-family: 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-top: 6px;
  text-transform: uppercase;
}

/* ─── Navigation row ────────────────────────────────────────── */
.nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.nav-btn {
  background: var(--bg-2);
  border: 1px solid var(--border-silver);
  border-radius: var(--radius-md);
  color: var(--silver);
  cursor: pointer;
  padding: 10px 22px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s, transform 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.nav-btn:active { transform: translateY(0); }

.nav-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.nav-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
  transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.nav-dot.active {
  background: var(--gold-bright);
  transform: scale(1.35);
  box-shadow: 0 0 6px rgba(240, 192, 74, 0.7);
}

/* ─── Footer / Timer ────────────────────────────────────────── */
.footer {
  padding: 16px 0 24px;
  border-top: 1px solid var(--border-silver);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.timer-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timer-label {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-icon {
  width: 16px;
  height: 16px;
  color: var(--gold);
  flex-shrink: 0;
}

.timer-value {
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  text-shadow: 0 0 16px rgba(240, 192, 74, 0.35);
}

/* Progress bar */
.progress-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.progress-label {
  font-family: 'Courier New', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.progress-bar-wrap {
  width: 180px;
  height: 4px;
  background: var(--border-silver);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 99px;
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(240, 192, 74, 0.5);
}

.footer-brand {
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  opacity: 0.5;
  display: none;
}

/* ─── Animated sparkline in footer ──────────────────────────── */
.sparkline {
  height: 28px;
  opacity: 0.35;
}

/* ─── Pulse effect on clock colon ───────────────────────────── */
.clock-colon {
  animation: blink-colon 1s step-end infinite;
}
@keyframes blink-colon {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

/* ─── Loading state ─────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-icon {
  width: 64px;
  height: 64px;
  animation: spin-glow 1.5s ease-in-out infinite;
  will-change: transform, filter;
}

@keyframes spin-glow {
  0%   { transform: rotate(0deg);   filter: drop-shadow(0 0 8px rgba(201,148,58,0.4)); }
  50%  { transform: rotate(180deg); filter: drop-shadow(0 0 20px rgba(240,192,74,0.8)); }
  100% { transform: rotate(360deg); filter: drop-shadow(0 0 8px rgba(201,148,58,0.4)); }
}

.loading-text {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  animation: pulse-text 1.5s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1; }
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  .app { padding: 0 14px; }

  .quote-card {
    padding: 40px 24px 34px;
  }

  .quote-mark {
    font-size: 6rem;
    top: 10px;
    left: 16px;
  }

  .brand-title { font-size: 0.95rem; }
  .clock { font-size: 1.25rem; }
  .timer-value { font-size: 1.05rem; }

  .progress-bar-wrap { width: 110px; }

  .footer {
    flex-wrap: wrap;
    gap: 14px;
  }

  .progress-section { align-items: flex-start; }

  .nav-dots { display: none; }

  .nav-btn {
    padding: 13px 18px;
    min-height: 44px;
  }
}

@media (max-width: 440px) {
  .quote-card { padding: 32px 18px 28px; }
  .brand-subtitle { display: none; }
  .ticker-bar { display: none; }
}

@media (max-width: 380px) {
  .app { padding: 0 10px; }
  .header { gap: 8px; }
  .brand-icon { width: 32px; height: 32px; }
  .brand-title { font-size: 0.8rem; letter-spacing: 0.12em; }
  .clock { font-size: 1rem; letter-spacing: 0.04em; }
  .clock-date { font-size: 0.62rem; }
  .quote-card { padding: 28px 14px 22px; }
  .quote-mark { font-size: 5rem; top: 8px; left: 10px; }
  .timer-value { font-size: 0.95rem; }
  .progress-bar-wrap { width: 90px; }
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--blue-accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
