/* ═══════════════════════════════════════════════════════════════
   shared.css — Styles shared across all warflash pages
   (theme, header, podcast, section labels, crystal ball)
   ═══════════════════════════════════════════════════════════════ */

/* -- THEME VARIABLES -- */
:root, .wb-root[data-theme="dark"] {
  --wb-bg: #07061A;
  --wb-surface: #0E0D24;
  --wb-card: #14122D;
  --wb-cardLo: #100F28;
  --wb-border: #272545;
  --wb-borderHi: #32305A;
  --wb-inset: #1C1A38;
  --wb-text1: #F1F5F9;
  --wb-text2: #CBD5E1;
  --wb-text3: #8B9DB8;
  --wb-text4: #59657A;

  /* Typography scale */
  --fs-micro: 9px;
  --fs-label: 11px;
  --fs-label-lg: 12px;
  --fs-body-sm: 13px;
  --fs-body: 14px;
  --fs-body-lg: 15px;
  --fs-heading-sm: 16px;
  --fs-heading-md: 20px;
  --fs-heading-lg: 24px;
  --fs-hero-sm: 28px;
  --fs-hero-md: 40px;
  --fs-hero-lg: 56px;

  /* Card tokens */
  --card-accent-width: 3px;
  --card-padding: 14px 16px;
  --card-gap: 8px;
  --brand: #0DBF65;
}
.wb-root[data-theme="light"] {
  --wb-bg: #F0F1F4;
  --wb-surface: #FFFFFF;
  --wb-card: #FFFFFF;
  --wb-cardLo: #FFFFFF;
  --wb-border: #D8DDE4;
  --wb-borderHi: #C0C8D2;
  --wb-inset: #E8EAF0;
  --wb-text1: #1A1D23;
  --wb-text2: #374151;
  --wb-text3: #4B5563;
  --wb-text4: #6B7280;
}

/* -- RESETS -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-padding-top: 170px; }

.wb-root {
  background: var(--wb-bg);
  color: var(--wb-text2);
  font-family: 'Open Sans', 'Open Sans Fallback';
  direction: rtl;
  min-height: 100vh;
  padding: 20px 18px 40px;
  position: relative;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.wb-inner { max-width: 1080px; margin: 0 auto; }

/* -- THEME TOGGLE -- */
.theme-toggle {
  background: var(--wb-cardLo);
  border: 1px solid var(--wb-border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: var(--fs-heading-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--wb-borderHi); }

/* -- HEADER -- */
.hdr {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  position: relative;
}
.hdr-right-col {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.hdr-logo { line-height: 0; }
.hdr-logo img { display: block; max-width: 280px; height: auto; margin-right: -12px; }
.hdr-logo .logo-light { display: none !important; }
.wb-root[data-theme="light"] .hdr-logo .logo-dark { display: none !important; }
.wb-root[data-theme="light"] .hdr-logo .logo-light { display: block !important; }
.hdr-left-col {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body-sm);
  color: var(--wb-text4);
  padding-top: 4px;
}
.show-mobile { display: none; }

/* -- TYPEWRITER -- */
.typewriter-wrap {
  direction: rtl;
  font-weight: 800;
  font-size: large;
  color: var(--wb-text1);
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
.typewriter-text { display: inline; }
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--brand);
  margin-right: 2px;
  vertical-align: middle;
  animation: cursor-blink 0.7s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* -- SECTION LABEL -- */
.sec-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  margin-top: 22px;
}
.sticky-top + .sec-label { margin-top: 0; }
.sec-label:first-child { margin-top: 0; }
.sec-label-text {
  font-size: 11px;
  font-weight: 800;
  font-family: 'Open Sans', 'Open Sans Fallback';
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--wb-text1);
}
.sec-label-bar {
  width: 3px; height: 20px; border-radius: 2px;
  background: var(--brand);
  flex-shrink: 0;
}
.sec-top-link {
  margin-right: auto; font-size: 10px; font-weight: 600;
  color: var(--wb-text3); text-decoration: none; white-space: nowrap;
}
.sec-top-link:hover { color: var(--wb-text1); text-decoration: underline; }

