/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  /* Fonts */
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  /* Theme: Dark (Default) */
  --bg-color: #0d0e11;
  --bg-secondary: #16171b;
  --text-color: #f3f3f0;
  --text-muted: #8d9096;
  --accent-color: #d1ab7a;
  --accent-hover: #be9766;
  --border-color: #26282e;
  --header-bg: rgba(13, 14, 17, 0.7);
  --header-bg-scrolled: rgba(13, 14, 17, 0.92);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  --selection-bg: #d1ab7a;
  --selection-color: #0d0e11;

  /* Specific Publication Colors */
  --color-atlantic: #e04a3f;
  --color-guardian: #052962;
  --color-propublica: #c21a09;

  /* Spacing & Sizes */
  --header-height-full: 100px;
  --header-height-shrink: 70px;
  --container-max-width: 1200px;
  --transition-speed: 0.3s;
  --transition-smooth: cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-color: #fdfbf7;
  --bg-secondary: #f6f3eb;
  --text-color: #000000;
  --text-muted: #333333;
  --accent-color: #a37b4c;
  --accent-hover: #8e683d;
  --border-color: #e4decb;
  --header-bg: rgba(253, 251, 247, 0.7);
  --header-bg-scrolled: rgba(253, 251, 247, 0.94);
  --card-shadow: 0 10px 30px rgba(163, 123, 76, 0.06);
  --selection-bg: #a37b4c;
  --selection-color: #fdfbf7;
}

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-speed) var(--transition-smooth),
              color var(--transition-speed) var(--transition-smooth);
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-color);
}

/* Typography Legibility (from guidelines) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

p, blockquote, li {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-speed);
}

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

/* ==========================================================================
   REUSABLE UTILITIES
   ========================================================================== */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.section-header {
  margin-bottom: 3.5rem;
  text-align: center;
}

.section-eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-color);
  display: block;
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.section-divider {
  width: 60px;
  height: 2px;
  background-color: var(--accent-color);
  margin: 0 auto;
}

.section-lead {
  max-width: 42rem;
  margin: 1.75rem auto 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.8rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color var(--transition-speed), 
              color var(--transition-speed), 
              border-color var(--transition-speed),
              transform var(--transition-speed) var(--transition-smooth);
  letter-spacing: 0.05em;
}

.btn-primary {
  background-color: var(--accent-color);
  color: var(--bg-color);
  border: 1px solid var(--accent-color);
}

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

.btn-secondary {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height-full);
  background-color: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: height 0.4s var(--transition-smooth), 
              background-color 0.4s var(--transition-smooth), 
              border-color 0.4s var(--transition-smooth);
}

/* Custom layout for header container */
.header-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--accent-color);
  margin-top: -2px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2.5rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  position: relative;
  padding: 0.5rem 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1.5px;
  background-color: var(--accent-color);
  transition: width var(--transition-speed) var(--transition-smooth);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-color);
}

.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover::after {
  width: 100%;
}

/* Theme Toggle Button */
.theme-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background-color 0.3s;
}

.theme-btn:hover {
  border-color: var(--accent-color);
  background-color: var(--bg-secondary);
}

.icon {
  width: 20px;
  height: 20px;
}

/* Show/Hide Theme Icons */
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: none; }

/* Scroll Driven Header Animation */
@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
  @keyframes shrinkHeader {
    to {
      height: var(--header-height-shrink);
      background-color: var(--header-bg-scrolled);
      border-bottom: 1px solid var(--border-color);
      box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    }
  }

  header {
    animation: shrinkHeader auto linear both;
    animation-timeline: scroll(block root);
    animation-range: 0px 100px;
  }
}

