@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Tokens ──────────────────────────────────────────────────────────────── */

:root {
  --bg:          #0D0D0D;
  --bg-card:     #131313;
  --bg-card-alt: #161616;
  --border:      #1f1f1f;
  --border-mid:  #2a2a2a;
  --gold:        #C9A84C;
  --gold-dim:    rgba(201,168,76,0.12);
  --gold-glow:   rgba(201,168,76,0.22);
  --blue:        #3B82F6;
  --text:        #F5F5F5;
  --text-dim:    #9a9a9a;
  --text-low:    #505050;
  --radius:      14px;
  --radius-sm:   8px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'IBM Plex Sans', sans-serif;
  --font-mono:    'IBM Plex Mono', monospace;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Film grain overlay ──────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.038;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ── Vignette ────────────────────────────────────────────────────────────── */

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 55% at 50% -5%, transparent 35%, rgba(0,0,0,0.65) 100%);
}

/* ── Layout wrapper ──────────────────────────────────────────────────────── */

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
  padding: 36px 0 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
}

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

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gold);
  letter-spacing: -0.01em;
}

.brand-sep {
  width: 1px;
  height: 18px;
  background: var(--border-mid);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.header-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-low);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Archive banner ──────────────────────────────────────────────────────── */

.archive-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(201,168,76,0.07);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.btn-back {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.08em;
  transition: opacity 0.15s;
}
.btn-back:hover { opacity: 0.75; }

/* ── Hero Carousel ───────────────────────────────────────────────────────── */

.carousel-wrap {
  margin-bottom: 52px;
}

.carousel-hero {
  position: relative;
  background: #080808;
  border-radius: var(--radius);
  overflow: hidden;
  /* Portrait 4:5 ratio (matches 1080×1350 slides), max 520px tall = 416px wide */
  aspect-ratio: 4 / 5;
  width: 100%;
  max-width: 416px;
  margin: 0 auto;
  cursor: pointer;
  user-select: none;
}

/* Individual slide — absolute, fades in/out */
.carousel-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.carousel-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.carousel-slide img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}

/* Progress bar — animated via CSS, reset by JS class toggle */
.carousel-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255,255,255,0.04);
}

@keyframes progress-run {
  from { width: 0%; }
  to   { width: 100%; }
}

.carousel-progress-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  opacity: 0.7;
}

.carousel-progress-bar.running {
  animation: progress-run 4.5s linear forwards;
}

/* Footer row: thumbnails + counter + download */
.carousel-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.carousel-thumbs {
  display: flex;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.carousel-thumbs::-webkit-scrollbar { display: none; }

.carousel-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 75px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  opacity: 0.4;
  transition: border-color 0.2s, opacity 0.2s;
  background: var(--bg-card);
}

.carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-thumb.active {
  border-color: var(--gold);
  opacity: 1;
  box-shadow: 0 0 10px var(--gold-glow);
}

.carousel-thumb:hover:not(.active) { opacity: 0.7; }

.carousel-counter {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-low);
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Download button */
.btn-download {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border-mid);
  background: var(--bg-card);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-download:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.btn-download:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-download svg { pointer-events: none; }

/* ── Deep Brief Section ──────────────────────────────────────────────────── */

.deep-brief {
  margin-bottom: 64px;
  border-top: 1px solid var(--border);
}

.deep-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-low);
  padding: 28px 0 0;
  margin-bottom: 24px;
}

/* Each section: full-width row with top border */
.deep-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

/* Two-column row */
.deep-row {
  display: grid;
  gap: 48px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.deep-row-markets   { grid-template-columns: 3fr 2fr; }
.deep-row-pf        { grid-template-columns: 1fr 1fr; }

@media (max-width: 700px) {
  .deep-row-markets,
  .deep-row-pf { grid-template-columns: 1fr; gap: 32px; }
}

/* Section label (eyebrow) */
.deep-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-low);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
}

.deep-label::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

.deep-label.label-warn::before { background: var(--gold); }

/* Section body text */
.deep-body {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.78;
}

/* Avoid Today list */
.avoid-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.avoid-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.avoid-item:last-child { border-bottom: none; }

.avoid-ticker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  min-width: 54px;
}

.avoid-reason {
  font-family: var(--font-body);
  font-size: 0.83rem;
  color: var(--text-dim);
  line-height: 1.55;
}

/* Notable list */
.notable-list {
  display: flex;
  flex-direction: column;
}

.notable-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.55;
}

.notable-item:last-child { border-bottom: none; }

.notable-item::before {
  content: '→';
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 1px;
}

/* Null / loading state for deep brief */
.deep-null {
  padding: 36px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
}

/* ── Section title (reused) ──────────────────────────────────────────────── */

.section-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-low);
  margin-bottom: 20px;
}

/* ── Archive list ────────────────────────────────────────────────────────── */

.archive-section { margin-bottom: 64px; }

.archive-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.archive-row {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
}

.archive-row:hover .archive-date    { color: var(--gold); }
.archive-row:hover .archive-headline { color: var(--text); }

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: color 0.15s;
}

.archive-headline {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.archive-empty {
  padding: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-low);
}

/* ── Social footer ───────────────────────────────────────────────────────── */

.social-footer {
  padding: 32px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.follow-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-low);
}

.social-links { display: flex; gap: 12px; }

.social-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--border-mid);
  border-radius: 40px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.social-link:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.social-link svg { flex-shrink: 0; }

/* ── Loading / error ─────────────────────────────────────────────────────── */

.state-message {
  padding: 60px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-low);
  letter-spacing: 0.08em;
}

.state-message .state-sub {
  display: block;
  margin-top: 8px;
  font-size: 0.68rem;
  opacity: 0.6;
}

/* ── Admin page ──────────────────────────────────────────────────────────── */

.admin-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px;
}

.admin-header { margin-bottom: 40px; }

.admin-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 4px;
}

.admin-header p {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-low);
  letter-spacing: 0.06em;
}

.admin-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-low);
  margin-bottom: 8px;
}

.field-input {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.field-input:focus { border-color: var(--gold); }

.field-error {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #ef4444;
  margin-top: 8px;
  min-height: 16px;
  letter-spacing: 0.04em;
}

.btn-primary {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  background: var(--gold);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 0.02em;
}

.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.admin-dashboard { display: none; }

.admin-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
}

.admin-panel-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-low);
  margin-bottom: 20px;
}

.health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.health-row:last-child { border-bottom: none; }

.health-key {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.health-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
}

.status-ok   { color: #22c55e; }
.status-warn { color: #f59e0b; }
.status-miss { color: #ef4444; }

.btn-action {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  margin-bottom: 10px;
}

.btn-action:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

.tooltip-wrap { position: relative; }

.tooltip-wrap .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

.tooltip-wrap:hover .tooltip { display: block; }
