/* ============================================================
   NewsGlobe v5 — Editorial Redesign
   Inspired by Google News, BBC and Scroll.in.
   Light-first design system with full dark mode.
   ============================================================ */

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  /* Surfaces */
  --c-bg: #ffffff;
  --c-bg-alt: #f6f6f7;
  --c-surface: #ffffff;
  --c-surface-raised: #ffffff;
  --c-overlay: rgba(17, 17, 19, 0.55);

  /* Ink */
  --c-ink: #18181b;
  --c-ink-2: #52525b;
  --c-ink-3: #a1a1aa;
  --c-ink-invert: #ffffff;

  /* Brand & accents */
  --c-accent: #c4151c;
  --c-accent-strong: #a01016;
  --c-accent-soft: rgba(196, 21, 28, 0.08);
  --c-link: #1a5fb4;
  --c-positive: #15803d;
  --c-warning: #b45309;
  --c-live: #c4151c;

  /* Lines & shadows */
  --c-line: #e6e6e9;
  --c-line-strong: #d4d4d8;
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06);
  --shadow-md: 0 4px 16px rgba(24, 24, 27, 0.1);
  --shadow-lg: 0 12px 40px rgba(24, 24, 27, 0.18);

  /* Typography */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --fs-2xs: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.375rem;

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-full: 9999px;

  /* Motion */
  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-spring: 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);

  /* Z layers */
  --z-nav: 300;
  --z-dropdown: 400;
  --z-drawer: 450;
  --z-modal: 500;
  --z-reader: 550;
  --z-toast: 600;
  --z-progress: 650;
  --z-loading: 700;

  /* Layout */
  --shell-max: 1280px;
  --header-h: 60px;
  --tabs-h: 46px;
  --reader-font-scale: 1;
}

[data-theme="dark"] {
  --c-bg: #101014;
  --c-bg-alt: #17171c;
  --c-surface: #1a1a20;
  --c-surface-raised: #21212a;
  --c-overlay: rgba(0, 0, 0, 0.65);

  --c-ink: #ededf0;
  --c-ink-2: #a3a3ad;
  --c-ink-3: #6e6e78;
  --c-ink-invert: #101014;

  --c-accent: #ff5a5f;
  --c-accent-strong: #ff7479;
  --c-accent-soft: rgba(255, 90, 95, 0.12);
  --c-link: #7cb2f2;

  --c-line: #2a2a33;
  --c-line-strong: #3a3a45;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  top: 0px !important; /* neutralize Google Translate banner offset */
}

::selection {
  background: var(--c-accent);
  color: #fff;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-line-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--c-ink-3); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Hide Google Translate native UI */
.goog-te-banner-frame,
.skiptranslate {
  display: none !important;
}

/* ============================================================
   Reading Progress Bar
   ============================================================ */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: var(--z-progress);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.progress-track.visible { opacity: 1; }

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.35rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--r-full);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-accent);
  color: #fff;
}

.btn-primary:hover { background: var(--c-accent-strong); box-shadow: var(--shadow-md); }

.btn-primary:disabled,
.btn-primary[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-line-strong);
}

.btn-secondary:hover { background: var(--c-bg-alt); border-color: var(--c-ink-3); }

.btn-ghost {
  background: transparent;
  color: var(--c-ink-2);
  padding: 0.45rem 0.8rem;
}

.btn-ghost:hover { color: var(--c-ink); background: var(--c-bg-alt); }

.btn-full { width: 100%; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: var(--fs-xs); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--c-ink-2);
  font-size: 1.05rem;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
  flex-shrink: 0;
}

.btn-icon:hover { background: var(--c-bg-alt); color: var(--c-ink); }

.icon-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: var(--r-full);
  background: var(--c-accent);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ============================================================
   Form Inputs
   ============================================================ */
.input-group { position: relative; }

.form-input {
  width: 100%;
  padding: 1.05rem 1rem 0.55rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  color: var(--c-ink);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.form-input::placeholder { color: transparent; }

.floating-label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-ink-3);
  font-size: var(--fs-sm);
  pointer-events: none;
  transition: all var(--t-fast);
}

