/* ═══════════════════════════════════════════════════════
   Night Briefing — Dark Editorial Market Review Theme
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base: #09090b;
  --bg-surface: #0f0f12;
  --bg-elevated: #18181d;
  --bg-hover: #1f1f26;
  --border: #2a2a33;
  --border-subtle: #1a1a22;
  --text-primary: #ededf0;
  --text-secondary: #a0a0ac;
  --text-muted: #5a5a68;
  --accent: #c8a040;
  --accent-dim: rgba(200, 160, 64, 0.10);
  --accent-glow: rgba(200, 160, 64, 0.25);
  --positive: #3dd9a0;
  --negative: #f07070;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --max-width: 920px;
  --header-h: 56px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Layout ─── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; width: 100%; }

/* ─── Header ─── */
header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 100;
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}

.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text-primary);
}

.logo-mark {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 14px;
  color: var(--bg-base);
  transform: rotate(-3deg);
}

.logo-text {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.01em;
}

nav { display: flex; gap: 28px; }

.nav-link {
  text-decoration: none; color: var(--text-muted);
  font-size: 13.5px; font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s;
  padding: 4px 0;
  position: relative;
}
.nav-link:hover { color: var(--text-secondary); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: ''; position: absolute;
  bottom: -18px; left: 0; right: 0; height: 1.5px;
  background: var(--accent);
}

/* ─── Main ─── */
main { flex: 1; padding: 40px 0 80px; }

/* ─── Page Header ─── */
.page-header { margin-bottom: 40px; }

.page-header h1 {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 8px;
}

.page-header .subtitle { color: var(--text-muted); font-size: 14.5px; }

/* ─── Report Cards ─── */
.report-list { display: flex; flex-direction: column; gap: 10px; }

.report-card {
  display: flex; text-decoration: none; color: inherit;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px; overflow: hidden;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.report-card:hover {
  border-color: var(--border);
  transform: translateY(-1px);
}

.card-accent { width: 3px; background: var(--accent); flex-shrink: 0; }

.card-body { padding: 18px 22px; flex: 1; min-width: 0; }

.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }

.card-date { font-family: var(--font-mono); font-size: 13.5px; font-weight: 500; }
.card-weekday { color: var(--text-muted); font-size: 13px; }

.card-summary {
  color: var(--text-secondary); font-size: 13.5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-meta {
  margin-top: 8px; display: flex; gap: 6px;
  color: var(--text-muted); font-size: 11.5px; font-family: var(--font-mono);
}

/* ─── Breadcrumb ─── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 28px; font-size: 13.5px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
.breadcrumb a:hover { opacity: 0.75; }
.breadcrumb .sep { color: var(--text-muted); }

/* ─── Article ─── */
.article-header {
  margin-bottom: 28px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.article-header h1 {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; margin-bottom: 10px;
}
.article-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  color: var(--text-muted); font-size: 12.5px; font-family: var(--font-mono);
}

/* ─── Markdown Rendering ─── */
.markdown-body { font-size: 14.5px; line-height: 1.8; color: var(--text-secondary); }

.markdown-body > h1:first-child { display: none; } /* hide duplicate title */

.markdown-body h1 {
  font-family: var(--font-display); font-size: 24px; color: var(--text-primary);
  margin: 44px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle);
}
.markdown-body h2 {
  font-family: var(--font-display); font-size: 21px; color: var(--text-primary);
  margin: 38px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle);
}
.markdown-body h3 { font-size: 17px; color: var(--text-primary); margin: 28px 0 10px; }
.markdown-body h4 { font-size: 15px; color: var(--text-primary); margin: 22px 0 8px; }

.markdown-body p { margin-bottom: 12px; }

.markdown-body strong { color: var(--text-primary); font-weight: 600; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 16px; margin: 14px 0;
  background: var(--accent-dim);
  border-radius: 0 4px 4px 0;
  color: var(--text-muted); font-size: 13.5px;
}
.markdown-body blockquote p { margin-bottom: 0; }

