/* ============ FONTS & CORE PALETTE ============ */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400..700&family=Outfit:wght@300;400;500;600;700&family=Open+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Core Palette */
  --azure-mist-muted: #E1E7EA;
  --cerulean-whisper-soft: #EAF3F5;
  --sapphire-pearl-muted: #CFD6DE;
  --iris-veil-muted: #F9F9FB;
  --cobalt-bloom-soft: #ADBBD7;
  --iris-whisper-soft: #EAEAF5;
  --azure-veil-muted: #F9FAFB;
  --cobalt-mist-soft: #DDE3EE;
  --sapphire-bloom-soft: #ADC2D7;
  --indigo-dusk-muted: #474C66;
  --blush-bloom-soft: #D7ADC2;
  --mint-bloom-soft: #ADD7B4;
  --azure-bloom-soft: #ADC9D7;
  --orchid-pearl-soft: #D2C8E4;
  --rose-bloom-soft: #D7ADAF;
  --amber-bloom-soft: #D7C4AD;
  --lavender-bloom-soft: #C2ADD7;
  --sage-bloom-soft: #C1D7AD;

  /* Typography Design Tokens */
  --font-heading: "Bricolage Grotesque", sans-serif;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Open Sans", sans-serif;
  --font-technical: "JetBrains Mono", monospace;

  /* Structural Colors (Light Default) */
  --bg-main: var(--azure-veil-muted);
  --bg-surface: #ffffff;
  --bg-muted: var(--cerulean-whisper-soft);
  --border-color: var(--cobalt-mist-soft);

  --text-main: var(--indigo-dusk-muted);
  --text-heading: var(--indigo-dusk-muted);
  --text-muted: rgba(71, 76, 102, 0.75);

  --header-bg: rgba(234, 234, 245, 0.88);
  --footer-bg: var(--azure-mist-muted);

  --dynamic-accent: var(--sapphire-bloom-soft);
  --accent-hover: #8caecf;
  --glow-wash: rgba(173, 194, 215, 0.35);

  /* Tags */
  --tag-journalism-bg: rgba(173, 201, 215, 0.35);
  --tag-journalism-text: #2a3d48;
  --tag-journalism-border: rgba(173, 201, 215, 0.7);

  --tag-training-bg: rgba(173, 215, 180, 0.35);
  --tag-training-text: #234328;
  --tag-training-border: rgba(173, 215, 180, 0.7);

  --tag-research-bg: rgba(210, 200, 228, 0.4);
  --tag-research-text: #382d4a;
  --tag-research-border: rgba(210, 200, 228, 0.7);

  --tag-dispatch-bg: rgba(215, 173, 194, 0.35);
  --tag-dispatch-text: #4a2839;
  --tag-dispatch-border: rgba(215, 173, 194, 0.7);
}

/* Hard Theme Classes */
html.dark, body.dark {
  --bg-main: #12141d;
  --bg-surface: #1a1d2a;
  --bg-muted: #24283b;
  --border-color: #2d3248;

  --text-main: #e2e4f0;
  --text-heading: #ffffff;
  --text-muted: rgba(226, 228, 240, 0.7);

  --header-bg: rgba(18, 20, 29, 0.88);
  --footer-bg: #161824;

  --tag-journalism-bg: rgba(173, 201, 215, 0.18);
  --tag-journalism-text: #c2e2f2;
  --tag-journalism-border: rgba(173, 201, 215, 0.45);

  --tag-training-bg: rgba(173, 215, 180, 0.18);
  --tag-training-text: #c2f2cc;
  --tag-training-border: rgba(173, 215, 180, 0.45);

  --tag-research-bg: rgba(210, 200, 228, 0.18);
  --tag-research-text: #e2d8f5;
  --tag-research-border: rgba(210, 200, 228, 0.45);

  --tag-dispatch-bg: rgba(215, 173, 194, 0.18);
  --tag-dispatch-text: #f5c2da;
  --tag-dispatch-border: rgba(215, 173, 194, 0.45);
  --surface-ambient-shadow: none;
  --glow-wash: rgba(173, 194, 215, 0.4);
}