/* Fallback Scrolled State class applied via JS */
header.scrolled {
  height: var(--header-height-shrink);
  background-color: var(--header-bg-scrolled);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-section {
  padding: calc(var(--header-height-full) + 3.5rem) 0 6rem 0;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.hero-container {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 4rem;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-eyebrow {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.hero-headline {
  font-size: 3.2rem;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.hero-lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 600px;
}

.hero-cta-group {
  display: flex;
  gap: 1.5rem;
}

.hero-image-container {
  display: flex;
  justify-content: center;
  position: top;
}

.illustration-frame {
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.5s var(--transition-smooth);
}

.illustration-frame:hover {
  transform: translateY(-5px) scale(1.02);
}

.hero-illustration {
  width: 100%;
  height: auto;
  border-radius: 6px;
  object-fit: cover;
  filter: grayscale(10%) contrast(105%);
}

/* ==========================================================================
   REPORTING BEATS
   ========================================================================== */
.beats-section {
  padding: 7rem 0;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.beats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

.beat-card {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 3rem 2.2rem;
  border-radius: 8px;
  transition: transform 0.4s var(--transition-smooth), 
              border-color 0.4s var(--transition-smooth), 
              box-shadow 0.4s var(--transition-smooth);
}

.beat-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-color);
  box-shadow: var(--card-shadow);
}

.beat-icon {
  color: var(--accent-color);
  margin-bottom: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beat-icon svg {
  width: 100%;
  height: 100%;
}

.beat-card h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.beat-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ==========================================================================
   EXPERIENCE SECTION (TIMELINE)
   ========================================================================== */
.experience-section {
  padding: 7rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-color);
}

.hero-section + .programs-section.beats-section {
  padding: 5rem 0;
}

.programs-section:has(+ .experience-section) {
  padding-bottom: 5rem;
}

.programs-section.beats-section {
  background-color: var(--bg-secondary);
}

.current-role-meta {
  margin-top: 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-serif);
  color: var(--text-color);
  letter-spacing: 0.02em;
}

.current-role-section .section-lead {
  margin-top: 1rem;
}

.programs-section .beat-card {
  background-color: var(--bg-color);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  padding-left: 2.5rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 4rem;
}

.timeline-employer-header {
  margin-bottom: 2.25rem;
}

.timeline-employer-name {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.35rem;
}

.timeline-employer-header .timeline-info {
  margin-bottom: 0;
}

.timeline-employer-header .timeline-marker {
  width: 16px;
  height: 16px;
  top: 5px;
  left: calc(-2.5rem - 1px);
  background-color: var(--accent-color);
}

.timeline-role-nested {
  margin-bottom: 2.75rem;
}

.timeline-role-nested .timeline-marker {
  width: 10px;
  height: 10px;
  top: 8px;
  left: calc(-2.5rem + 2px);
  border-width: 2px;
}

.timeline-role-nested + .timeline-item:not(.timeline-role-nested) {
  margin-top: 1.25rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  top: 20px;
  bottom: -4rem;
  left: calc(-2.5rem + 6px);
  width: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

.timeline-employer-header::before,
.timeline-role-nested::before {
  bottom: -2.75rem;
}

.timeline-role-nested:has(+ .timeline-item:not(.timeline-role-nested))::before {
  bottom: -4rem;
}

.timeline-item:has(+ .timeline-header)::before,
.timeline-item:has(+ .timeline-more)::before,
.timeline-item:last-child::before {
  display: none;
}

.timeline-more {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0.25rem 0 0;
}

.timeline-marker {
  position: absolute;
  top: 6px;
  left: -2.5rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--bg-color);
  border: 3px solid var(--accent-color);
  transition: background-color var(--transition-speed);
}

.timeline-item:hover .timeline-marker {
  background-color: var(--accent-color);
}

.timeline-info {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 0.6rem;
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  letter-spacing: 0.05em;
}

.timeline-org {
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-serif);
  color: var(--text-color);
}

.timeline-role {
  font-size: 1rem;
  margin-bottom: 0.8rem;
}

.timeline-content p,
.timeline-content ul,
.timeline-content li {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.timeline-content p {
  margin-top: 0.5rem;
}

.timeline-content-link {
  color: var(--text-muted);
  font-size: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.timeline-content-link:hover {
  color: var(--accent-color);
}

.timeline-content ul {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}

.timeline-content li {
  margin-bottom: 0.4rem;
}

.timeline-header {
  margin-top: 4.5rem;
  margin-bottom: 2.5rem;
  position: relative;
  margin-left: -2.5rem;
  background-color: var(--bg-color);
  z-index: 2;
}

.timeline-header:first-of-type {
  margin-top: 0;
}

.timeline-subheading {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--accent-color);
  /* border-bottom: 1px solid var(--border-color); */
  /* padding-bottom: 0.5rem; */
  padding-left: 0.5rem;
}

/* ==========================================================================
   CONTACT SECTION
   ========================================================================== */
.contact-section {
  padding: 7rem 0;
  border-bottom: 1px solid var(--border-color);
}

.contact-container {
  max-width: 650px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.contact-text-box {
  text-align: center;
}

.secure-sources {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2.2rem;
  margin-top: 2.5rem;
}

.secure-sources h4 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: var(--text-color);
}

.secure-sources p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.secure-links {
  list-style: none;
  font-size: 0.9rem;
}

.secure-links li {
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
}

.secure-links code {
  font-family: monospace;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  margin-top: 0.3rem;
  color: var(--accent-color);
  font-size: 0.85rem;
  word-break: break-all;
}

/* Contact Form with Floating Labels */
.contact-form-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3rem;
  box-shadow: var(--card-shadow);
}

.form-group {
  position: relative;
  margin-bottom: 2rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.9rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-speed);
}

