/**
 * ============================================================================
 * EEC GERMAN UNIVERSITY FINDER - CRITICAL CSS
 * Version: 2.0.0 | Last Updated: December 20, 2026
 * 
 * This file provides:
 * - Critical path CSS for above-fold content
 * - Print styles for document export
 * - Accessibility enhancements
 * - Performance optimizations
 * ============================================================================
 */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================ */
:root {
  /* German Flag Colors */
  --german-black: #000000;
  --german-red: #dd0000;
  --german-gold: #ffcc00;

  /* Brand Colors */
  --eec-primary: #003399;
  --eec-secondary: #ffce00;
  --eec-accent: #dd0000;

  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-mono: "Fira Code", "Monaco", monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-Index Scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-tooltip: 400;
  --z-toast: 500;
}

/* ============================================================================
   CRITICAL ABOVE-FOLD STYLES
   ============================================================================ */

/* Prevent FOUC (Flash of Unstyled Content) */
html {
  visibility: visible;
  opacity: 1;
}

/* Base Typography */
body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #f8f9fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus Styles */
:focus-visible {
  outline: 3px solid var(--german-gold);
  outline-offset: 2px;
}

/* Skip Link */
.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;
}

.sr-only:focus,
.focus\:not-sr-only:focus {
  position: absolute;
  width: auto;
  height: auto;
  padding: 1rem 2rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  z-index: 9999;
  background: var(--german-black);
  color: white;
  border-radius: var(--radius-md);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --german-gold: #ffd700;
    --eec-primary: #0000ff;
  }

  body {
    background: white;
    color: black;
  }
}

/* ============================================================================
   GERMAN FLAG GRADIENT UTILITIES
   ============================================================================ */

.german-gradient {
  background: linear-gradient(
    90deg,
    var(--german-black) 0%,
    var(--german-red) 50%,
    var(--german-gold) 100%
  );
}

.german-gradient-border {
  position: relative;
}

.german-gradient-border::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--german-black) 0%,
    var(--german-red) 50%,
    var(--german-gold) 100%
  );
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-slow);
}

.german-gradient-border:hover::after {
  transform: scaleX(1);
}

/* ============================================================================
   LOADING & SKELETON STATES (Prevents CLS)
   ============================================================================ */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Chart Container - Fixed dimensions to prevent CLS */
.chart-container {
  min-height: 200px;
  min-width: 300px;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
  /* Reset backgrounds for print */
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Hide non-essential elements */
  .no-print,
  nav,
  .sticky,
  button:not(.print-btn),
  .modal,
  .tooltip,
  footer .social-links,
  .whatsapp-float {
    display: none !important;
  }

  /* Page breaks */
  h1,
  h2,
  h3 {
    page-break-after: avoid;
    break-after: avoid;
  }

  table,
  figure,
  img {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Links */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  a[href^="tel"]:after,
  a[href^="mailto"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  /* Table styling for print */
  table {
    border-collapse: collapse;
    width: 100%;
  }

  th,
  td {
    border: 1px solid #333;
    padding: 8px;
    text-align: left;
  }

  th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  /* University comparison cards */
  .university-card {
    border: 1px solid #ccc;
    padding: 1rem;
    margin-bottom: 1rem;
    page-break-inside: avoid;
  }

  /* Print header */
  @page {
    margin: 2cm;
    @top-center {
      content: "EEC German University Finder - germany.eecglobal.com/public";
    }
    @bottom-center {
      content: "Page " counter(page) " of " counter(pages);
    }
  }

  /* First page */
  @page :first {
    @top-center {
      content: "";
    }
  }
}

/* ============================================================================
   SPEAKABLE CONTENT (For Voice Assistants)
   ============================================================================ */

[data-speakable] {
  /* Marker for content optimized for voice search */
}

.speakable {
  /* Content that should be read by voice assistants */
}

/* ============================================================================
   AI ANSWER BLOCKS (For Featured Snippets & AI Overview)
   ============================================================================ */

[data-answer] {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-left: 4px solid var(--eec-primary);
  padding: 1rem 1.5rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

[data-answer]::before {
  content: "Quick Answer: ";
  font-weight: 700;
  color: var(--eec-primary);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================================
   COMPARISON TABLES (Featured Snippet Optimization)
   ============================================================================ */

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.comparison-table th {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}

.comparison-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.comparison-table tr:nth-child(even) {
  background: #f8fafc;
}

.comparison-table tr:hover {
  background: #fef9c3;
}

/* Winner highlighting */
.comparison-table .winner {
  background: #dcfce7 !important;
  font-weight: 600;
}

.comparison-table .winner::after {
  content: " ✓";
  color: #16a34a;
}

/* ============================================================================
   GLOSSARY STYLES (For DefinedTerm Schema)
   ============================================================================ */

.glossary-term {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border-radius: var(--radius-lg);
  background: white;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
  transition: all var(--transition-base);
}

.glossary-term:hover {
  border-color: var(--german-gold);
  box-shadow: var(--shadow-md);
}

.glossary-term dt {
  font-weight: 700;
  color: var(--german-black);
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.glossary-term dt .pronunciation {
  font-weight: 400;
  color: #64748b;
  font-size: 0.875rem;
  font-style: italic;
}

.glossary-term dd {
  margin-top: 0.5rem;
  color: #475569;
  line-height: 1.6;
}

/* ============================================================================
   BREADCRUMB STYLES
   ============================================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #64748b;
  padding: 0.75rem 0;
}

.breadcrumb a {
  color: var(--eec-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--german-red);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: #cbd5e1;
}

.breadcrumb-current {
  color: #1e293b;
  font-weight: 500;
}

/* ============================================================================
   TRUST BADGES
   ============================================================================ */

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  transition: all var(--transition-base);
}

.trust-badge:hover {
  border-color: var(--german-gold);
  box-shadow: var(--shadow-sm);
}

.trust-badge img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ============================================================================
   AUTHOR BYLINE
   ============================================================================ */

.author-byline {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  margin: 1.5rem 0;
}

.author-byline img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.author-byline-content {
  flex: 1;
}

.author-byline-name {
  font-weight: 600;
  color: #1e293b;
}

.author-byline-name a {
  color: inherit;
  text-decoration: none;
}

.author-byline-name a:hover {
  color: var(--eec-primary);
}

.author-byline-title {
  font-size: 0.875rem;
  color: #64748b;
}

.author-byline-date {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ============================================================================
   FLOATING CTA
   ============================================================================ */

.floating-cta {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: var(--z-sticky);
}

.floating-cta-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  border: none;
  cursor: pointer;
}

.floating-cta-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

.floating-cta-btn.whatsapp {
  background: #25d366;
}

.floating-cta-btn.phone {
  background: var(--eec-primary);
}

/* ============================================================================
   PROGRESS INDICATOR
   ============================================================================ */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  z-index: var(--z-sticky);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--german-black) 0%,
    var(--german-red) 50%,
    var(--german-gold) 100%
  );
  transition: width var(--transition-base);
}

/* ============================================================================
   RESPONSIVE UTILITIES
   ============================================================================ */

@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }

  .comparison-table {
    font-size: 0.8125rem;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 0.5rem;
  }

  .floating-cta {
    bottom: 1rem;
    right: 1rem;
  }

  .floating-cta-btn {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 768px) {
  .hide-tablet {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Text utilities */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

/* Container */
.container-prose {
  max-width: 65ch;
  margin: 0 auto;
}

/* Aspect ratios */
.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-square {
  aspect-ratio: 1 / 1;
}

/* ============================================================================
   END OF CRITICAL CSS
   ============================================================================ */
