/**
 * Cytria Website Upgrade 2026
 * 10/10 Premium Swiss AI Consulting Design
 * L5 Multi-Model Consensus Implementation
 */

/* ========================================
   P0: MOBILE HAMBURGER MENU WITH GEAR
   ======================================== */

/* Mobile menu trigger button */
.mobile-nav-trigger {
  display: none;
  width: 48px;
  height: 48px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease, background 0.3s ease;
  z-index: 1001;
}

.mobile-nav-trigger:hover {
  background: rgba(160, 136, 96, 0.1);
}

.mobile-nav-trigger:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Gear icon SVG */
.gear-icon {
  width: 24px;
  height: 24px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.mobile-nav-trigger[aria-expanded="true"] .gear-icon {
  transform: rotate(180deg);
}

/* Mobile navigation panel */
.mobile-nav-panel {
  display: none; /* Hide on desktop by default */
  pointer-events: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto !important; /* Override generic nav left:0 from inline styles */
  width: 100%;
  max-width: 320px;
  background: rgba(19, 19, 22, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1000;
  padding: 6rem 2rem 2rem;
  border-left: 1px solid var(--border);
}

.mobile-nav-panel.active {
  pointer-events: auto;
  transform: translateX(0);
}

/* Mobile nav overlay */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 999;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile nav links grid */
.mobile-nav-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  list-style: none;
  margin-bottom: 2rem;
}

.mobile-nav-links a {
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.mobile-nav-links a:hover,
.mobile-nav-links a:focus {
  border-color: var(--accent);
  background: var(--surface-2);
}

.mobile-nav-links .nav-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.mobile-nav-links .nav-text {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  color: var(--text);
}

/* Mobile CTA */
.mobile-nav-cta {
  display: block;
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: var(--bg);
  text-align: center;
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 8px;
  transition: background 0.3s ease;
}

.mobile-nav-cta:hover {
  background: #b8996e;
}

/* Show mobile trigger, hide desktop nav on mobile */
@media (max-width: 900px) {
  .mobile-nav-trigger {
    display: flex;
  }
  
  .nav-links,
  nav .nav-cta {
    display: none;
  }
}

/* ========================================
   P0: WCAG 2.1 AA COMPLIANCE
   ======================================== */

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg);
  padding: 1rem 2rem;
  z-index: 9999;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0 0 8px 8px;
  transition: top 0.3s ease;
}

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

/* Enhanced focus indicators */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Ensure minimum touch targets */
button,
a.nav-cta,
a.hero-cta,
.service,
.mobile-nav-links a {
  min-height: 44px;
  min-width: 44px;
}

/* Form error states - not just color */
input:invalid,
textarea:invalid {
  border-color: #ef4444;
  border-width: 2px;
}

input:invalid::before,
textarea:invalid::before {
  content: "⚠ ";
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   P1: BENTO GRID SERVICES LAYOUT
   ======================================== */

.services-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

/* Featured service - spans 8 columns */
.service-bento.featured {
  grid-column: span 8;
  grid-row: span 2;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 3rem;
  display: flex;
  flex-direction: column;
}

.service-bento.featured h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.service-bento.featured .service-price {
  font-size: 2rem;
}

/* Standard bento cards - span 4 columns */
.service-bento {
  grid-column: span 4;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.service-bento:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(160, 136, 96, 0.1);
}

.service-bento h3 {
  font-family: 'EB Garamond', serif;
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 0.8rem;
}

.service-bento p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.7;
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.service-bento .service-price {
  font-family: 'EB Garamond', serif;
  font-size: 1.4rem;
  color: var(--accent);
}

/* Responsive bento */
@media (max-width: 1100px) {
  .service-bento.featured {
    grid-column: span 12;
    grid-row: span 1;
  }
  .service-bento {
    grid-column: span 6;
  }
}

@media (max-width: 600px) {
  .service-bento,
  .service-bento.featured {
    grid-column: span 12;
  }
}

/* ========================================
   P1: TEAM PHOTOS - HUMAN TOUCH
   ======================================== */

.team-member-upgraded {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface);
}

.team-member-upgraded img {
  width: 100%;
  height: auto;
  display: block;
  filter: none !important; /* Remove grayscale */
  transition: transform 0.5s ease;
}

.team-member-upgraded:hover img {
  transform: scale(1.05);
}

/* Brand overlay on hover */
.team-member-upgraded::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 40%,
    rgba(160, 136, 96, 0.2) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.team-member-upgraded:hover::after {
  opacity: 1;
}

/* Role badge */
.team-role-badge {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(9, 9, 11, 0.9);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  backdrop-filter: blur(10px);
}

/* ========================================
   P1: VERIFIABLE COMPLIANCE BADGES
   ======================================== */

.compliance-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.compliance-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  min-width: 100px;
}

.compliance-badge:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}