html.light, body.light {
  --bg-main: var(--azure-veil-muted);
  --bg-surface: #ffffff;
  --bg-muted: var(--cerulean-whisper-soft);
  --border-color: #C7D1E0;

  --text-main: var(--indigo-dusk-muted);
  --text-heading: var(--indigo-dusk-muted);
  --text-muted: rgba(71, 76, 102, 0.78);

  --header-bg: rgba(234, 234, 245, 0.88);
  --footer-bg: var(--azure-mist-muted);
  --surface-ambient-shadow: 0 2px 10px -4px rgba(71, 76, 102, 0.12);
}

.card,
.portfolio-card,
.dispatch-item,
.subscribe-block {
  box-shadow: var(--surface-ambient-shadow, none);
}

/* Ambient Canvas Overlay */
#rain-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* Atmosphere badge stack — fades on scroll via native CSS scroll-timeline,
   replacing a JS scroll-event listener for smoother, off-main-thread motion.
   main.js only tags the element with .scroll-fade; no inline styles set. */
.scroll-fade {
  animation: fadeOnScroll linear both;
  animation-timeline: scroll(root);
  animation-range: 0px 60px;
}

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

@supports not (animation-timeline: scroll()) {
  /* Fallback for browsers without scroll-timeline support: stay visible,
     no JS fallback added per instruction to keep scroll logic in CSS. */
  .scroll-fade { opacity: 1; transform: none; animation: none; }
}

/* ============ GLOBAL STYLES ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  position: relative;
}

.container {
  width: 90%;
  max-width: 1080px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-heading);
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); font-weight: 600; }

p { margin-bottom: 1rem; }

a {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover { color: var(--dynamic-accent); }

/* ============ MASTHEAD & NAVIGATION ============ */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.masthead-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

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

.masthead-name-link {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
  max-width: 100%;
}

.masthead-name {
  height: 80px;
  max-width: 100%;
  overflow: visible;
  display: block;
}

.masthead-name-text {
  font-family: var(--font-heading);
  font-size: 50px;
  font-weight: 700;
  fill: none;
  stroke: url(#masthead-gradient);
  stroke-width: 1.5;
  stroke-linejoin: round;
text-anchor: middle;
dominant-baseline: middle;
letter-spacing: 3px;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  animation: mastheadDraw 60s ease forwards;
}

@keyframes mastheadDraw {
  0%   { stroke-dashoffset: 2000; }
  100% { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .masthead-name-text { animation: none; stroke-dashoffset: 0; }
}

@media (max-width: 640px) {
  .masthead-name { height: 50px; }
  .masthead-name-text { font-size: 20px; letter-spacing: 1.5px; }
}

.masthead-tagline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

nav a,
header nav a,
.primary-nav .nav-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-heading);
  background: transparent;
  border: none;
  text-decoration: none;
  transition: color 0.2s ease;
}

nav a:hover,
header nav a:hover,
.primary-nav .nav-link:hover,
nav a:active,
header nav a:active,
.nav-link:active,
nav a.active,
header nav a.active {
  color: var(--dynamic-accent);
}

.theme-toggle-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--bg-surface);
  color: var(--text-heading);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.theme-toggle-btn:hover {
  background-color: var(--tag-journalism-bg);
}

/* ============ PAGE HEADERS & SUBPAGE LAYOUTS ============ */
.page-header {
  padding: 3rem 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  max-width: 100%;
}

.page-header h1 {
  margin-bottom: 0.75rem;
}

.page-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 680px;
  margin: 0 auto;
}

.about-grid,
.portfolio-grid,
.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
  width: 100%;
}

.page-content,
.dispatch-list {
  max-width: 768px;
  margin: 0 auto 3rem auto;
  width: 100%;
}

.portfolio-card,
.dispatch-item,
.card, 
.subscribe-block {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.portfolio-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dispatch-item {
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.portfolio-card:hover,
.dispatch-item:hover,
.card:hover, 
.subscribe-block:hover {
  transform: translateY(-4px);
  border-color: var(--dynamic-accent);
  box-shadow: 0 12px 32px -6px var(--glow-wash);
}

.subscribe-block {
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06) 0%, var(--bg-surface) 100%);
  border: 1px solid rgba(99, 102, 241, 0.25);
  box-shadow: 0 12px 32px -8px rgba(99, 102, 241, 0.18),
              0 2px 8px rgba(0, 0, 0, 0.04);
}

