/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Typography */
  --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 4rem;
  --spacing-xl: 6rem;

  /* Transitions */
  --transition-bg: 500ms;
  --transition-text: 1000ms;
  --transition-text-delay: 500ms;

  /* Colors */
  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.8);
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-bg: 0ms;
    --transition-text: 0ms;
    --transition-text-delay: 0ms;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-primary);
  color: var(--color-text);
  overflow-x: hidden;
  background: #000;
}

body.deep-link-loading {
  opacity: 0;
}

body.deep-link-fade-in {
  animation: fadeInFromBlack 800ms ease-out forwards;
}

@keyframes fadeInFromBlack {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: #000;
  color: #fff;
  padding: var(--spacing-sm);
  text-decoration: none;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* Fixed header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--spacing-md);
  opacity: 0;
  transition: opacity var(--transition-bg) ease-in-out;
}

.header.visible {
  opacity: 1;
}

/* Project page header is always visible */
.project-page .header {
  opacity: 1;
  top: 0;
  transition: opacity var(--transition-bg) ease-in-out, top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hide header on scroll down */
.project-page .header.header-hidden {
  top: -100px;
}

/* Desktop navigation */
.header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.nav-left,
.nav-right {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex: 1;
}

.nav-left {
  justify-content: flex-start;
}

.nav-right {
  justify-content: flex-end;
}

.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease;
  position: relative;
  background: none;
  border: none;
  padding: 0;
}

.nav-link:hover,
.nav-link:focus {
  opacity: 0.7;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-text);
}

.header-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
}

.header-logo img {
  height: 40px;
  width: auto;
  display: block;
}

/* Hide center header logo on Desktop for About, Work, Contact, Project, and Automation pages */
.about-page .header-logo,
.work-page .header-logo,
.contact-page .header-logo,
.project-page .header-logo,
.automation-page .header-logo {
  display: none;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 110;
  position: absolute;
  right: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 1024px) {
  .mobile-menu-toggle {
    right: 20px;
    top: 15px;
    transform: none;
  }
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition: all 0.3s ease;
  display: block;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 105;
}

.mobile-menu.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: opacity 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
  opacity: 0.7;
}

.mobile-nav-link.active {
  font-weight: 700;
}

/* Intro section */
.intro-section {
  background: #CC0000;
  display: flex;
  justify-content: center;
  flex-direction: column;
  min-height: 300vh;
  position: relative;
  scroll-snap-align: start;
}

.intro-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 1200px;
  width: 100%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  /* Opacity is now controlled dynamically by JavaScript based on scroll position */
}

.intro-content * {
  pointer-events: auto;
}

.intro-description {
  font-size: clamp(1.2rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.4;
  margin-bottom: var(--spacing-lg);
  text-align: center;
  letter-spacing: -0.01em;
  max-width: 100%;
  padding: 0 20px;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.services-column {
  list-style: none;
  padding: 0;
  margin: 0;
}

.services-column li {
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.services-column li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-size: 1.2em;
}

.awards-section {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
  margin-top: 0;
}

.award-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.award-logo.clio {
  filter: brightness(0) invert(1);
}

.award-logo:hover {
  opacity: 1;
}

.award-logo.clio {
  height: 80px;
}

.award-logo.fwa {
  height: 50px;
}

/* Background layer for crossfading images/videos */
.background-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #000;
}

.background-layer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  z-index: 2;
  pointer-events: none;
}


.background-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity var(--transition-bg) ease-in-out;
}

.background-media.active {
  opacity: 1;
}

/* Supporting text container (bottom-right, fixed) */
.supporting-text-container {
  position: fixed;
  bottom: var(--spacing-lg);
  left: 50%;
  transform: translateX(-50%);
  max-width: 600px;
  z-index: 50;
  opacity: 0;
  transition: opacity var(--transition-text) ease-in-out var(--transition-text-delay);
  pointer-events: none;
  text-align: center;
}

.supporting-text-container.visible {
  opacity: 1;
}