.form-input:focus ~ .floating-label,
.form-input:not(:placeholder-shown) ~ .floating-label {
  top: 0.5rem;
  transform: none;
  font-size: var(--fs-2xs);
  color: var(--c-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.form-select {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  color: var(--c-ink);
  outline: none;
  cursor: pointer;
  transition: border-color var(--t-fast);
}

.form-select:focus { border-color: var(--c-accent); }

/* ============================================================
   Onboarding
   ============================================================ */
.onboarding-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4);
  background:
    radial-gradient(ellipse 60% 45% at 85% -5%, var(--c-accent-soft), transparent 65%),
    var(--c-bg);
}

.onboarding-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-5);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.onboarding-brand .brand-mark { width: 34px; height: 34px; font-size: 1rem; }

.onboarding-card {
  width: 100%;
  max-width: 640px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-6);
  animation: rise 0.45s ease both;
}

.onboarding-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
}

.progress-step {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-line);
  color: var(--c-ink-3);
  flex-shrink: 0;
  transition: all var(--t-base);
}

.progress-step.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

.progress-step.completed {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-ink-invert);
}

.progress-line {
  width: 48px;
  height: 2px;
  background: var(--c-line);
  transition: background var(--t-base);
}

.progress-line.active { background: var(--c-ink); }

.onboarding-title {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-2);
  line-height: 1.2;
}

.onboarding-subtitle {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  margin-bottom: var(--sp-5);
}

.onboarding-body { padding: var(--sp-4) 0; text-align: center; }

.interests-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.interest-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
  animation: rise 0.35s ease both;
}

.interest-card:hover {
  border-color: var(--c-ink-3);
  transform: translateY(-2px);
}

.interest-card.selected {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}

.interest-icon { font-size: 1.3rem; flex-shrink: 0; }

.interest-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  flex: 1;
}

.interest-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  animation: pop 0.25s var(--t-spring);
}

.countries-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.country-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.country-card:hover { border-color: var(--c-ink-3); transform: translateY(-2px); }

.country-card.selected {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
}

.country-flag { font-size: 1.4rem; flex-shrink: 0; }
.country-label { font-size: var(--fs-sm); font-weight: 600; flex: 1; }

.country-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--c-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  flex-shrink: 0;
  animation: pop 0.25s var(--t-spring);
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
}

.onboarding-footer { margin-top: var(--sp-2); }

.selection-count {
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
  text-align: center;
  margin-top: var(--sp-3);
}

/* ============================================================
   App Shell: Header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}

.header-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: var(--fs-md);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  cursor: pointer;
}

.header-date {
  font-size: var(--fs-2xs);
  color: var(--c-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  border-left: 1px solid var(--c-line);
  padding-left: var(--sp-3);
  white-space: nowrap;
}

.header-search {
  flex: 1;
  max-width: 460px;
  margin-left: auto;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-ink-3);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.55rem 1rem 0.55rem 2.5rem;
  background: var(--c-bg-alt);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  color: var(--c-ink);
  font-size: var(--fs-sm);
  outline: none;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-input::placeholder { color: var(--c-ink-3); }

.search-input:focus {
  background: var(--c-surface);
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-left: auto;
}

.header-search + .header-actions { margin-left: 0; }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-ink-invert);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  cursor: pointer;
  margin-left: var(--sp-2);
  flex-shrink: 0;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.user-avatar:hover { box-shadow: 0 0 0 3px var(--c-accent-soft); transform: scale(1.05); }

/* ── Breaking ticker ── */
.ticker-bar {
  display: flex;
  align-items: center;
  background: var(--c-ink);
  color: var(--c-ink-invert);
  overflow: hidden;
  height: 34px;
}

[data-theme="dark"] .ticker-bar {
  background: var(--c-surface-raised);
  color: var(--c-ink);
}

.ticker-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--c-live);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0 0.9rem;
  height: 100%;
  flex-shrink: 0;
  z-index: 1;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1.4s ease-in-out infinite;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.ticker-items {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  animation: ticker 70s linear infinite;
  will-change: transform;
}

.ticker-track:hover .ticker-items { animation-play-state: paused; }

.ticker-item {
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 0 1.4rem;
  cursor: pointer;
  opacity: 0.85;
}

.ticker-item:hover { opacity: 1; text-decoration: underline; }

.ticker-item + .ticker-item { border-left: 1px solid rgba(255,255,255,0.18); }

[data-theme="dark"] .ticker-item + .ticker-item { border-left-color: var(--c-line-strong); }

/* ── Category tabs ── */
.nav-tabs-wrap {
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}

.nav-tabs {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
  height: var(--tabs-h);
  display: flex;
  align-items: stretch;
  gap: var(--sp-1);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.9rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-ink-2);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}