@media (prefers-reduced-motion: reduce) {
  .glow-card, .about-card, .card, .portfolio-card, .dispatch-item, .subscribe-block {
    transition: none;
  }
}

/* ============ HERO & FEATURED CAROUSEL ============ */
.split-hero {
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  overflow: visible !important;
  z-index: 2;
}

.split-grid-asymmetric {
  display: grid;
  grid-template-columns: 2fr 1px 1fr;
  gap: 2.5rem;
  align-items: stretch;
}

.split-divider {
  background-color: var(--border-color);
  width: 1px;
}

.split-col {
  display: flex;
  flex-direction: column;
  /* Without this, a grid item defaults to min-width:auto, meaning it
     won't shrink below its content's natural minimum size. This column
     now nests a whole second grid (.featured-work-grid) inside it, and
     without min-width:0 here, that nested grid can force this column —
     and the entire page — wider than the mobile viewport even while the
     "stack to one column" media query is correctly active. This is what
     broke Featured Work / Resume stacking on mobile. */
  min-width: 0;
}

/* Same fix applied at the source: any card-grid nested inside a
   constrained column (like featured-work-grid inside .split-col--work)
   needs the same allowance to shrink below its own content's intrinsic
   minimum width. */
.card-grid {
  min-width: 0;
}

.focus-deck {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.focus-tile {
  flex: 0 0 100%;
  max-width: 100%;
  border-left: 3px solid transparent;
  transition: border-color 0.4s ease, background 0.4s ease, transform 0.4s ease;
}

.focus-tile.is-active {
  border-left-color: var(--dynamic-accent);
  background: linear-gradient(90deg, var(--glow-wash) 0%, transparent 45%);
}

.focus-deck-wrapper:hover .focus-deck,
.focus-deck-wrapper:focus-within .focus-deck {
  transition-duration: 0.15s; /* snappier manual nav; autoplay itself is paused via JS clearInterval on hover */
}

@media (prefers-reduced-motion: reduce) {
  .focus-deck { transition: none; }
  .focus-tile { transition: none; }
}

/* ============ DASHBOARD GRID (index.html) ============ */
.glow-card {
  position: relative;
  border-radius: 16px;
  background: var(--bg-surface);
  overflow: hidden;
}

.glow-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--dynamic-accent), transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.15;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 3;
}

.glow-card:hover::before,
.glow-card.glow-active::before {
  opacity: 1;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  position: relative;
}

.dash-card {
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 1.25rem !important;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.dash-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.dash-widget-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dash-label,
.dash-kpi-label {
  font-family: var(--font-technical);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dash-metric-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.5rem 0;
  color: var(--text-heading);
}

.kpi-pill {
  font-family: var(--font-technical);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--dynamic-accent);
  color: #fff;
}

.dash-callout-box {
  padding: 0.75rem;
  border-left: 3px solid var(--dynamic-accent);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0 6px 6px 0;
}

.dash-callout-text {
  font-size: 0.85rem;
  margin: 0.25rem 0 0 0;
}

.dash-desc-sm {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.dash-stream-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dash-stream-list li {
  font-size: 0.825rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.dash-stream-list li:last-child {
  border-bottom: none;
}

.glow-card.dash-card {
  position: relative;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 900px) {
  .dash-span-2 {
    grid-column: span 2;
  }
}

.dash-card .ambient-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.dashboard-graph-bg {
  width: 100%;
  height: 100%;
  opacity: 0.12;
}

.graph-line {
  fill: none;
  stroke: var(--dynamic-accent);
  stroke-width: 2;
  stroke-dasharray: 8 6;
  animation: dashGraphFlow 15s linear infinite;
}

@keyframes dashGraphFlow {
  to { stroke-dashoffset: -200; }
}

/* ============ STATUS PULSE BADGES ============ */
.badge-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-technical);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-technical);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  letter-spacing: 0.02em;
  white-space: nowrap;
  z-index: 4;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--dynamic-accent);
  box-shadow: 0 0 8px var(--dynamic-accent);
}

.status-badge.active-high,
.legend-item.active-high .pulse-dot {
  color: #2da44e;
  border-color: rgba(45, 164, 78, 0.3);
}