.supporting-text {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Main content area */
main {
  position: relative;
  z-index: 10;
}

/* Card system - each card is 100vh */
.card {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  align-items: center;
  padding: var(--spacing-lg);
  position: relative;
  scroll-snap-align: start;
}

/* Add mobile browser bar compensation on mobile devices */
@media (max-width: 1024px) {
  .card {
    min-height: calc(100vh + 50px);
    height: calc(100vh + 50px);
  }

  .logo-intro-screen {
    min-height: calc(100vh + 50px);
    height: calc(100vh + 50px);
  }

  /* Intro section gets dynamic height on mobile */
  .intro-section {
    height: auto;
    min-height: calc(100vh + 50px);
    scroll-snap-align: none;
    padding: 180px var(--spacing-md) calc(var(--spacing-xl) + 80px);
  }
}

/* Smooth scroll snapping with mandatory snap points */
html {
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

/* Disable scroll snap on cards after a certain point */
body.scroll-past-projects .card {
  scroll-snap-align: none;
}

/* Logo intro screen */
.logo-intro-screen {
  justify-content: center;
  align-items: center;
  background: #000;
  position: relative;
  overflow: hidden;
}

.logo-red-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #B20000;
  opacity: 0;
  z-index: 1;
}

.phase-zero-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  text-align: center;
  color: white;
  opacity: 1;
  transition: opacity 0.3s ease-out;
  width: 100%;
  padding: 0 20px;
}

@media (max-width: 1024px) {
  .phase-zero-container {
    transform: translate(-50%, calc(-50% - 70px));
  }
}

.phase-zero-line {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.4;
  margin: 0;
  opacity: 0;
  transform: translateY(20px);
  width: 100%;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 48px;
  height: 48px;
  opacity: 0;
  animation: pulse 2s ease-in-out infinite;
  transition: opacity 0.3s ease-out;
}

@media (max-width: 1024px) {
  .scroll-indicator {
    bottom: 150px;
  }
}

.scroll-indicator svg {
  width: 100%;
  height: 100%;
  fill: white;
}

@keyframes pulse {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

.logo-intro-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  height: 100vh;
  width: auto;
  will-change: transform;
  z-index: 2;
  opacity: 0;
}

@media (max-width: 1024px) {
  .logo-intro-image {
    top: calc(50% - 70px);
  }
}

/* Project cards */
.project-card {
  justify-content: center;
  align-items: center;
}

.project-card-content {
  max-width: 100%;
  width: 100%;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.project-headline {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.1;
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.project-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

.project-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.1;
  margin-bottom: var(--spacing-xs);
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.project-client {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 300;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
}

.project-client-logo {
  max-width: 240px;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* Project detail page styles */
.project-page {
  background: #0a0a0a;
}

.project-hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.project-hero-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.project-hero-media.loaded {
  opacity: 1;
}

.project-hero .hero-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1;
  pointer-events: none;
}

.project-hero .hero-spinner.hidden {
  display: none;
}

.project-hero {
  background: #1a1a1a;
}

.project-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
  z-index: 1;
}

.project-hero-content {
  position: relative;
  z-index: 2;
  padding: var(--spacing-lg);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.project-detail-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.1;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
}

.project-detail-client {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  font-weight: 300;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
}

.project-detail-client-logo {
  max-width: 121px;
  max-height: 40px;
  margin-bottom: var(--spacing-md);
  filter: brightness(0) invert(1);
  opacity: 0.9;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.project-summary {
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.5;
  margin-bottom: var(--spacing-md);
  max-width: 700px;
}

.project-services {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

.service-tag {
  padding: var(--spacing-xs) var(--spacing-sm);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

/* Project body */
.project-body {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg);
}

.media-block {
  margin-bottom: var(--spacing-xl);
}

.media-block img,
.media-block video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}

/* Image loader styles */
.image-loader {
  position: relative;
  background: #333;
  border-radius: 8px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-loader img {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.image-loader.loaded img {
  opacity: 1;
}

.image-loader .spinner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.image-loader.loaded .spinner {
  display: none;
}

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

/* Scrolling container for long vertical screenshots */
.media-scroll-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 8px;
  background: #000;
  position: relative;
  cursor: grab;
}

.media-scroll-container:active {
  cursor: grabbing;
}

.media-scroll-container img {
  width: 100%;
  height: auto;
  border-radius: 8px 8px 0 0;
  display: block;
  pointer-events: none;
}

/* Mobile aspect ratio container */
.media-mobile-container {
  width: 100%;
  max-width: 375px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 8px;
  background: #000;
  position: relative;
  cursor: grab;
}

.media-mobile-container:active {
  cursor: grabbing;
}

.media-mobile-container img {
  width: 100%;
  height: auto;
  border-radius: 8px 8px 0 0;
  display: block;
  pointer-events: none;
}

/* Carousel container */
.media-carousel {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  position: relative;
}

.media-carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.media-carousel-track::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 0;
}

.media-carousel-track.loaded::before {
  display: none;
}

.media-carousel img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  border-radius: 8px;
}

.media-carousel img.loaded {
  opacity: 0;
}

.media-carousel img.active.loaded {
  opacity: 1;
  z-index: 1;
}

.carousel-indicators {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}

.carousel-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.3s ease;
}