.nav-tab:hover { color: var(--c-ink); }

.nav-tab.active {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

/* ── Edition (country) chips row ── */
.edition-row,
.state-row {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4) 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.edition-row::-webkit-scrollbar { display: none; }

.edition-label {
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-ink-3);
  flex-shrink: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-line);
  color: var(--c-ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--t-fast);
  flex-shrink: 0;
}

.chip:hover { border-color: var(--c-ink-3); color: var(--c-ink); }

.chip.active {
  background: var(--c-ink);
  border-color: var(--c-ink);
  color: var(--c-ink-invert);
}

/* ── Language chips row ── */
.lang-row {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--sp-2) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.lang-row::-webkit-scrollbar { display: none; }

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: var(--fs-xs);
  font-weight: 600;
  background: color-mix(in srgb, var(--c-accent) 12%, transparent);
  color: var(--c-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   Main Layout
   ============================================================ */
.main-shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-7) + 64px);
  min-height: 60vh;
}

/* ── Compact header weather button (icon + temp only) ── */
.weather-btn {
  width: auto;
  border-radius: var(--r-full);
  padding: 0 0.65rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  gap: 0.3rem;
}

/* ── Weather detail panel (modal, closed until #weather-btn is clicked) ── */
.weather-panel-card { max-width: 460px; }

.weather-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  padding-right: var(--sp-5);
}

.weather-panel-empty {
  color: var(--c-ink-3);
  font-size: var(--fs-sm);
  text-align: center;
  padding: var(--sp-5) 0;
}

.weather-panel-current {
  text-align: center;
  padding: var(--sp-3) 0 var(--sp-4);
}

.weather-panel-icon { font-size: 2.75rem; line-height: 1; }

.weather-panel-temp {
  font-family: var(--font-serif);
  font-size: var(--fs-3xl, 2.5rem);
  font-weight: 700;
}

.weather-panel-condition { font-weight: 600; }

.weather-panel-location {
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
}

.weather-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}

.weather-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.weather-stat-label {
  font-size: var(--fs-2xs);
  color: var(--c-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.weather-stat-value { font-weight: 700; }

.weather-panel-subhead {
  font-size: var(--fs-sm);
  font-weight: 700;
  margin: var(--sp-4) 0 var(--sp-2);
}

.hourly-scroll {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  scrollbar-width: none;
}

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  font-size: var(--fs-xs);
}

.hourly-time { color: var(--c-ink-3); }
.hourly-icon { font-size: 1.1rem; }
.hourly-temp { font-weight: 700; }

.daily-list { display: flex; flex-direction: column; }

.daily-item {
  display: grid;
  grid-template-columns: 3rem 1.5rem 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c-line);
  font-size: var(--fs-sm);
}

.daily-item:last-child { border-bottom: none; }
.daily-day { font-weight: 600; }
.daily-rain { color: var(--c-link); font-size: var(--fs-xs); }
.daily-temps { text-align: right; color: var(--c-ink-2); }

.weather-panel-updated {
  display: block;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
  margin-top: var(--sp-3);
}

.feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
  flex-wrap: wrap;
}

.feed-greeting {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.feed-updated {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
  white-space: nowrap;
}

.btn-refresh-link {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-link);
}

.btn-refresh-link:hover { text-decoration: underline; }

/* ── Section heading (BBC-style top rule) ── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  border-top: 3px solid var(--c-ink);
  padding-top: var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-3);
}

.section-head:first-child { margin-top: 0; }

.section-title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title .accent { color: var(--c-accent); }

.section-link {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-link);
  cursor: pointer;
}

.section-link:hover { text-decoration: underline; }

/* ============================================================
   Hero Section
   ============================================================ */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

.hero-lead { cursor: pointer; }

.hero-lead-img-wrap {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--c-bg-alt);
  margin-bottom: var(--sp-3);
}

.hero-lead-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.hero-lead:hover .hero-lead-img { transform: scale(1.03); }

.badge-breaking {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--c-live);
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-sm);
}

