/* ChannelPulse — Design System v3 (Brand Rebrand) */
:root {
  --bg: #F9F9F7;
  --bg-alt: #F0F0ED;
  --text: #0F1115;
  --text-secondary: #64748B;
  --accent: #F05A28;
  --accent-hover: #D94E20;
  --navy: #0B162A;
  --border: #E0DED8;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.04);

  /* Category Colors */
  --cat-strategy: #8B1A1A;
  --cat-deals: #0B162A;
  --cat-tech: #4A5568;
  --cat-industry: #B8860B;
  --cat-culture: #F05A28;
  --cat-field: #2D6A4F;        /* Forest — From the Field */
  --cat-lead: #F05A28;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
  --content-width: 680px;
  --wide-width: 1060px;
}

[data-theme="dark"] {
  --bg: #0B162A;
  --bg-alt: #0F1D33;
  --text: #E8E6E1;
  --text-secondary: #94A3B8;
  --border: #1E2D45;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === HEADER === */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(249,249,247,0.88);
}
[data-theme="dark"] .site-header {
  background: rgba(11,22,42,0.88);
}
.header-inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logo-img {
  height: 52px;
  width: auto;
}
.logo-img-dark { display: none; }
[data-theme="dark"] .logo-img { display: none; }
[data-theme="dark"] .logo-img-dark { display: block; }
.header-nav { display: flex; align-items: center; gap: 1.25rem; }
.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--text); }
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  transition: all 0.15s;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* === HERO === */
.hero {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 2.5rem;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin-bottom: 0.875rem;
  color: var(--text);
}
.hero .tagline {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin-bottom: 2.25rem;
  line-height: 1.55;
}

/* === SUBSCRIBE FORM === */
.subscribe-form {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}
.subscribe-form input {
  flex: 1;
  padding: 0.6875rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.subscribe-form input:focus { border-color: var(--accent); }
.subscribe-form input::placeholder { color: var(--text-secondary); }
.subscribe-form button {
  padding: 0.6875rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.subscribe-form button:hover { background: var(--accent-hover); }
.subscribe-form button:active { transform: scale(0.98); }

/* Beehiiv Embed */
.beehiiv-embed-wrapper { display: flex; justify-content: center; width: 100%; margin: 0.5rem 0; }
.beehiiv-embed-wrapper iframe.beehiiv-embed { width: 100%; max-width: 500px; height: 52px; border: none; background: transparent; }

/* === SECTION === */
.section {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2rem;
}
.section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
}

/* === ARTICLE CARDS === */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.article-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.375rem;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
}
.article-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-color: rgba(240,90,40,0.25);
}
[data-theme="dark"] .article-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  border-color: rgba(240,90,40,0.35);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.625rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.author-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.card-title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.28;
  margin-bottom: 0.375rem;
}
.card-excerpt {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

/* === FEATURED CARD === */
.featured-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.featured-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
}
.featured-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
  border-color: rgba(240,90,40,0.25);
}
.featured-card .card-title {
  font-size: 1.375rem;
  letter-spacing: -0.025em;
  line-height: 1.22;
}
.featured-card .card-excerpt {
  font-size: 0.9375rem;
  margin-top: 0.375rem;
  line-height: 1.55;
}

/* === ARTICLE PAGE === */
.article-header {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 0;
}
.article-accent {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 1.25rem;
}
.article-header h1 {
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 1rem;
}
.article-byline {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.article-byline strong { color: var(--text); }
.article-date {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  letter-spacing: 0.01em;
}

.article-body {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.article-body p {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.78;
  margin-bottom: 1.375rem;
  color: var(--text);
  letter-spacing: -0.003em;
}
.article-body p:last-child { margin-bottom: 0; }
.article-body p strong {
  font-weight: 700;
  color: var(--text);
}
.article-body p em {
  font-style: italic;
}
.article-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.article-body a:hover {
  border-bottom-color: var(--accent);
}

/* === BOTTOM CTA === */
.bottom-cta {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
}
.bottom-cta h3 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.375rem;
}
.bottom-cta p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1.125rem;
}

/* === ABOUT PAGE === */
.about-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}
.about-content h1 {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}
.about-content p {
  font-size: 1.0625rem;
  line-height: 1.78;
  margin-bottom: 1.375rem;
  color: var(--text);
}
.team-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
.team-card {
  border-left: 3px solid var(--accent);
  padding: 1.125rem 1.375rem;
  background: var(--bg-alt);
  border-radius: 0 8px 8px 0;
  transition: transform 0.15s;
}
.team-card:hover { transform: translateX(2px); }
.team-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.125rem;
  letter-spacing: -0.01em;
}
.team-card .role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}
.team-card .bio {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text);
}

/* === NAV LINKS === */
.article-nav {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.article-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: opacity 0.15s;
}
.article-nav a:hover { opacity: 0.8; }

/* === FOOTER === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .subscribe-form { flex-direction: column; }
  .subscribe-form button { width: 100%; }
  .article-grid { grid-template-columns: 1fr; }
  .header-nav { gap: 0.875rem; }
  .featured-card { padding: 1.375rem; }
  .hero { padding: 2.5rem 1.5rem 1.5rem; }
  .article-header { padding-top: 2.5rem; }
}

/* === LOGO PULSE ANIMATION === */
/* Three beats: slow → medium → fast, then PULSE locks in */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.08; }
}
@keyframes flicker-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}
@keyframes pulse-fade-in {
  0% { opacity: 0; transform: translateX(-6px); }
  60% { opacity: 1; transform: translateX(1px); }
  100% { opacity: 1; transform: translateX(0); }
}
.logo-intro .logo-channel {
  animation:
    flicker-soft 0.8s ease-in-out 0s 1,
    flicker-soft 0.6s ease-in-out 0.8s 1,
    flicker 0.45s ease-in-out 1.4s 1,
    flicker 0.35s ease-in-out 1.85s 1,
    flicker 0.25s ease-in-out 2.2s 1,
    flicker 0.18s ease-in-out 2.45s 2;
}
.logo-intro .logo-pulse {
  opacity: 0;
  animation: pulse-fade-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 2.8s;
}

/* If user prefers reduced motion, skip animation */
@media (prefers-reduced-motion: reduce) {
  .logo-intro .logo-channel { animation: none; }
  .logo-intro .logo-pulse { animation: none; opacity: 1; }
}

/* === SELECTION === */
::selection {
  background: rgba(240,90,40,0.15);
  color: var(--text);
}