.carousel-indicator.active {
  background: rgba(255, 255, 255, 0.9);
}

.media-caption {
  margin-top: var(--spacing-sm);
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  text-align: center;
  font-style: normal;
  font-weight: 400;
}

/* Navigation links */
.project-navigation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
}

.nav-link {
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--color-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus {
  outline-offset: 2px;
}

.project-nav-row {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  width: 100%;
  max-width: 1200px;
}

.project-nav-row .project-nav-card {
  max-width: 588px;
}

.project-nav-card {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.project-nav-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.project-nav-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-nav-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--spacing-md);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  color: var(--color-text);
}

.project-nav-text h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
}

.project-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.project-nav-arrow.prev {
  left: 5px;
}

.project-nav-arrow.next {
  right: 5px;
}

.project-nav-card:hover .project-nav-arrow {
  color: rgba(255, 255, 255, 1);
}

/* Mobile adjustments */
@media (max-width: 1024px) {
  .header-nav {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .header-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
  }

  /* Show header logo on mobile for all pages */
  .about-page .header-logo,
  .work-page .header-logo,
  .contact-page .header-logo,
  .project-page .header-logo {
    display: flex;
  }
}

@media (max-width: 768px) {
  .header {
    padding: var(--spacing-sm);
  }

  .header-logo img {
    height: 32px;
  }

  .intro-section {
    padding: var(--spacing-lg) var(--spacing-md) calc(var(--spacing-xl) + 100px);
    height: auto;
  }

  .intro-description {
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: var(--spacing-lg);
  }

  .services-column li {
    font-size: 0.95rem;
  }

  .awards-section {
    gap: 0.5rem;
    justify-content: center;
  }

  .award-logo.clio {
    height: 50px;
  }

  .award-logo.fwa {
    height: 40px;
    flex-basis: 100%;
    margin-top: var(--spacing-sm);
  }

  .card {
    padding: var(--spacing-md);
  }

  .project-client-logo {
    max-width: 160px;
    max-height: 80px;
  }

  .supporting-text-container {
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - var(--spacing-md) * 2);
    max-width: none;
    background: none;
    padding: var(--spacing-sm);
    border-radius: 0;
    backdrop-filter: none;
  }

  .project-hero-content,
  .project-body {
    padding: var(--spacing-md);
  }

  .project-detail-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
  }

  .project-services {
    gap: var(--spacing-xs);
  }

  .service-tag {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .project-nav-row {
    flex-direction: column;
  }

  .project-nav-card {
    min-height: 250px;
  }

  .project-nav-text h3 {
    font-size: 1.2rem;
  }

  .media-block {
    margin-bottom: var(--spacing-md);
  }

  .media-block img,
  .media-block video {
    border-radius: 4px;
    vertical-align: top;
  }

  .image-loader {
    min-height: 200px;
  }
}

/* Footer */
.footer {
  position: relative;
  z-index: 10;
  padding: var(--spacing-lg);
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.5s ease-in-out;
}

/* Hide footer initially on About, Contact, Work, Project, and Automation pages */
.about-page .footer,
.contact-page .footer,
.work-page .footer,
.project-page .footer,
.automation-page .footer {
  opacity: 0;
  pointer-events: none;
}

/* Show footer when page is loaded */
.about-page.page-loaded .footer,
.contact-page.page-loaded .footer,
.work-page.page-loaded .footer,
.project-page.page-loaded .footer,
.automation-page.page-loaded .footer {
  opacity: 1;
  pointer-events: auto;
}