.hero-lead-img-wrap .badge-breaking {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

.hero-lead-title {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin-bottom: var(--sp-2);
  transition: color var(--t-fast);
}

.hero-lead:hover .hero-lead-title { color: var(--c-accent); }

.hero-lead-excerpt {
  font-size: var(--fs-base);
  color: var(--c-ink-2);
  line-height: 1.6;
  margin-bottom: var(--sp-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-side {
  display: flex;
  flex-direction: column;
}

.hero-side-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-line);
  cursor: pointer;
}

.hero-side-item:first-child { padding-top: 0; }
.hero-side-item:last-child { border-bottom: none; }

.hero-side-body { flex: 1; min-width: 0; }

.hero-side-title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--t-fast);
}

.hero-side-item:hover .hero-side-title { color: var(--c-accent); }

.hero-side-thumb {
  width: 96px;
  height: 72px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--c-bg-alt);
}

/* ── Meta line (source · time · read time) ── */
.meta-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--fs-2xs);
  color: var(--c-ink-3);
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.meta-source {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  color: var(--c-ink-2);
}

.meta-favicon {
  width: 14px; height: 14px;
  border-radius: 3px;
}

.meta-dot { opacity: 0.6; }

.cat-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-accent);
}

/* ============================================================
   Trending Carousel
   ============================================================ */
.carousel-wrap { position: relative; }

.carousel {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--sp-2);
}

.carousel::-webkit-scrollbar { display: none; }

.trend-card {
  flex: 0 0 280px;
  scroll-snap-align: start;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}

.trend-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-line-strong);
}

.trend-card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--c-bg-alt);
}

.trend-card-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); }

.trend-rank {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--c-accent);
  line-height: 1;
}

.trend-card-title {
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.35;
  margin-top: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--t-fast);
}

.trend-card:hover .trend-card-title { color: var(--c-accent); }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-md);
  color: var(--c-ink);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--t-fast);
}

.carousel-btn:hover { background: var(--c-bg-alt); }
.carousel-btn.prev { left: -14px; }
.carousel-btn.next { right: -14px; }

/* ============================================================
   Topic Chips
   ============================================================ */
.topics-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-line);
  color: var(--c-ink-2);
  cursor: pointer;
  transition: all var(--t-fast);
}

.topic-chip:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
  background: var(--c-accent-soft);
}

/* ============================================================
   News Grid & Cards
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

.news-card {
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
  animation: rise 0.4s ease both;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--c-line-strong);
}

.news-card-img-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--c-bg-alt);
}

.news-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.news-card:hover .news-card-img { transform: scale(1.04); }

.news-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--sp-4);
}

.news-card-title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.32;
  margin: 0.35rem 0 0.45rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--t-fast);
}

.news-card:hover .news-card-title { color: var(--c-accent); }

.news-card-excerpt {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--sp-3);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: var(--c-ink-3);
  font-size: 0.9rem;
  transition: background var(--t-fast), color var(--t-fast);
}

.card-action:hover { background: var(--c-bg-alt); color: var(--c-ink); }
.card-action.saved { color: var(--c-accent); }

/* Compact list row (saved/history lists) */
.row-card {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--c-line);
  cursor: pointer;
  align-items: flex-start;
}

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

.row-card-thumb {
  width: 110px;
  height: 78px;
  border-radius: var(--r-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--c-bg-alt);
}

.row-card-body { flex: 1; min-width: 0; }

.row-card-title {
  font-family: var(--font-serif);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--t-fast);
}

.row-card:hover .row-card-title { color: var(--c-accent); }

/* Infinite scroll sentinel & loader */
.scroll-sentinel { height: 1px; }

.feed-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-5) 0;
  color: var(--c-ink-3);
  font-size: var(--fs-sm);
}

.feed-loader .spinner { width: 22px; height: 22px; border-width: 2px; }

.feed-end {
  text-align: center;
  padding: var(--sp-5) 0;
  color: var(--c-ink-3);
  font-size: var(--fs-sm);
}

/* ============================================================
   Skeletons
   ============================================================ */
.skeleton-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.skeleton-block {
  border-radius: var(--r-lg);
  background: var(--c-bg-alt);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

.skeleton-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.skeleton-image { aspect-ratio: 16/9; background: var(--c-bg-alt); }
.skeleton-body { padding: var(--sp-4); }

.skeleton-line {
  height: 11px;
  border-radius: var(--r-sm);
  background: var(--c-bg-alt);
  margin-bottom: 0.65rem;
}

.skeleton-line:last-child { margin-bottom: 0; }

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  animation: shimmer 1.4s infinite;
}

[data-theme="dark"] .shimmer::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

/* ============================================================
   Empty & Error States
   ============================================================ */
