/* ═══════════════════════════════════════════════════════
   SPXtoSPY — Roaring 20s / Vintage Wall Street Theme
   ═══════════════════════════════════════════════════════ */

/* --- CSS Custom Properties --- */
:root {
  --dark-primary: #1A1A2E;
  --dark-secondary: #16213E;
  --gold: #C9A96E;
  --gold-bright: #D4AF37;
  --cream: #F5F0E1;
  --cream-light: #FAF3E0;
  --green: #2D6A4F;
  --red: #8B1A1A;
  --text-on-dark: #F5F0E1;
  --text-on-light: #1A1A2E;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Libre Baskerville', 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --max-width: 1200px;
  --card-border: 1px solid var(--gold);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--dark-primary);
  color: var(--text-on-dark);
  line-height: 1.7;
  min-height: 100vh;
  padding-bottom: 42px; /* reserve space for fixed ticker tape */
  /* subtle parchment-like texture via gradient */
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(22,33,62,0.6) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 50%, rgba(22,33,62,0.4) 0%, transparent 70%);
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-bright); }

img { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); }

/* ═══════════ HEADER ═══════════ */
.site-header {
  padding: 0.75rem 1rem 0.4rem;
  position: relative;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.logo a {
  text-decoration: none;
  display: inline-block;
  line-height: 1;
}

.logo-spx, .logo-spy {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--gold-bright);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.logo-to {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  color: var(--cream);
  margin: 0 0.15em;
  vertical-align: middle;
}

.tagline {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--gold);
  font-size: clamp(0.7rem, 1.4vw, 0.85rem);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.85;
}

.main-nav {
  display: flex;
  justify-content: flex-end;
  gap: 1.5rem;
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--cream);
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s, color 0.3s;
}

.nav-link:hover, .nav-link.active {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* Header decorative line */
.header-deco {
  max-width: var(--max-width);
  margin: 0.5rem auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-bright) 50%, var(--gold) 80%, transparent);
}

/* ═══════════ TICKER TAPE (Fixed Bottom) ═══════════ */
.ticker-tape {
  background:
    linear-gradient(to bottom, #E8DCC8, #F5F0E1 10%, #F5F0E1 90%, #E8DCC8);
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  overflow: hidden;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 42px;
  display: flex;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
  align-items: center;
}

/* perforated edge effect */
.ticker-tape::before,
.ticker-tape::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 30px;
  z-index: 2;
}
.ticker-tape::before {
  left: 0;
  background: linear-gradient(to right, #E8DCC8, transparent);
}
.ticker-tape::after {
  right: 0;
  background: linear-gradient(to left, #E8DCC8, transparent);
}

.ticker-track {
  display: flex;
  width: 100%;
  overflow: hidden;
}

.ticker-content {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: tickerScroll 40s linear infinite;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-on-light);
}

.ticker-item {
  padding: 0 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ticker-symbol {
  font-weight: 700;
  color: var(--dark-primary);
}

.ticker-price {
  color: #333;
}

.ticker-up { color: var(--green); }
.ticker-down { color: var(--red); }

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

/* ═══════════ SECTION HEADERS ═══════════ */
.section-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.section-header h1,
.section-header h2 {
  white-space: nowrap;
  color: var(--gold-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.deco-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ═══════════ ART DECO DIVIDERS ═══════════ */
.art-deco-divider {
  max-width: var(--max-width);
  margin: 3rem auto;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
}

.deco-fan {
  width: 120px;
  height: 40px;
  position: relative;
}

.deco-fan::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-bottom: 35px solid var(--gold);
  opacity: 0.3;
}

.deco-fan::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 25px solid var(--gold);
  opacity: 0.5;
}

.deco-chevron {
  width: 200px;
  height: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deco-chevron::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  background: var(--gold);
  opacity: 0.4;
}

.deco-chevron::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(-45deg);
  background: var(--dark-primary);
}

/* ═══════════ CONVERTER SECTION ═══════════ */
.converter-section {
  max-width: var(--max-width);
  margin: 1rem auto 2rem;
  padding: 0 1rem;
}

.converter-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.mode-toggle {
  display: flex;
  border: var(--card-border);
  overflow: hidden;
}

.mode-btn {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  padding: 0.5rem 1.5rem;
  background: transparent;
  color: var(--cream);
  border: none;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.3s, color 0.3s;
}

.mode-btn:hover {
  background: rgba(201,169,110,0.15);
}

.mode-btn.active {
  background: var(--gold);
  color: var(--dark-primary);
  font-weight: 700;
}

.market-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
  transition: background 0.3s;
}