/* Hide footer on homepage until user scrolls past intro */
body:not(.about-page):not(.work-page):not(.contact-page):not(.project-page):not(.automation-page):not(.footer-visible) .footer {
  opacity: 0;
  pointer-events: none;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.footer-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: opacity 0.2s ease;
}

.footer-link:hover {
  opacity: 0.7;
}

.footer-text {
  font-size: 0.8rem;
  opacity: 0.5;
  margin: 0;
}

.footer-text {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

.footer-disclaimer {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  opacity: 0.5;
  margin: 0.5rem 0 0;
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

a:focus-visible {
  outline-color: rgba(255, 255, 255, 0.9);
}

/* Contact Page Styles */
.contact-page {
  background: #0a0a0a;
  min-height: 100vh;
}

.contact-main {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--spacing-xl) + 80px) var(--spacing-md) var(--spacing-xl);
}

.contact-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.contact-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.1;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  text-align: center;
}

.contact-description {
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.5;
  margin-bottom: var(--spacing-xl);
  text-align: center;
  color: var(--color-text-secondary);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.form-input,
.form-textarea {
  padding: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--color-text);
  font-family: var(--font-primary);
  font-size: 1rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-submit {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-text);
  color: #000;
  border: none;
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  margin-top: var(--spacing-sm);
}

.form-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-2px);
}

.automation-page .form-submit {
  background: #CC0000;
  color: #fff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.automation-page .form-submit:hover:not(:disabled) {
  background: #aa0000;
  opacity: 1;
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-status {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: 4px;
  font-size: 0.95rem;
  text-align: center;
  display: none;
}

.form-status.success {
  display: block;
  background: rgba(76, 175, 80, 0.2);
  border: 1px solid rgba(76, 175, 80, 0.4);
  color: #4caf50;
}

.form-status.error {
  display: block;
  background: rgba(244, 67, 54, 0.2);
  border: 1px solid rgba(244, 67, 54, 0.4);
  color: #f44336;
}

/* About Page Styles */
.about-page {
  background: #CC0000;
  min-height: 100vh;
}

.about-page .intro-section {
  min-height: 100vh;
  padding-top: 120px;
}

.about-page .intro-content {
  opacity: 1;
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  padding: 0 20px;
  margin: 0 auto;
}

/* Page logo styles */
.page-logo-container {
  position: fixed;
  top: var(--spacing-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 101;
  opacity: 0;
  transition: opacity var(--transition-bg) ease-in-out;
}

.page-logo-container.visible {
  opacity: 1;
}

/* Hide page logo on homepage desktop (header already has logo) */
@media (min-width: 1025px) {
  body:not(.about-page):not(.work-page):not(.contact-page):not(.project-page):not(.automation-page) .page-logo-container {
    display: none;
  }
}

.page-logo-container img {
  height: 40px;
  width: auto;
  display: block;
}

@media (max-width: 768px) {
  .page-logo-container {
    top: var(--spacing-sm);
  }

  .page-logo-container img {
    height: 32px;
  }
}

/* Work Page Styles */
.work-page {
  background: #000;
}

/* ============================================================
   Automation Page Styles
   ============================================================ */

.automation-page {
  background: #0a0a0a;
  min-height: 100vh;
}

.automation-page .header {
  padding-left: var(--spacing-lg);
  padding-right: var(--spacing-lg);
  top: 0;
  transition: opacity var(--transition-bg) ease-in-out, top 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.automation-page .header.header-hidden {
  top: -100px;
}

.automation-page .header.header-scrolled {
  background: rgba(0, 0, 0, 0.95);
}

.automation-page .page-logo-container {
  transition: opacity var(--transition-bg) ease-in-out, top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.automation-page .page-logo-container.header-hidden {
  top: -80px;
}

.automation-page .header-nav {
  max-width: 100%;
}

.automation-page .nav-left,
.automation-page .nav-right {
  gap: var(--spacing-lg);
}

/* Hero */
.automation-hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px var(--spacing-md) var(--spacing-xl);
  text-align: center;
  overflow: hidden;
}

.automation-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.automation-hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1;
}

.automation-hero-content {
  position: relative;
  z-index: 2;
  max-width: 1080px;
  margin: 0 auto;
}

.automation-hero-headline {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  font-style: italic;
  line-height: 1.1;
  text-transform: uppercase;
  margin-bottom: var(--spacing-md);
}

.automation-hero-subhead {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.automation-cta-btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  background: #CC0000;
  color: #fff;
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s ease, transform 0.2s ease;
}

.automation-cta-btn:hover {
  background: #aa0000;
  transform: translateY(-2px);
}

/* Sections */
.automation-section {
  padding: var(--spacing-lg) var(--spacing-md);
}

.automation-section--alt {
  background: rgba(255, 255, 255, 0.03);
}

.automation-section--light {
  background: rgba(255, 255, 255, 0.06);
}

.automation-container {
  max-width: 1000px;
  margin: 0 auto;
}

.automation-container--narrow {
  max-width: 860px;
}

/* Labels and headings */
.automation-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #CC0000;
  margin-bottom: var(--spacing-sm);
}

.automation-section-headline {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.15;
  margin-bottom: var(--spacing-md);
  text-align: center;
}

/* Body copy */
.automation-body-copy {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  max-width: 720px;
  margin: 0 auto;
}

.automation-body-copy p,
.automation-body-text {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.75;
  color: var(--color-text-secondary);
}

.automation-centered {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

/* Services grid */
.automation-services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
}

.automation-service-card {
  padding: var(--spacing-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.automation-service-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  line-height: 1.3;
}

.automation-service-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* What We Build */
.automation-build-intro,
.automation-build-outro {
  text-align: center;
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.automation-build-intro {
  margin-bottom: var(--spacing-lg);
}

.automation-build-outro {
  margin-top: var(--spacing-lg);
  font-weight: 600;
  color: var(--color-text);
}

.automation-build-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.automation-build-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.automation-build-list li {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.5;
}

.automation-build-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: #CC0000;
  font-weight: 700;
}

/* How It Works steps */
.automation-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  max-width: 720px;
  margin: 0 auto;
}

.automation-step {
  display: flex;
  gap: var(--spacing-md);
  align-items: flex-start;
}

.automation-step-number {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #CC0000;
  padding-top: 4px;
  min-width: 2rem;
}

.automation-step-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.automation-step-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

/* Case Study */

.automation-case-logo {
  display: block;
  height: 28px;
  width: auto;
  margin-top: var(--spacing-md);
}

.automation-case-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--spacing-xl);
  align-items: start;
}