.state-block {
  text-align: center;
  padding: var(--sp-7) var(--sp-4);
}

.state-icon {
  font-size: 2.6rem;
  display: block;
  margin-bottom: var(--sp-3);
  opacity: 0.75;
}

.state-block h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.state-block p {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  margin-bottom: var(--sp-4);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* ============================================================
   Article Preview Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity var(--t-base);
}

.modal-overlay.modal-visible { opacity: 1; }

/* Prefs modal opens without the JS visibility step */
.modal-overlay.modal-static { opacity: 1; }

.modal-card {
  position: relative;
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px);
  transition: transform var(--t-base);
}

.modal-visible .modal-card,
.modal-static .modal-card { transform: translateY(0); }

.modal-card-padded { padding: var(--sp-5); }

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(17, 17, 19, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  z-index: 2;
  transition: background var(--t-fast);
  backdrop-filter: blur(4px);
}

.modal-close:hover { background: var(--c-accent); }

.modal-image {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
}

.modal-body { padding: var(--sp-5); }

.modal-title {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: var(--sp-2) 0 var(--sp-3);
}

.modal-description {
  font-size: var(--fs-base);
  color: var(--c-ink-2);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.modal-heading {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-1);
}

.modal-subheading {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  margin-bottom: var(--sp-4);
}

/* ============================================================
   Full Article Reader
   ============================================================ */
.reader-modal {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: var(--z-reader);
  overflow-y: auto;
  animation: fadeIn 0.25s ease;
}

.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-4);
  height: 56px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}

.reader-toolbar-left,
.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.reader-brand {
  font-size: var(--fs-sm);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0.35rem;
}

.font-size-controls {
  display: flex;
  align-items: center;
  border: 1px solid var(--c-line);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-right: 0.35rem;
}

.font-size-controls .btn-icon {
  width: 32px; height: 32px;
  border-radius: 0;
  font-size: 0.85rem;
}

.reader-content {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-7);
}

.reader-category {
  display: inline-block;
  font-size: var(--fs-2xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--sp-3);
}

.reader-title {
  font-family: var(--font-serif);
  font-size: calc(var(--fs-3xl) * var(--reader-font-scale));
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-4);
}

.reader-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  margin-bottom: var(--sp-5);
}

.reader-ai-summary {
  background: var(--c-bg-alt);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}

.reader-ai-title {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-accent);
  margin-bottom: var(--sp-2);
}

.reader-ai-content {
  font-size: calc(var(--fs-sm) * var(--reader-font-scale));
  color: var(--c-ink-2);
  line-height: 1.7;
}

.reader-body {
  font-family: var(--font-serif);
  font-size: calc(1.125rem * var(--reader-font-scale));
  line-height: 1.8;
  color: var(--c-ink);
}

.reader-body p { margin-bottom: 1.3em; }

.reader-body h1, .reader-body h2, .reader-body h3, .reader-body h4 {
  line-height: 1.3;
  margin: 1.6em 0 0.6em;
  letter-spacing: -0.01em;
}

.reader-body img, .reader-body figure {
  border-radius: var(--r-md);
  margin: 1.5em auto;
  max-width: 100%;
  height: auto;
}

.reader-body figcaption {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
  text-align: center;
  margin-top: 0.5em;
}

.reader-body blockquote {
  border-left: 3px solid var(--c-accent);
  padding-left: 1.25em;
  margin: 1.5em 0;
  font-style: italic;
  color: var(--c-ink-2);
}

.reader-body a { color: var(--c-link); text-decoration: underline; }

.reader-body ul, .reader-body ol {
  list-style: disc;
  padding-left: 1.5em;
  margin-bottom: 1.3em;
}

.reader-body ol { list-style: decimal; }

.reader-share-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--sp-6) 0;
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}

.reader-share-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-ink-3);
  margin-right: var(--sp-2);
}

.reader-related h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  border-top: 3px solid var(--c-ink);
  padding-top: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.reader-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}

/* ============================================================
   Notifications Dropdown
   ============================================================ */
.notif-menu {
  position: fixed;
  width: 340px;
  max-width: calc(100vw - 2rem);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  animation: dropIn 0.2s ease;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  font-weight: 700;
  font-size: var(--fs-sm);
}

.notif-action {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-link);
}

.notif-action:hover { text-decoration: underline; }

.notif-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line);
  font-size: var(--fs-sm);
  line-height: 1.45;
  cursor: pointer;
  transition: background var(--t-fast);
}

