/* ==========================================================================
   THE CHRONICLE - EDITORIAL DESIGN SYSTEM & STYLESHEET
   Google Sheets Powered Dynamic Cards Showcase
   ========================================================================== */

/* --- 1. CSS Custom Properties / Themes --- */
:root {
  /* Common Brand Colors */
  --color-gold: #d4a359;
  --color-gold-hover: #e5b66e;
  --color-news: #0284c7;
  --color-news-bg: rgba(2, 132, 199, 0.12);
  --color-entertainment: #d946ef;
  --color-entertainment-bg: rgba(217, 70, 239, 0.12);
  --color-opinion: #f59e0b;
  --color-opinion-bg: rgba(245, 158, 11, 0.12);
  --color-saved: #10b981;
  --color-saved-bg: rgba(16, 185, 129, 0.12);

  /* Typography */
  --font-serif: 'Newsreader', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions & Shadows */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Velvet Theme (Default) */
[data-theme="dark"] {
  --bg-primary: #0a0d14;
  --bg-secondary: #101522;
  --bg-card: rgba(19, 26, 42, 0.75);
  --bg-card-hover: rgba(27, 36, 58, 0.9);
  --bg-glass: rgba(16, 22, 36, 0.7);
  --bg-input: #151b2c;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #f1c27d;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-focus: #f1c27d;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-card-hover: 0 20px 45px -10px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 163, 89, 0.15);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.85);

  --glow-1: rgba(212, 163, 89, 0.12);
  --glow-2: rgba(56, 189, 248, 0.1);
  --glow-3: rgba(217, 70, 239, 0.08);
}

/* Daily Broadside (Light Theme) */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-input: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #b45309;

  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-medium: rgba(15, 23, 42, 0.16);
  --border-focus: #b45309;

  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --shadow-card-hover: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 0 20px rgba(180, 83, 9, 0.1);
  --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.25);

  --glow-1: rgba(212, 163, 89, 0.15);
  --glow-2: rgba(2, 132, 199, 0.1);
  --glow-3: rgba(217, 70, 239, 0.08);
}

/* Sepia Archive (Reading Theme) */
[data-theme="sepia"] {
  --bg-primary: #f5eedc;
  --bg-secondary: #ebe0c8;
  --bg-card: rgba(254, 250, 240, 0.9);
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(245, 238, 220, 0.85);
  --bg-input: #fdfbf7;

  --text-primary: #382513;
  --text-secondary: #6e5843;
  --text-muted: #9c836e;
  --text-accent: #92400e;

  --border-subtle: rgba(56, 37, 19, 0.1);
  --border-medium: rgba(56, 37, 19, 0.2);
  --border-focus: #92400e;

  --shadow-card: 0 10px 25px -5px rgba(56, 37, 19, 0.08), 0 0 0 1px rgba(56, 37, 19, 0.06);
  --shadow-card-hover: 0 20px 35px -8px rgba(56, 37, 19, 0.16), 0 0 20px rgba(146, 64, 14, 0.1);
  --shadow-modal: 0 25px 50px -12px rgba(56, 37, 19, 0.3);

  --glow-1: rgba(180, 83, 9, 0.12);
  --glow-2: rgba(217, 119, 6, 0.08);
  --glow-3: rgba(146, 64, 14, 0.06);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --- 3. Ambient Dynamic Lighting --- */
.ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.6;
  animation: orbFloat 20s infinite alternate ease-in-out;
}

.glow-orb-1 {
  width: 600px;
  height: 600px;
  top: -150px;
  left: -100px;
  background: var(--glow-1);
}

.glow-orb-2 {
  width: 500px;
  height: 500px;
  top: 40%;
  right: -150px;
  background: var(--glow-2);
  animation-duration: 25s;
}

.glow-orb-3 {
  width: 450px;
  height: 450px;
  bottom: 0;
  left: 30%;
  background: var(--glow-3);
  animation-duration: 18s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 60px) scale(1.08); }
  100% { transform: translate(-30px, -40px) scale(0.95); }
}