.markdown-body ul, .markdown-body ol { margin: 10px 0; padding-left: 22px; }
.markdown-body li { margin-bottom: 4px; }

.markdown-body code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--bg-elevated); padding: 1.5px 5px; border-radius: 3px;
  color: var(--accent);
}
.markdown-body pre {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 5px; padding: 14px; overflow-x: auto; margin: 14px 0;
}
.markdown-body pre code { background: none; padding: 0; color: var(--text-secondary); }

.markdown-body hr { border: none; border-top: 1px solid var(--border-subtle); margin: 28px 0; }

.markdown-body table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.markdown-body thead { background: var(--bg-elevated); }
.markdown-body th {
  padding: 8px 10px; text-align: left; font-weight: 500; color: var(--text-primary);
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.markdown-body td { padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); }
.markdown-body tbody tr:hover { background: var(--bg-elevated); }

/* ─── K-line: Category Sections ─── */
.category-section { margin-bottom: 36px; }

.category-title {
  font-family: var(--font-display); font-size: 19px; font-weight: 600;
  margin-bottom: 14px; color: var(--text-primary);
  padding-left: 12px; border-left: 2px solid var(--accent);
}

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 8px; }

.asset-card {
  display: flex; flex-direction: column; padding: 13px 15px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 5px;
  text-decoration: none; color: inherit; transition: border-color 0.2s, background 0.2s;
}
.asset-card:hover { border-color: var(--border); background: var(--bg-elevated); }

.asset-name { font-weight: 500; font-size: 14px; margin-bottom: 3px; }
.asset-meta { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }

/* ─── K-line Detail ─── */
.kline-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.kline-header h1 { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.kline-subtitle { color: var(--text-muted); font-size: 13.5px; margin-top: 3px; }

.date-selector { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13.5px; }
.date-selector select {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 4px; padding: 5px 10px;
  cursor: pointer; outline: none;
}
.date-selector select:focus { border-color: var(--accent); }

.chart-wrap {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 6px; padding: 16px; margin-bottom: 24px; height: 320px;
}

.table-section h3 { font-size: 15px; font-weight: 500; margin-bottom: 10px; color: var(--text-secondary); }

.table-scroll { overflow-x: auto; }

.table-scroll table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.table-scroll th {
  background: var(--bg-elevated); padding: 8px 10px; text-align: left;
  font-weight: 500; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.table-scroll td {
  padding: 7px 10px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);
}
.table-scroll tbody tr:hover { background: var(--bg-elevated); }

tr.positive td.change { color: var(--positive); }
tr.negative td.change { color: var(--negative); }

.mono { font-family: var(--font-mono); }

/* ─── Loading & Empty ─── */
.loading {
  text-align: center; padding: 80px 0; color: var(--text-muted); font-size: 14px;
}

.loading::after {
  content: ''; display: inline-block;
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.6s linear infinite; margin-left: 8px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 80px 0; }
.empty-state .empty-mark {
  width: 48px; height: 48px; margin: 0 auto 16px;
  background: var(--accent-dim); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--accent); transform: rotate(-5deg);
}
.empty-state h2 { font-family: var(--font-display); font-size: 21px; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 13.5px; }

/* ─── Footer ─── */
footer { border-top: 1px solid var(--border-subtle); padding: 18px 0; }
.footer-inner { text-align: center; color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .page-header h1 { font-size: 26px; }
  .card-body { padding: 14px 16px; }
  .asset-grid { grid-template-columns: repeat(2, 1fr); }
  .kline-header { flex-direction: column; }
  .chart-wrap { height: 240px; padding: 10px; }
  .article-header h1 { font-size: 22px; }
  .markdown-body h1 { font-size: 20px; }
  .markdown-body h2 { font-size: 18px; }
  nav { gap: 18px; }
  .nav-link { font-size: 12px; }
}