.status-dot.open { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.closed { background: var(--red); }
.status-dot.pre-market { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

.api-notice {
  text-align: center;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  background: rgba(201,169,110,0.1);
  border: 1px solid rgba(201,169,110,0.3);
  font-size: 0.85rem;
  font-style: italic;
}

.last-updated {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  opacity: 0.8;
  margin-bottom: 1.5rem;
}

/* Converter Grid */
.converter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .converter-grid { grid-template-columns: 1fr; }
}

/* Converter Card */
.converter-card {
  background: rgba(245,240,225,0.04);
  border: var(--card-border);
  position: relative;
  padding: 0;
  transition: box-shadow 0.3s;
}

.converter-card:hover {
  box-shadow: 0 0 20px rgba(201,169,110,0.15);
}

/* Decorative corner accents */
.converter-card::before,
.converter-card::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--gold-bright);
  border-style: solid;
  border-width: 0;
}

.converter-card::before {
  top: -1px; left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.converter-card::after {
  bottom: -1px; right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(201,169,110,0.25);
}

.card-header h2 {
  font-size: 1.1rem;
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.ratio-display {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  opacity: 0.8;
}

.card-body {
  padding: 0.65rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.input-group label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 60px;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.label-sub {
  font-weight: 400;
  font-size: 0.65rem;
  color: var(--gold);
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contract-badge {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.1em 0.45em;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--dark-primary);
  background: var(--gold);
  letter-spacing: 0.03em;
  cursor: help;
  vertical-align: middle;
}

.input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  padding: 0.55rem 0.8rem;
  background: rgba(245,240,225,0.06);
  border: 1px solid rgba(201,169,110,0.3);
  color: var(--cream);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrap input::placeholder {
  color: rgba(245,240,225,0.25);
}

.input-wrap input:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 8px rgba(212,175,55,0.2);
  background: rgba(245,240,225,0.1);
}

.change-indicator {
  position: absolute;
  right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  pointer-events: none;
}

.change-indicator.up { color: var(--green); }
.change-indicator.down { color: var(--red); }

/* ═══════════ HOW IT WORKS ═══════════ */
.how-it-works {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.how-content {
  max-width: 800px;
  margin: 0 auto;
}

.callout-box {
  background: rgba(245,240,225,0.06);
  border: var(--card-border);
  border-left: 4px solid var(--gold-bright);
  padding: 1.2rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.callout-box h3 {
  font-family: var(--font-heading);
  color: var(--gold-bright);
  margin-bottom: 0.4rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.callout-box p {
  font-size: 0.95rem;
  line-height: 1.6;
}

.explanation p {
  margin-bottom: 1rem;
  font-size: 0.92rem;
  color: rgba(245,240,225,0.85);
}

/* ═══════════ ARTICLES GRID ═══════════ */
.articles-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.article-card {
  border: var(--card-border);
  background: rgba(245,240,225,0.04);
  transition: box-shadow 0.3s, transform 0.2s;
  position: relative;
}

.article-card:hover {
  box-shadow: 0 4px 20px rgba(201,169,110,0.15);
  transform: translateY(-2px);
}

/* corner accents */
.article-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 12px; height: 12px;
  border-top: 2px solid var(--gold-bright);
  border-left: 2px solid var(--gold-bright);
}

.article-card-inner {
  padding: 1.3rem 1.5rem;
}

.article-card h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.article-card h3 a {
  color: var(--gold-bright);
  transition: color 0.2s;
}

.article-card h3 a:hover {
  color: var(--cream);
}

.article-card p {
  font-size: 0.85rem;
  color: rgba(245,240,225,0.75);
  margin-bottom: 0.8rem;
  line-height: 1.6;
}

.read-more {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.read-more:hover { color: var(--gold-bright); }

.view-all-link {
  text-align: center;
  margin-top: 2rem;
}

.view-all-link a {
  font-family: var(--font-heading);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 2px;
}

.view-all-link a:hover {
  color: var(--gold-bright);
  border-bottom-color: var(--gold-bright);
}

/* ═══════════ PRODUCTS ═══════════ */
.products-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.product-card {
  border: var(--card-border);
  background: rgba(245,240,225,0.04);
  display: flex;
  gap: 1.2rem;
  padding: 1.2rem;
  transition: box-shadow 0.3s;
}

.product-card:hover {
  box-shadow: 0 4px 20px rgba(201,169,110,0.15);
}

/* Styled book cover */
.book-cover {
  flex-shrink: 0;
  width: 90px;
  height: 130px;
  position: relative;
  perspective: 400px;
}

.book-spine {
  position: absolute;
  left: 0; top: 0;
  width: 8px; height: 100%;
  background: linear-gradient(to right, #8B7355, #A08B6A);
  transform: rotateY(0deg);
  border-radius: 2px 0 0 2px;
}

.book-front {
  position: absolute;
  left: 8px; top: 0;
  width: calc(100% - 8px); height: 100%;
  background: linear-gradient(135deg, var(--dark-secondary), var(--dark-primary));
  border: 1px solid var(--gold);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  text-align: center;
}

.book-title {
  font-family: var(--font-heading);
  font-size: 0.55rem;
  color: var(--gold-bright);
  line-height: 1.3;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.book-author {
  font-family: var(--font-body);
  font-size: 0.45rem;
  color: var(--cream);
  opacity: 0.7;
}

.product-info {
  flex: 1;
}

.product-info h3 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--gold-bright);
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.product-author {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.8rem;
  color: var(--gold);
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

.product-info p:not(.product-author) {
  font-size: 0.82rem;
  color: rgba(245,240,225,0.75);
  line-height: 1.55;
  margin-bottom: 0.8rem;
}

.amazon-btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 1rem;
  border: 1px solid var(--gold);
  color: var(--gold);
  transition: background 0.3s, color 0.3s;
}

.amazon-btn:hover {
  background: var(--gold);
  color: var(--dark-primary);
}

/* ═══════════ FOOTER ═══════════ */
.site-footer {
  margin-top: 4rem;
  border-top: none;
  padding: 0;
}

.footer-deco {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-bright) 50%, var(--gold) 80%, transparent);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem 1.5rem;
  text-align: center;
}

.footer-links {
  margin-bottom: 1rem;
}

.footer-links a {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.footer-sep {
  margin: 0 0.8rem;
  color: rgba(201,169,110,0.4);
}

.footer-disclaimer {
  font-size: 0.72rem;
  color: rgba(245,240,225,0.45);
  line-height: 1.6;
  margin-bottom: 0.8rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(245,240,225,0.35);
}

/* ═══════════ MOBILE RESPONSIVE ═══════════ */
@media (max-width: 600px) {
  .site-header { padding: 0.6rem 0.5rem 0.3rem; }

  .header-inner { justify-content: center; gap: 0.5rem; }

  .logo { justify-content: center; }

  .main-nav { gap: 1.2rem; justify-content: center; width: 100%; }

  .converter-controls { flex-direction: column; gap: 0.8rem; }

  .input-group label { min-width: 50px; font-size: 0.8rem; }

  .input-wrap input { font-size: 0.95rem; padding: 0.5rem 0.6rem; }

  .product-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .book-cover { margin-bottom: 0.5rem; }

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

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

  .section-header { gap: 0.8rem; }

  .section-header h1,
  .section-header h2 { font-size: 1rem; }

  .ticker-content { animation-duration: 25s; }
}

@media (max-width: 400px) {
  .logo-spx, .logo-spy { font-size: 1.6rem; }
  .logo-to { font-size: 1rem; }
}

/* ═══════════ UTILITY ═══════════ */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