.automation-case-visual {
  position: sticky;
  top: 120px;
}

.automation-case-screenshot {
  width: 100%;
  display: block;
}

.automation-case-study {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.automation-case-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #CC0000;
  margin-bottom: var(--spacing-xs);
}

.automation-case-block p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
}

.automation-testimonial {
  background: #e6e6e6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  padding: var(--spacing-md);
  margin: 0;
}

.automation-testimonial-quote {
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.6;
  color: #111;
  margin-bottom: var(--spacing-sm);
}

.automation-testimonial-cite {
  font-size: 0.9rem;
  font-style: normal;
  color: #666;
}

/* Credentials */
.automation-credentials-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--spacing-lg);
  align-items: center;
}

.automation-credentials-text .automation-body-text + .automation-body-text {
  margin-top: var(--spacing-md);
}

.automation-headshot {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  transform: scale(1.08);
}

/* Contact section */
.automation-contact-subhead {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.7;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

#automation-form {
  max-width: 500px;
  margin: 0 auto;
}

/* Responsive */
@media (max-width: 900px) {
  .automation-services-grid {
    grid-template-columns: 1fr;
  }

  .automation-build-grid {
    grid-template-columns: 1fr;
    gap: 0.75em;
  }

  .automation-case-layout {
    grid-template-columns: 1fr;
  }

  .automation-case-visual {
    position: static;
    max-width: 280px;
    margin: 0 auto;
  }

  .automation-credentials-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .automation-hero {
    padding: 100px var(--spacing-sm) var(--spacing-lg);
  }

  .automation-section {
    padding: var(--spacing-md) var(--spacing-sm);
  }

  .automation-step {
    gap: var(--spacing-sm);
  }
}