.notif-item:hover { background: var(--c-bg-alt); }
.notif-item:last-child { border-bottom: none; }

.notif-item-time {
  display: block;
  font-size: var(--fs-2xs);
  color: var(--c-ink-3);
  margin-top: 0.25rem;
}

.notif-empty {
  text-align: center;
  padding: var(--sp-5);
  color: var(--c-ink-3);
  font-size: var(--fs-sm);
}

/* ============================================================
   Translate Modal (World Language Selector)
   ============================================================ */
.translate-modal-card { max-width: 420px; }

.translate-search-input {
  width: 100%;
  margin-top: var(--sp-3);
  padding: 0.6rem 0.9rem;
  font-size: var(--fs-sm);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-bg-alt);
  color: var(--c-ink-1);
}

.translate-search-input:focus {
  outline: none;
  border-color: var(--c-accent);
}

.translate-lang-list {
  margin-top: var(--sp-3);
  max-height: 50vh;
  overflow-y: auto;
  border-top: 1px solid var(--c-line);
}

.translate-lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.4rem;
  font-size: var(--fs-sm);
  cursor: pointer;
  border-bottom: 1px solid var(--c-line);
  transition: background var(--t-fast);
}

.translate-lang-item:hover { background: var(--c-bg-alt); }
.translate-lang-item.active { font-weight: 700; color: var(--c-accent); }
.translate-lang-check { color: var(--c-accent); }

.translate-lang-empty {
  padding: 1rem 0.4rem;
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
  text-align: center;
}

/* ============================================================
   Profile / Dashboard Drawer
   ============================================================ */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: var(--z-drawer);
  animation: fadeIn 0.2s ease;
}

.profile-card {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--c-surface);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: var(--sp-5);
  animation: slideInRight 0.3s ease;
}

.profile-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--c-bg-alt);
  color: var(--c-ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
}

.profile-close:hover { background: var(--c-accent-soft); color: var(--c-accent); }

.profile-header {
  text-align: center;
  padding: var(--sp-4) 0 var(--sp-5);
}

.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--c-ink);
  color: var(--c-ink-invert);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-xl);
  font-weight: 800;
  margin: 0 auto var(--sp-3);
}

.profile-name {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.profile-email {
  font-size: var(--fs-sm);
  color: var(--c-ink-3);
}

.profile-section {
  border-top: 1px solid var(--c-line);
  padding: var(--sp-4) 0;
}

.profile-section-title {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-ink-3);
  margin-bottom: var(--sp-3);
}

.profile-detail {
  font-size: var(--fs-sm);
  color: var(--c-ink-2);
  line-height: 1.7;
  margin-bottom: var(--sp-2);
}

.theme-switcher {
  display: flex;
  gap: var(--sp-2);
}

.theme-option {
  flex: 1;
  padding: 0.55rem 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--c-ink-2);
  transition: all var(--t-fast);
}

.theme-option:hover { border-color: var(--c-ink-3); }

.theme-option.active {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
  color: var(--c-accent);
}

.profile-stat-row {
  display: flex;
  gap: var(--sp-2);
}

.profile-stat {
  flex: 1;
  text-align: center;
  background: var(--c-bg-alt);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--t-fast);
}

.profile-stat:hover { border-color: var(--c-line-strong); }

.profile-stat-num {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 700;
  display: block;
}

.profile-stat-label {
  font-size: var(--fs-2xs);
  color: var(--c-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ── Preference chips (inside modal) ── */
.pref-section { margin-bottom: var(--sp-4); }

.pref-section h4 {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-ink-3);
  margin-bottom: var(--sp-2);
}

.pref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.pref-chip {
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--c-bg-alt);
  border: 1px solid var(--c-line);
  color: var(--c-ink-2);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}

.pref-chip:hover { border-color: var(--c-ink-3); }

.pref-chip.selected {
  background: var(--c-accent-soft);
  border-color: var(--c-accent);
  color: var(--c-accent);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(var(--sp-4) + 64px);
  left: 50%;
  transform: translate(-50%, 16px);
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.8rem 1.4rem;
  background: var(--c-ink);
  color: var(--c-ink-invert);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  font-size: var(--fs-sm);
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--t-base), transform var(--t-base);
  text-align: center;
}