.status-badge.active-high .pulse-dot,
.legend-item.active-high .pulse-dot {
  background-color: #2da44e;
  box-shadow: 0 0 8px rgba(45, 164, 78, 0.5);
  animation: pulseGreen 2s infinite;
}

.status-badge.in-dev,
.legend-item.in-dev .pulse-dot {
  color: #d29922;
  border-color: rgba(210, 153, 34, 0.3);
}

.status-badge.in-dev .pulse-dot,
.legend-item.in-dev .pulse-dot {
  background-color: #d29922;
  box-shadow: 0 0 8px rgba(210, 153, 34, 0.5);
  animation: pulseAmber 2s infinite;
}

.status-badge.continuous,
.legend-item.continuous .pulse-dot {
  color: var(--dynamic-accent);
  border-color: var(--glow-wash);
}

.status-badge.continuous .pulse-dot,
.legend-item.continuous .pulse-dot {
  background-color: var(--dynamic-accent);
  box-shadow: 0 0 8px var(--glow-wash);
  animation: pulseIndigo 2s infinite;
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 164, 78, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(45, 164, 78, 0); }
}
@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(210, 153, 34, 0); }
}
@keyframes pulseIndigo {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow-wash); }
  70% { box-shadow: 0 0 0 6px transparent; }
}

/* ============ CAROUSEL DECK CHROME (index.html) ============ */
.focus-deck-wrapper {
  position: relative;
  z-index: 5;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
}

.card-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.75rem;
}

.deck-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.focus-tile.featured-work-cta {
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.laptop-sketch {
  width: 130px;
  height: 90px;
  margin-bottom: 0.75rem;
}

.laptop-sketch-path {
  fill: none;
  stroke: var(--dynamic-accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawSketch 3s ease-in-out infinite alternate;
}

@keyframes drawSketch {
  0% { stroke-dashoffset: 400; opacity: 0.3; }
  50% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.laptop-cta-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--dynamic-accent);
}

.laptop-cta-link {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.deck-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-heading);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.deck-nav-btn:hover {
  border-color: var(--dynamic-accent);
  color: var(--dynamic-accent);
}

.deck-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.deck-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background-color: var(--border-color);
  cursor: pointer;
  padding: 0;
  transition: all 0.25s ease;
}

.deck-dot.is-active {
  background-color: var(--dynamic-accent);
  transform: scale(1.2);
}

.full-width-divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.sheen-box {
  position: relative;
  overflow: hidden;
}

.sheen-box::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    60deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 50%,
    transparent 70%
  );
  transform: rotate(30deg) translateX(-100%);
  animation: sheenSweep 6s infinite;
  pointer-events: none;
}

html.dark .sheen-box::after {
  background: linear-gradient(
    60deg,
    transparent 30%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 70%
  );
}

@keyframes sheenSweep {
  0% { transform: rotate(30deg) translateX(-100%); }
  20%, 100% { transform: rotate(30deg) translateX(100%); }
}

/* ============ TAGS, BUTTONS & PILLS ============ */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag--journalism { background-color: var(--tag-journalism-bg); color: var(--tag-journalism-text); border: 1px solid var(--tag-journalism-border); }
.tag--training { background-color: var(--tag-training-bg); color: var(--tag-training-text); border: 1px solid var(--tag-training-border); }
.tag--research { background-color: var(--tag-research-bg); color: var(--tag-research-text); border: 1px solid var(--tag-research-border); }
.tag--dispatch { background-color: var(--tag-dispatch-bg); color: var(--tag-dispatch-text); border: 1px solid var(--tag-dispatch-border); }

.section { padding: 4rem 0; position: relative; z-index: 2; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.btn {
  display: inline-block;
  background-color: var(--dynamic-accent);
  color: var(--indigo-dusk-muted);
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-outline {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.btn-outline:hover {
  border-color: var(--dynamic-accent);
  color: var(--dynamic-accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--dynamic-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--dynamic-accent) 30%, transparent);
  font-family: var(--font-technical);
  font-size: 0.75rem;
  color: var(--dynamic-accent);
  letter-spacing: 0.03em;
}

.pill-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pillPulse 2s infinite;
}

@keyframes pillPulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 6px transparent; opacity: 0.7; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

/* ============ FOOTER ============ */
.colophon {
  width: 100%;
  padding: 1.75rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--footer-bg);
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text-muted);
  position: relative;
  z-index: 2;
}