/* --- 4. Top Announcement / Sync Bar --- */
.top-bar {
  position: relative;
  z-index: 40;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 0;
  font-size: 0.85rem;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sync-indicator {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: pulseDot 2s infinite ease-in-out;
}

.pulse-dot.syncing {
  background-color: #eab308;
  box-shadow: 0 0 10px #eab308;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.sync-text {
  font-weight: 600;
  color: var(--text-secondary);
}

.sheet-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stats-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.stats-mini .divider {
  opacity: 0.4;
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.theme-switcher {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 2px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--text-accent);
  color: #1a1408;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* --- 5. Editorial Masthead --- */
.masthead {
  position: relative;
  z-index: 20;
  padding: 2.5rem 0 1.5rem 0;
  border-bottom: 2px solid var(--border-subtle);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
}

.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
}

.masthead-meta-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.masthead-date {
  font-weight: 600;
  color: var(--text-secondary);
}

.masthead-center {
  text-align: center;
}

.masthead-brand-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.masthead-crest {
  font-size: 1.6rem;
  color: var(--text-accent);
  margin-bottom: 0.25rem;
  animation: floatCrest 4s ease-in-out infinite;
}

@keyframes floatCrest {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.masthead-title {
  font-family: var(--font-serif);
  font-size: 3.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.masthead-tagline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.masthead-meta-right {
  display: flex;
  justify-content: flex-end;
}

.sheet-source-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.source-label {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-transform: uppercase;
}

.sheet-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-accent);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
}

.sheet-link-chip:hover {
  transform: translateY(-2px);
  background: var(--text-accent);
  color: #111;
}

/* --- 6. Interactive Controls Bar --- */
.controls-section {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 1rem 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.controls-glass-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

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

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.cat-pill:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.cat-pill.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.cat-pill[data-category="News"].active {
  background: var(--color-news);
  color: #ffffff;
  border-color: var(--color-news);
}

.cat-pill[data-category="Entertainment"].active {
  background: var(--color-entertainment);
  color: #ffffff;
  border-color: var(--color-entertainment);
}

.cat-pill[data-category="Opinion"].active {
  background: var(--color-opinion);
  color: #111111;
  border-color: var(--color-opinion);
}

.cat-pill[data-category="bookmarks"].active {
  background: var(--color-saved);
  color: #ffffff;
  border-color: var(--color-saved);
}

.cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.cat-pill.active .cat-count {
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
}

.controls-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 480px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 2.4rem 0.65rem 2.6rem;
  border-radius: var(--radius-pill);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212, 163, 89, 0.2);
}

.search-clear {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 4px;
}

.search-clear:hover {
  color: var(--text-primary);
}

.tools-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.select-styled {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-styled:focus {
  outline: none;
  border-color: var(--border-focus);
}

.view-mode-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.view-btn:hover {
  color: var(--text-primary);
}

.view-btn.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --- 7. Ticker Ribbon --- */
.ticker-ribbon {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.45rem 0;
  font-size: 0.82rem;
  overflow: hidden;
}

.ticker-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-xs);
  background: var(--text-accent);
  color: #111;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.ticker-track-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 5%, black 95%, transparent 100%);
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  white-space: nowrap;
  animation: tickerSlide 45s linear infinite;
}

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

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  transition: color var(--transition-fast);
  cursor: pointer;
}

.ticker-item:hover {
  color: var(--text-accent);
}

.ticker-category {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

/* --- 8. Feed Header & Layout Container --- */
.main-content {
  position: relative;
  z-index: 10;
  padding: 2.5rem 0 5rem 0;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.feed-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.feed-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.feed-meta-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.meta-pill {
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-accent);
  font-size: 0.85rem;
  font-weight: 600;
}

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

/* --- 9. BENTO VIEW (Magazine Layout) --- */
.articles-container.bento-view {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.75rem;
}

/* Bento Card Geometry */
.bento-view .article-card {
  grid-column: span 4;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  backdrop-filter: blur(12px);
}

.bento-view .article-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-card-hover);
}