.form-group textarea {
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent-color);
}

.form-group label {
  position: absolute;
  left: 0.9rem;
  top: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: transform 0.25s var(--transition-smooth), 
              color 0.25s var(--transition-smooth), 
              background-color 0.25s var(--transition-smooth);
  transform-origin: left top;
}

/* Floating Label Animation triggers */
.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:focus ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
  transform: translateY(-1.55rem) scale(0.85);
  color: var(--accent-color);
  background-color: var(--bg-secondary);
  padding: 0 0.4rem;
}

.error-msg {
  display: block;
  font-size: 0.8rem;
  color: #ff5757;
  margin-top: 0.4rem;
  opacity: 0;
  height: 0;
  transition: opacity 0.2s, height 0.2s;
}

.form-group.invalid input,
.form-group.invalid textarea {
  border-color: #ff5757;
}

.form-group.invalid .error-msg {
  opacity: 1;
  height: auto;
}

.send-icon {
  width: 18px;
  height: 18px;
  margin-left: 0.5rem;
  transition: transform 0.3s var(--transition-smooth);
}

.btn:hover .send-icon {
  transform: translate(2px, -2px);
}

.form-feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  text-align: center;
}

.form-feedback.success {
  background-color: rgba(46, 117, 89, 0.15);
  color: #5bb38c;
  border: 1px solid rgba(46, 117, 89, 0.3);
}

.form-feedback.error {
  background-color: rgba(255, 87, 87, 0.15);
  color: #ff5757;
  border: 1px solid rgba(255, 87, 87, 0.3);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
  padding: 4rem 0;
  background-color: var(--bg-color);
  border-top: 1px solid var(--border-color);
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copyright {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--text-muted);
  transition: color var(--transition-speed);
}

.social-links a:hover {
  color: var(--accent-color);
}

/* ==========================================================================
   ACCESSIBILITY & PREFERS REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  
  *, *::before, *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVENESS)
   ========================================================================== */
@media (max-width: 1024px) {
  html {
    font-size: 15px;
  }

  .hero-headline {
    font-size: 2.8rem;
  }

  .beats-grid,
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

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

@media (max-width: 768px) {
  header {
    height: var(--header-height-shrink);
  }

  /* Shrinking header scroll animation disabled or smaller offset on mobile */
  @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    header {
      animation: none;
      background-color: var(--header-bg-scrolled);
      border-bottom: 1px solid var(--border-color);
    }
  }

  .hero-container {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .beats-grid,
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .nav-links {
    display: none; /* In a real project, we'd add a mobile menu toggle, but let's keep it clean for layout purposes or keep it simple */
  }

  .footer-container {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
}