.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-success { box-shadow: inset 4px 0 0 var(--c-positive), var(--shadow-lg); }
.toast-error { box-shadow: inset 4px 0 0 #ef4444, var(--shadow-lg); }
.toast-warning { box-shadow: inset 4px 0 0 var(--c-warning), var(--shadow-lg); }

/* ============================================================
   Refresh Pill
   ============================================================ */
.refresh-pill {
  position: fixed;
  top: calc(var(--header-h) + var(--tabs-h) + 12px);
  left: 50%;
  transform: translate(-50%, -12px);
  background: var(--c-ink);
  color: var(--c-ink-invert);
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border-radius: var(--r-full);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  transition: transform var(--t-spring), opacity var(--t-fast), visibility var(--t-fast), background var(--t-fast);
  pointer-events: none;
  /* opacity/visibility do the actual hiding — a transform offset alone left
     the pill partially within the viewport (still rendered, just shifted),
     which is what made it look like a second, ghostly banner even when
     appState.pendingArticles was null. */
  opacity: 0;
  visibility: hidden;
}

.refresh-pill.show {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.refresh-pill:hover { background: var(--c-accent); color: #fff; }

/* ============================================================
   Loading Overlay
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: var(--z-loading);
  display: none;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active { display: flex; }

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--c-line);
  border-top-color: var(--c-accent);
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   Bottom Navigation (mobile)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-line);
  display: flex;
  z-index: var(--z-nav);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--c-ink-3);
  transition: color var(--t-fast);
}

.bottom-nav-item .bn-icon { font-size: 1.2rem; line-height: 1; }
.bottom-nav-item.active { color: var(--c-accent); }
.bottom-nav-item:hover { color: var(--c-ink); }

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
  border-top: 1px solid var(--c-line);
  background: var(--c-bg-alt);
}

.footer-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--c-ink-3);
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
  from { transform: translateX(60px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.fade-in { animation: fadeIn 0.4s ease both; }
.hidden { display: none !important; }

/* ============================================================
   Responsive: Tablet (768px+)
   ============================================================ */
@media (min-width: 768px) {
  .interests-grid { grid-template-columns: repeat(3, 1fr); }
  .countries-grid { grid-template-columns: repeat(3, 1fr); }

  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .skeleton-grid { grid-template-columns: repeat(2, 1fr); }

  .hero-grid { grid-template-columns: 3fr 2fr; }
  .skeleton-hero { grid-template-columns: 3fr 2fr; }

  .reader-related-grid { grid-template-columns: repeat(3, 1fr); }

  .bottom-nav { display: none; }
  .mobile-search-toggle { display: none; }

  .main-shell { padding-bottom: var(--sp-7); }

  .toast { bottom: var(--sp-5); }
}

/* ============================================================
   Responsive: Desktop (1024px+)
   ============================================================ */
@media (min-width: 1024px) {
  .news-grid { grid-template-columns: repeat(3, 1fr); }
  .skeleton-grid { grid-template-columns: repeat(3, 1fr); }

  .hero-lead-title { font-size: var(--fs-3xl); }
}

/* ============================================================
   Responsive: Large screens (1440px+)
   ============================================================ */
@media (min-width: 1440px) {
  :root { --shell-max: 1380px; }
  .news-grid { grid-template-columns: repeat(4, 1fr); }
  .skeleton-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================================================
   Responsive: Mobile (<768px)
   ============================================================ */
@media (max-width: 767px) {
  .header-search {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    max-width: none;
    margin: 0;
    padding: var(--sp-2) var(--sp-4);
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-line);
    box-shadow: var(--shadow-md);
  }

  .header-search.mobile-open { display: block; }

  .header-search.mobile-open .search-icon { left: calc(var(--sp-4) + 0.9rem); }

  .desktop-only { display: none !important; }
}

/* ============================================================
   Responsive: Small mobile (<480px)
   ============================================================ */
@media (max-width: 479px) {
  .header-date { display: none; }
  .interests-grid, .countries-grid { grid-template-columns: 1fr 1fr; }
  .onboarding-card { padding: var(--sp-4); }
  .hero-lead-title { font-size: var(--fs-xl); }
  .carousel-btn { display: none; }
  .trend-card { flex-basis: 240px; }
  .modal-body { padding: var(--sp-4); }
  .reader-content { padding-top: var(--sp-4); }
  .reader-title { font-size: calc(var(--fs-2xl) * var(--reader-font-scale)); }
  .row-card-thumb { width: 88px; height: 64px; }
}
  