.compliance-badge:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.compliance-badge img,
.compliance-badge svg {
  width: 32px;
  height: 32px;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.compliance-badge .badge-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.compliance-badge .badge-status {
  font-size: 0.6rem;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ========================================
   P2: GEARBOX ANIMATION (ANTIKYTHERA)
   ======================================== */

.gearbox-visual {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.3s ease;
}

.gearbox-visual:hover {
  opacity: 0.3;
}

.gearbox-visual .gear-outer {
  animation: rotate-gear 25s linear infinite;
}

.gearbox-visual .gear-inner {
  animation: rotate-gear 18s linear infinite reverse;
  transform-origin: center;
}

@keyframes rotate-gear {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Hide on mobile */
@media (max-width: 768px) {
  .gearbox-visual {
    display: none;
  }
}

/* ========================================
   P2: RESOURCE DOWNLOADS
   ======================================== */

.resource-card-upgraded {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.3s ease;
}

.resource-card-upgraded:hover {
  border-color: var(--accent);
}

.resource-card-upgraded h3 {
  font-family: 'EB Garamond', serif;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.resource-card-upgraded p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.download-gate {
  display: flex;
  gap: 0.5rem;
}

.download-gate input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
}

.download-gate input[type="email"]:focus {
  border-color: var(--accent);
  outline: none;
}

.download-gate button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease;
}

.download-gate button:hover {
  background: #b8996e;
}

/* ========================================
   P3: MOTION DESIGN
   ======================================== */

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .gearbox-visual {
    display: none;
  }
}

/* Section reveal on scroll */
.section-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   P3: PERFORMANCE - CRITICAL PATH
   ======================================== */

/* Optimize font loading */
.fonts-loaded body {
  font-family: 'Inter', -apple-system, sans-serif;
}

.fonts-loaded .serif {
  font-family: 'EB Garamond', Georgia, serif;
}

/* Content visibility for below-fold sections */
section:not(.hero) {
  content-visibility: auto;
  contain-intrinsic-size: 0 500px;
}

/* GPU acceleration for animations */
.mobile-nav-panel,
.mobile-nav-overlay,
.gearbox-visual,
.section-reveal {
  will-change: transform, opacity;
}

/* ========================================
   ADDITIONAL POLISH
   ======================================== */

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px; /* Account for fixed nav */
}

/* Selection color */
::selection {
  background: rgba(160, 136, 96, 0.3);
  color: var(--text);
}

/* Scrollbar styling (webkit) */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Print styles */
@media print {
  .mobile-nav-trigger,
  .mobile-nav-panel,
  .mobile-nav-overlay,
  .gearbox-visual,
  nav {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ========================================
   FIX: Target actual HTML classes
   ======================================== */

/* Services Grid - matches existing .services-grid and .service */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.service {
  background: var(--surface, #131316);
  border: 1px solid var(--border, #27272a);
  border-radius: 12px;
  padding: 2rem;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.service:hover {
  border-color: var(--accent, #D7A44B);
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.service:first-child {
  grid-column: span 2;
}

@media (max-width: 900px) {
  .service:first-child {
    grid-column: span 1;
  }
}

/* Team/Person Section - matches existing .person */
.person {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  transition: transform 0.4s ease;
}

.person:hover {
  transform: scale(1.02);
}

.person-photo {
  filter: none !important;
  transition: transform 0.4s ease;
}

.person:hover .person-photo {
  transform: scale(1.05);
}

.person::after {
  content: ;
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(160, 136, 96, 0.15) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.person:hover::after {
  opacity: 1;
}

.person-role {
  display: inline-block;
  background: rgba(9, 9, 11, 0.9);
  border: 1px solid var(--accent, #D7A44B);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* Compliance Badges - matches existing .compliance-badges */
.compliance-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.compliance-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem;
  background: var(--surface, #131316);
  border: 1px solid var(--border, #27272a);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
  min-width: 100px;
}

.compliance-badge:hover {
  border-color: var(--accent, #D7A44B);
  background: var(--surface-2, #1a1a1f);
  transform: translateY(-2px);
}

/* Approach Steps Enhancement */
.approach-step {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.approach-step:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Hero Section Enhancement */
.hero {
  position: relative;
}

.hero-stat {
  transition: transform 0.3s ease;
}

.hero-stat:hover {
  transform: scale(1.05);
}

/* Contact Form Enhancement */
.contact-form input,
.contact-form textarea,
.contact-form select {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
  border-color: var(--accent, #D7A44B);
  box-shadow: 0 0 0 3px rgba(160, 136, 96, 0.1);
}

/* Footer Enhancement */
footer {
  position: relative;
}

footer a {
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--accent, #D7A44B);
}

/* Nav Links Enhancement */
.nav-links a {
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a::after {
  content: ;
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent, #D7A44B);
  transition: width 0.3s ease;
}

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

/* Problem Section Enhancement */
.problem-stat {
  transition: transform 0.3s ease;
}

.problem-stat:hover {
  transform: scale(1.05);
}


/* Mobile nav visibility - desktop hidden, mobile visible */
@media (min-width: 901px) {
  .mobile-nav-panel,
  .mobile-nav-overlay,
  .mobile-nav-trigger {
    display: none !important;
  }
}

@media (max-width: 900px) {
  .mobile-nav-trigger {
    display: flex !important;
  }
  
  .mobile-nav-panel {
    display: block !important;
    visibility: hidden;
    transform: translateX(100%);
    pointer-events: none;
  }

  .mobile-nav-panel.active {
    visibility: visible !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }
  
  .mobile-nav-overlay {
    display: block !important;
    visibility: hidden;
    opacity: 0;
  }
  
  .mobile-nav-overlay.active {
    visibility: visible !important;
    opacity: 1 !important;
  }
}