/* -- STICKY TOP BAR -- */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--wb-bg);
  padding-top: 20px;
  padding-bottom: 2px;
  margin: -20px -18px 0;
  padding-inline: 18px;
}
@media (max-width: 600px) {
  .sticky-top {
    padding-top: 14px;
    margin: -14px -10px 0;
    padding-inline: 10px;
  }
}

/* -- PODCAST PLAYER -- */
.podcast-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--wb-card);
  border: 1px solid var(--wb-border);
  border-radius: 8px;
  margin-bottom: 10px;
  direction: rtl;
}
.podcast-bar .podcast-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: #0DBF65; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity .15s;
}
.podcast-bar .podcast-play:hover { opacity: .85; }
.podcast-bar .podcast-play svg { width: 16px; height: 16px; fill: #07061A; }
.podcast-bar .podcast-middle {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
}
.podcast-bar .podcast-label {
  font-size: var(--fs-label); font-weight: 700; color: var(--wb-text1);
  display: flex; align-items: center; gap: 6px;
}
.podcast-bar .podcast-date {
  font-size: var(--fs-label); font-weight: 400; color: var(--wb-text3);
}
.podcast-bar .podcast-progress-wrap {
  width: 100%; height: 4px; background: var(--wb-border);
  border-radius: 2px; cursor: pointer; position: relative;
}
.podcast-bar .podcast-progress-fill {
  height: 100%; background: #0DBF65; border-radius: 2px;
  width: 0%; transition: width .1s linear;
}
.podcast-bar .podcast-time {
  font-size: var(--fs-micro); color: var(--wb-text3);
  font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0;
  direction: ltr;
}
.podcast-bar .podcast-speed {
  font-size: var(--fs-micro); font-weight: 700; color: var(--wb-text3);
  background: var(--wb-surface); border: 1px solid var(--wb-border);
  border-radius: 4px; padding: 2px 6px; cursor: pointer;
  flex-shrink: 0; white-space: nowrap;
}
.podcast-bar .podcast-speed:hover { color: var(--wb-text1); border-color: var(--wb-borderHi); }
.podcast-bar .podcast-skip {
  width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; padding: 0; color: var(--wb-text3); transition: color .15s;
}
.podcast-bar .podcast-skip:hover { color: var(--wb-text1); }
.podcast-bar .podcast-skip svg { width: 18px; height: 18px; }
@media (max-width: 600px) {
  .podcast-bar { gap: 8px; padding: 8px 10px; }
  .podcast-bar .podcast-play { width: 32px; height: 32px; }
  .podcast-bar .podcast-skip svg { width: 16px; height: 16px; }
}

/* -- AI DISCLAIMER BANNER -- */
.ai-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px;
  margin-bottom: 10px;
  font-size: var(--fs-label);
  border-radius: 0;
  direction: rtl;
  text-align: center;
  line-height: 1.4;
  overflow: hidden;
  color: var(--wb-text3);
  background: rgba(255,193,7,0.08);
  border-bottom: 1px solid rgba(255,193,7,0.15);
}
.wb-root[data-theme="light"] .ai-banner {
  background: rgb(12,138,81);
  color: #fff;
  border-bottom: none;
}
.ai-banner-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; padding-inline-end: 20px; }
.ai-banner-x {
  cursor: pointer;
  font-size: 13px;
  color: var(--wb-text4);
  opacity: 0.6;
  padding: 0 4px;
  flex-shrink: 0;
}
.ai-banner-x:hover { opacity: 1; }
.wb-root[data-theme="light"] .ai-banner-x { color: #fff; }

/* -- CRYSTAL BALL -- */
.cb-section {
  background: linear-gradient(135deg, #1a0f2e 0%, #0d0a1a 50%, #130e22 100%);
  border: 1px solid #2d1f4e;
  border-radius: 12px;
  padding: 20px 18px;
  margin-bottom: 16px;
  direction: rtl;
}
.cb-disclaimer {
  font-size: var(--fs-label);
  color: #8b7aad;
  text-align: center;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}
.cb2-period {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  direction: rtl;
  padding-bottom: 24px;
  gap: 8px 0;
  position: relative;
}
.cb2-period:last-child { padding-bottom: 0; }
.cb2-period-header {
  grid-column: 1 / -1;
  text-align: center;
  margin-bottom: 6px;
  padding: 6px 0;
  background: #0d0a1a;
}
.cb2-period-title {
  font-size: var(--fs-heading-sm);
  font-weight: 800;
  color: #c4a6ff;
  letter-spacing: 0.5px;
}
.cb2-period-dates {
  font-size: var(--fs-label);
  color: #8b7aad;
  margin-top: 2px;
}
.cb2-narrative {
  font-size: var(--fs-body);
  color: #d4c8ef;
  line-height: 1.75;
  padding-left: 16px;
  align-self: start;
  direction: rtl;
  text-align: right;
}
.cb2-period::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: #3d2a6e;
  z-index: 0;
}
.cb2-event-date, .cb2-period-header, .cb2-narrative, .cb2-event-text {
  z-index: 1;
  position: relative;
}
.cb2-event-date {
  background: #1a0f2e;
  color: #d4b8ff;
  font-size: var(--fs-label);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
  border: 1px solid rgba(176, 122, 255, 0.3);
  align-self: center;
  margin: 0 6px;
}
.cb2-event-text {
  color: #c4b4e0;
  font-size: var(--fs-body-sm);
  line-height: 1.4;
  direction: rtl;
  padding-right: 12px;
  align-self: center;
}
.cb2-event-text a {
  color: #b07aff;
  text-decoration: none;
  border-bottom: 1px dotted rgba(176, 122, 255, 0.4);
}
.cb2-event-text a:hover {
  color: #d4b8ff;
  border-bottom-color: #d4b8ff;
}
.cb2-bet-badge {
  display: inline-block;
  font-size: var(--fs-label);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  margin-right: 10px;
  white-space: nowrap;
}
.cb2-bet-yes {
  background: rgba(22, 163, 74, 0.15);
  color: #4ade80;
  border: 1px solid rgba(22, 163, 74, 0.3);
}
.cb2-bet-no {
  background: rgba(229, 62, 62, 0.15);
  color: #f87171;
  border: 1px solid rgba(229, 62, 62, 0.3);
}
.cb-source {
  font-size: var(--fs-label);
  color: #6b5a8e;
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2d1f4e;
}
.cb-source a { text-decoration: none; }
.cb-source a:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .cb-section { padding: 14px 12px; }
  .cb2-period {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cb2-narrative { padding-left: 0; margin-bottom: 12px; grid-row: auto !important; }
  .cb2-event-date { display: none; }
  .cb2-period::before { display: none; }
  .cb2-event-text { padding-right: 0; }
  .cb2-period::after { display: none; }
}

/* -- FOOTER -- */
.footer {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--wb-border);
  font-size: var(--fs-label-lg);
  color: var(--wb-text4);
  text-align: center;
  line-height: 1.8;
  direction: ltr;
}
.footer a {
  color: var(--wb-text3);
  text-decoration: none;
  border-bottom: 1px dotted var(--wb-text4);
  transition: color .15s;
}
.footer a:hover { color: var(--wb-text1); }
.footer-sources {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin-bottom: 6px;
}

/* -- SHARED MOBILE -- */
@media (max-width: 480px) {
  :root, .wb-root, .wb-root[data-theme="dark"], .wb-root[data-theme="light"] {
    --fs-micro: 10px;
    --fs-label: 11px;
    --fs-label-lg: 14px;
    --fs-body-sm: 15px;
    --fs-body: 15px;
    --fs-body-lg: 17px;
    --fs-heading-sm: 18px;
    --fs-heading-md: 18px;
    --fs-hero-md: 30px;
    --fs-hero-lg: 42px;
  }
  html { font-size: 16px; }
  .wb-root { padding: 14px 10px 30px; }

  .hdr { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 4px; }
  .hdr-right-col { flex-direction: row; align-items: center; gap: 6px; }
  .hdr-logo img { max-width: 140px; height: auto; }
  .hdr-left-col { margin-right: auto; font-size: x-small; }
  .ai-banner { font-size: var(--fs-micro); padding: 4px 6px; margin-bottom: 10px; margin-top: 0; margin-inline: 0; gap: 4px; }
  .ai-banner-x { font-size: 11px; padding: 0 2px; }
  .edition-label { display: none; }
  .hide-mobile { display: none; }
  .show-mobile { display: inline; }
}