.colophon-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.colophon-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ============ ENTRANCE ANIMATION & CAROUSEL ============ */
.rain-fall {
  opacity: 0;
  transform: translateY(-40px);
  transition: opacity 1.4s cubic-bezier(0.22, 1, 0.36, 1), 
              transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.rain-fall.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.card:nth-child(1) { transition-delay: 0.15s; }
.card:nth-child(2) { transition-delay: 0.35s; }
.card:nth-child(3) { transition-delay: 0.55s; }
.card:nth-child(4) { transition-delay: 0.75s; }

.card-grid.is-carousel {
  display: block;
  overflow: hidden;
  position: relative;
}

.card-grid.is-carousel .carousel-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-grid.is-carousel .carousel-slide {
  flex: 0 0 100%;
  max-width: 100%;
  cursor: pointer;
}

.featured-work-card {
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.featured-work-card:hover {
  transform: none;
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-heading);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.carousel-btn:hover {
  border-color: var(--dynamic-accent);
  color: var(--dynamic-accent);
  transform: translateY(-1px);
}

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background-color: var(--border-color);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.25s ease, transform 0.25s ease;
}

.carousel-dot.is-active {
  background-color: var(--dynamic-accent);
  transform: scale(1.25);
}

/* ============ SHARED FILTER BAR ============ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto 1rem;
  max-width: 850px;
}

.filter-pill {
  font-family: var(--font-technical);
  font-size: 0.78rem;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.filter-pill:hover {
  border-color: var(--dynamic-accent);
  color: var(--dynamic-accent);
}

.filter-pill.is-active {
  border-color: var(--dynamic-accent);
  background: var(--dynamic-accent);
  color: var(--indigo-dusk-muted);
}

/* ============ MISC & DIVIDERS ============ */
.peeking-mascot {
  position: fixed;
  bottom: -50px;
  right: 30px;
  font-size: 2.2rem;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  animation: peekUpAndDown 3.2s ease-in-out forwards;
}

@keyframes peekUpAndDown {
  0% { transform: translateY(0); }
  25% { transform: translateY(-60px) rotate(-10deg); }
  70% { transform: translateY(-60px) rotate(5deg); }
  100% { transform: translateY(20px); }
}

hr.section-divider {
  border: 0;
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.12));
  height: 0;
  width: 100%;
  display: block;
  box-sizing: content-box;
}

.dispatch-list hr.section-divider {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

/* ============ MEDIA QUERIES ============ */
/* ==================================================
   MOBILE RESPONSIVENESS FIXES (Screens <= 768px)
================================================== */
/* Responsive Adjustments */
@media (max-width: 768px) {
  .split-grid-asymmetric {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .split-divider {
    display: none;
  }
  .page-header {
    padding: 2rem 0 1.5rem;
  }
  .about-grid,
  .portfolio-grid,
  .dispatch-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 640px) {
  .masthead-inner {
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
  }
  .primary-nav {
    width: 100%;
    justify-content: center;
    gap: 0.85rem;
  }
}

/* ============ SUBSCRIBE SECTION SHEEN ============ */
.subscribe-block {
  position: relative;
  overflow: hidden; /* Clips the sheen within the card bounds */
}

.subscribe-sheen {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transform: skewX(-25deg);
  animation: sheenSweep 6s infinite;
  pointer-events: none;
}

html.dark .subscribe-sheen {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.08),
    transparent
  );
}

@keyframes sheenSweep {
  0% {
    left: -100%;
  }
  20%, 100% {
    left: 200%;
  }
}

/* Universal Card Hover Glow (consolidated — single source, theme-aware) */
.work-card, .about-card, .glow-card, .card,
.portfolio-card, .dispatch-item, .subscribe-block {
  border: 1px solid var(--border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.work-card:hover, .about-card:hover, .glow-card:hover, .card:hover,
.portfolio-card:hover, .dispatch-item:hover, .subscribe-block:hover,
.glow-active {
  transform: translateY(-4px);
  border-color: var(--dynamic-accent) !important;
  box-shadow: 0 12px 32px -6px var(--glow-wash) !important;
}