/* Hero Featured Bento Card (Spans 8 cols on desktop) */
.bento-view .article-card.featured-card {
  grid-column: span 8;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  min-height: 440px;
}

/* Wide Bento Card (Spans 6 cols) */
.bento-view .article-card.wide-card {
  grid-column: span 6;
}

/* Media Wrapper */
.card-media {
  position: relative;
  overflow: hidden;
  height: 220px;
  background: var(--bg-secondary);
}

.featured-card .card-media {
  height: 100%;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.article-card:hover .card-img {
  transform: scale(1.05);
}

.card-category-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.category-news {
  background: rgba(2, 132, 199, 0.85);
  color: #ffffff;
}

.category-entertainment {
  background: rgba(217, 70, 239, 0.85);
  color: #ffffff;
}

.category-opinion {
  background: rgba(245, 158, 11, 0.9);
  color: #111111;
}

.card-actions-top {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  display: flex;
  gap: 0.5rem;
}

.btn-icon-blur {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-fast);
}

.btn-icon-blur:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.1);
}

.btn-icon-blur.bookmarked {
  background: var(--color-saved);
  color: #ffffff;
  border-color: var(--color-saved);
}

/* Card Body */
.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.featured-card .card-body {
  padding: 2.25rem 2rem;
}

.card-meta-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.card-meta-line .dot {
  opacity: 0.5;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.28;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}

.featured-card .card-title {
  font-size: 2rem;
  -webkit-line-clamp: 4;
}

.article-card:hover .card-title {
  color: var(--text-accent);
}

.card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.tag-chip {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.tag-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Card Footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.card-read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-accent);
  transition: gap var(--transition-fast);
}

.card-read-btn:hover {
  gap: 0.65rem;
}

.card-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  transition: all var(--transition-fast);
}

.card-listen-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* --- 10. 3D LUXURY CARDS VIEW --- */
.articles-container.cards-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  perspective: 1200px;
}

.cards-view .article-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
}

.cards-view .article-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  pointer-events: none;
  z-index: 5;
}

.cards-view .article-card:hover::before {
  opacity: 1;
}

.cards-view .article-card:hover {
  box-shadow: var(--shadow-card-hover);
}

