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

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --bg-card-hover: #1e1e1e;
  --bg-accent: #222;
  --border: #2a2a2a;
  --border-light: #333;
  --text-primary: #e8e6e3;
  --text-secondary: #9a9895;
  --text-muted: #6b6a67;
  --accent: #d4a853;
  --accent-dim: #8b7335;
  --tier1-dot: #e85d4a;
  --tier2-dot: #5a8f7b;
  --font-display: 'EB Garamond', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 6px;
  --transition: 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --topbar-bg: rgba(13, 13, 13, 0.92);
}

/* ─── Light Mode ─── */
:root.light {
  --bg-primary: #f7f5f0;
  --bg-secondary: #eeebe4;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfbf8;
  --bg-accent: #e8e3da;
  --border: #d6d1c8;
  --border-light: #c4beb3;
  --text-primary: #1a1815;
  --text-secondary: #5a5752;
  --text-muted: #8c8880;
  --accent: #8b6f3a;
  --accent-dim: #b89a5e;
  --tier1-dot: #c94432;
  --tier2-dot: #3d7a64;
  --topbar-bg: rgba(247, 245, 240, 0.92);
}

html { font-size: 15px; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #e6c06a; }

/* ─── Topbar ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.logo:hover { color: var(--text-primary); }
.logo-light { font-weight: 400; color: var(--accent); }

.nav-links { display: flex; gap: 24px; }
.nav-links a {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  position: relative;
  padding-bottom: 2px;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--text-primary); }

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
}

.date-display { color: var(--text-muted); }

.edition-badge {
  background: var(--bg-accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border-light);
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.theme-toggle:hover {
  background: var(--bg-accent);
  border-color: var(--border-light);
}

/* ─── Main ─── */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ─── Header ─── */
.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.header-content h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.header-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 4px;
}

.story-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* ─── Loading ─── */
.loading-state {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 80px 0;
}
.loading-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-dim);
  animation: pulse 1.4s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ─── Region Cards ─── */
.region-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color var(--transition), background var(--transition);
}
.region-card:hover { border-color: var(--border-light); }

.region-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  gap: 16px;
}

.region-card-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.region-flag { font-size: 1.2rem; line-height: 1; }

.region-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.region-story-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-accent);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
}

.region-toggle {
  color: var(--text-muted);
  font-size: 0.75rem;
  transition: transform var(--transition);
  flex-shrink: 0;
}
.region-card.expanded .region-toggle { transform: rotate(180deg); }

.region-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              padding 0.3s ease;
  padding: 0 20px;
}
.region-card.expanded .region-card-body {
  max-height: 50000px;
  padding: 16px 20px 24px;
}

/* ─── Stories ─── */
.story {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.story:last-child { border-bottom: none; padding-bottom: 0; }
.story:first-child { padding-top: 0; }

.story-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.tier-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 7px;
}
.tier-dot.tier-1 { background: var(--tier1-dot); }
.tier-dot.tier-2 { background: var(--tier2-dot); }

.story-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.story-section-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dim);
  margin: 12px 0 4px;
}

.story-summary,
.story-facts p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.facts-list {
  list-style: none;
  padding: 0;
}
.facts-list li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 4px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.facts-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}

.story-source {
  margin-top: 10px;
  font-size: 0.78rem;
}
.story-source a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* ─── Share Links ─── */
.story-share {
  margin-top: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.share-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  line-height: 1;
  padding: 0;
}
.share-link:hover {
  background: var(--bg-accent);
  border-color: var(--border-light);
  color: var(--text-primary);
}
.share-link.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p { font-size: 0.9rem; }

/* ─── About Page ─── */
.about-page { max-width: 720px; }
.about-article h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.about-section {
  margin-bottom: 40px;
}
.about-section h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.about-section p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 10px;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.region-card-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.region-card-tag:hover { border-color: var(--border-light); }
.region-card-tag strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.region-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.region-icon { font-size: 1rem; }

/* ─── Feedback Form ─── */
.feedback-form {
  margin-top: 16px;
  max-width: 440px;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-dim);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}
.form-submit {
  background: var(--accent);
  color: #0d0d0d;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 28px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition);
}
.form-submit:hover {
  opacity: 0.85;
}

.tier-block {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.tier-1-block { background: rgba(232, 93, 74, 0.06); border: 1px solid rgba(232, 93, 74, 0.15); }
.tier-2-block { background: rgba(90, 143, 123, 0.06); border: 1px solid rgba(90, 143, 123, 0.15); }

.tier-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  height: fit-content;
}
.tier-1-block .tier-label { background: rgba(232, 93, 74, 0.15); color: var(--tier1-dot); }
.tier-2-block .tier-label { background: rgba(90, 143, 123, 0.15); color: var(--tier2-dot); }

.tier-desc { font-size: 0.88rem; color: var(--text-secondary); }
.tier-desc strong { color: var(--text-primary); }
.tier-desc ul { margin-top: 8px; padding-left: 20px; }
.tier-desc li { margin-bottom: 4px; }

/* ─── Archives ─── */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.archive-entry {
  display: block;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: background var(--transition), border-color var(--transition);
}
.archive-entry:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* ─── Subscribe Section ─── */
.subscribe-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}
.subscribe-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.subscribe-text h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.subscribe-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.subscribe-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-width: 0;
}
.subscribe-fields {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.subscribe-input {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  width: 220px;
  outline: none;
  transition: border-color var(--transition);
}
.subscribe-input:focus {
  border-color: var(--accent-dim);
}
.subscribe-input::placeholder {
  color: var(--text-muted);
}
.subscribe-btn {
  padding: 10px 20px;
  background: var(--accent);
  color: #0d0d0d;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.subscribe-btn:hover {
  opacity: 0.85;
}
.subscribe-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.subscribe-msg {
  font-size: 0.78rem;
  color: var(--text-muted);
  width: 100%;
  margin-top: 4px;
  min-height: 1.4em;
  line-height: 1.4;
}
.subscribe-msg.success {
  color: var(--tier2-dot);
}
.subscribe-msg.error {
  color: var(--tier1-dot);
}

@media (max-width: 700px) {
  .subscribe-inner {
    flex-direction: column;
    text-align: center;
    padding: 24px 20px;
  }
  .subscribe-form {
    justify-content: center;
  }
  .subscribe-input {
    width: 100%;
    min-width: 200px;
  }
}

/* ─── Footer ─── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  text-align: center;
}
.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.6;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  html { font-size: 14px; }
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .logo { font-size: 1.15rem; }
  .topbar-meta .date-display,
  .topbar-meta .edition-badge { display: none; }
  main { padding: 20px 16px 48px; }
  .briefing-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .header-content h1 { font-size: 1.8rem; }
  .region-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-links a { font-size: 0.75rem; letter-spacing: 0.04em; }
  .region-card-header { padding: 12px 14px; }
  .region-story-count { display: none; }
}

@media (max-width: 420px) {
  .topbar-inner { gap: 8px; padding: 0 12px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 0.68rem; letter-spacing: 0.02em; }
  .logo { font-size: 1rem; }
  .theme-toggle { width: 32px; height: 32px; }
  .topbar-meta { gap: 8px; }
}