/* --- 11. COMPACT LEDGER VIEW --- */
.articles-container.ledger-view {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ledger-view .article-card {
  display: grid;
  grid-template-columns: 8px 100px 1.4fr 2fr 130px 140px;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.ledger-view .article-card:hover {
  transform: translateX(4px);
  border-color: var(--border-medium);
  background: var(--bg-card-hover);
}

.ledger-view .card-accent-bar {
  width: 6px;
  height: 38px;
  border-radius: 3px;
}

.ledger-view .card-media,
.ledger-view .card-excerpt,
.ledger-view .card-tags,
.ledger-view .card-actions-top {
  display: none;
}

.ledger-view .card-body {
  padding: 0;
  display: contents;
}

.ledger-view .card-category-tag {
  position: static;
  display: inline-block;
  text-align: center;
  font-size: 0.7rem;
  padding: 0.25rem 0.55rem;
}

.ledger-view .card-title {
  font-size: 1.05rem;
  margin-bottom: 0;
  -webkit-line-clamp: 1;
}

.ledger-view .card-meta-line {
  margin-bottom: 0;
  font-size: 0.75rem;
}

.ledger-view .card-footer {
  padding-top: 0;
  border-top: none;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- 12. Modals --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(20px);
  transform: scale(0.94) translateY(15px);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-dialog-lg {
  max-width: 820px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(212, 163, 89, 0.15);
  color: var(--text-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.floating-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

.modal-body {
  padding: 1.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.input-with-icon {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212, 163, 89, 0.2);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.preset-sheets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.preset-label {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.preset-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-fast);
}

.preset-chip:hover, .preset-chip.active {
  border-color: var(--text-accent);
  background: rgba(212, 163, 89, 0.1);
  color: var(--text-accent);
}

.sheet-guide-box {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.sheet-guide-box h4 {
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.sheet-sample-table {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.table-col {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  background: var(--bg-card);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-pill);
  background: var(--text-accent);
  color: #111;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(212, 163, 89, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: var(--color-gold-hover);
}

.btn-secondary {
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* --- 13. Article Reader Modal Details --- */
.reader-hero-media {
  position: relative;
  height: 320px;
  overflow: hidden;
}

.reader-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reader-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, var(--bg-card) 95%);
}

.reader-article-body {
  padding: 2rem 2.5rem;
}

.reader-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.reader-title {
  font-family: var(--font-serif);
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.22;
  margin-bottom: 1.25rem;
}

.reader-summary-box {
  background: var(--bg-secondary);
  border-left: 4px solid var(--text-accent);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.reader-takeaways-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-accent);
}

.reader-takeaways-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.reader-takeaways-list li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.reader-takeaways-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--text-accent);
  font-weight: bold;
}

.reader-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

/* --- 14. Floating Audio Player --- */
.floating-audio-bar {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-pill);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  padding: 0.6rem 1.25rem;
  width: 90%;
  max-width: 500px;
  animation: slideUpAudio 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpAudio {
  from { transform: translate(-50%, 40px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.audio-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.audio-visualizer {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.audio-visualizer span {
  width: 3px;
  height: 100%;
  background: var(--text-accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
}

.audio-visualizer span:nth-child(2) { animation-delay: 0.2s; }
.audio-visualizer span:nth-child(3) { animation-delay: 0.4s; }
.audio-visualizer span:nth-child(4) { animation-delay: 0.1s; }

@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 18px; }
}

.audio-info {
  flex: 1;
  overflow: hidden;
}

.audio-label {
  display: block;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--text-accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.audio-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.audio-btn:hover {
  background: var(--text-accent);
  color: #111;
}

/* --- 15. Toast Notifications --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 3.2s forwards;
}

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

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

/* --- 16. Empty State & Skeletons --- */
.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-medium);
  border-radius: var(--radius-lg);
  max-width: 600px;
  margin: 2rem auto;
}

.empty-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.75rem;
}

.skeleton-card {
  grid-column: span 4;
  height: 360px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-lg);
  animation: skeletonPulse 1.5s infinite;
}

.skeleton-featured {
  grid-column: span 8;
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- 17. Footer --- */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 0 2rem 0;
  position: relative;
  z-index: 10;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.brand-inline {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-accent);
  margin-bottom: 0.75rem;
}

.footer-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 420px;
}

.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.footer-col a {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--text-accent);
}

.footer-bottom {
  grid-column: 1 / -1;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-accent);
}

/* --- 18. Responsive Media Queries --- */
@media (max-width: 1024px) {
  .masthead-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .masthead-meta-left, .masthead-meta-right {
    justify-content: center;
    align-items: center;
  }
  .bento-view .article-card {
    grid-column: span 6;
  }
  .bento-view .article-card.featured-card {
    grid-column: span 12;
  }
  .bento-view .article-card.wide-card {
    grid-column: span 12;
  }
  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .masthead-title {
    font-size: 2.5rem;
  }
  .controls-tools {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  .tools-group {
    justify-content: space-between;
  }
  .bento-view .article-card,
  .bento-view .article-card.featured-card,
  .bento-view .article-card.wide-card {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
  }
  .featured-card .card-media {
    height: 220px;
  }
  .cards-view {
    grid-template-columns: 1fr;
  }
  .ledger-view .article-card {
    grid-template-columns: 6px 1fr auto;
    gap: 0.75rem;
  }
  .ledger-view .card-meta-line {
    display: none;
  }
  .footer-content {
    grid-template-columns: 1fr;
  }
  .reader-article-body {
    padding: 1.5rem 1.25rem;
  }
}
