:root {
  /* Soft Modern Palette */
  --color-bg: #fafafc;
  --color-surface: #ffffff;
  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-secondary: #f0fdf4;
  --color-secondary-text: #166534;
  --color-text-main: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-error: #ef4444;
  --color-focus: rgba(99, 102, 241, 0.5);

  /* Spacing Scale */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-40: 40px;
  --space-64: 64px;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Borders & Shadows */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 50px -10px rgba(99, 102, 241, 0.1);
  
  /* Layout */
  --container-max: 1200px;
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography Constraints */
h1, h2, h3, h4, h5, h6, a, .brand-name {
  overflow-wrap: anywhere;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; margin-bottom: var(--space-24); color: #111827; }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); line-height: 1.2; margin-bottom: var(--space-16); margin-top: var(--space-40); color: #111827; }
h3 { font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1.3; margin-bottom: var(--space-16); margin-top: var(--space-24); color: #1f2937; }
p { margin-bottom: var(--space-16); }

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

a:hover {
  color: var(--color-primary-hover);
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Structural Components */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-24);
  min-width: 0;
}

/* Header */
.site-header {
  height: 64px;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text-main);
  text-decoration: none;
  z-index: 100;
}

.logo-block svg {
  width: 28px;
  height: 28px;
  fill: var(--color-primary);
}

.main-nav {
  display: flex;
  gap: var(--space-24);
  align-items: center;
}

.nav-link {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-link:hover {
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  z-index: 100;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  background-color: var(--color-primary);
  color: #ffffff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn:hover {
  background-color: var(--color-primary-hover);
  color: #ffffff;
}

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

.btn-outline:hover {
  background-color: var(--color-border);
  color: var(--color-text-main);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-8);
  color: var(--color-text-main);
}

/* Hero Section */
.hero {
  padding: var(--space-64) 0;
  text-align: center;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  border-radius: var(--radius-lg);
  margin: var(--space-24);
  box-shadow: var(--shadow-soft);
}

.hero p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto var(--space-24);
}

/* Card Style: Data Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-40);
  margin-top: var(--space-40);
  margin-bottom: var(--space-64);
}

.data-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--color-border);
}

.data-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  color: inherit;
}

.card-data-header {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--color-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-16) var(--space-24);
  gap: var(--space-16);
}

.data-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.data-stat .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.data-stat .value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-secondary-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-media {
  width: 100%;
  height: 200px;
  background-color: var(--color-border);
  position: relative;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: var(--space-24);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-content h3 {
  margin-top: 0;
  margin-bottom: var(--space-12);
}

.card-content p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Page Layouts */
.page-wrapper {
  flex: 1;
  padding: var(--space-40) 0;
}

.content-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-40);
  max-width: 800px;
  margin: 0 auto;
}

.article-header {
  margin-bottom: var(--space-40);
}

.article-meta {
  display: flex;
  gap: var(--space-16);
  flex-wrap: wrap;
  margin-bottom: var(--space-16);
}

.badge {
  background-color: var(--color-secondary);
  color: var(--color-secondary-text);
  padding: var(--space-4) var(--space-12);
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.prose-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--space-24) 0;
  box-shadow: var(--shadow-soft);
}

.prose ul, .prose ol {
  margin-bottom: var(--space-16);
  padding-left: var(--space-24);
}

.prose li {
  margin-bottom: var(--space-8);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-24) 0;
  display: block;
  overflow-x: auto;
}

.prose th, .prose td {
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--color-border);
  text-align: left;
  min-width: 120px;
}

.prose th {
  background-color: #f3f4f6;
  font-weight: 600;
}

/* Contact Page Specifics */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-40);
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  margin-bottom: var(--space-24);
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-8);
  color: var(--color-text-main);
}

.form-control {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background-color: var(--color-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-focus);
}

.form-control.is-invalid {
  border-color: var(--color-error);
}

.error-message {
  display: none;
  color: var(--color-error);
  font-size: 0.85rem;
  margin-top: var(--space-8);
}

.form-control.is-invalid + .error-message {
  display: block;
}

.map-placeholder {
  width: 100%;
  height: 300px;
  background: linear-gradient(135deg, #e5e7eb 25%, transparent 25%) -50px 0,
              linear-gradient(225deg, #e5e7eb 25%, transparent 25%) -50px 0,
              linear-gradient(315deg, #e5e7eb 25%, transparent 25%),
              linear-gradient(45deg, #e5e7eb 25%, transparent 25%);
  background-size: 100px 100px;
  background-color: #f3f4f6;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-weight: 600;
  border: 1px solid var(--color-border);
}

/* Footer */
.site-footer {
  background-color: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-64) 0 var(--space-24);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-40);
  margin-bottom: var(--space-40);
}

.footer-col h4 {
  font-size: 1.1rem;
  margin-bottom: var(--space-16);
  color: var(--color-text-main);
}

.footer-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-nav a {
  color: var(--color-text-muted);
}

.footer-nav a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-24);
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-surface);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: var(--space-16) var(--space-24);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.cookie-banner.is-visible {
  transform: translateY(0);
}

.cookie-content {
  font-size: 0.9rem;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
}

@media (min-width: 768px) {
  .cookie-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Responsive Overrides */
@media (max-width: 767px) {
  .site-header {
    height: 52px;
  }
  
  .main-nav {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    width: 100%;
    background-color: var(--color-surface);
    flex-direction: column;
    padding: var(--space-24);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--color-border);
  }
  
  .main-nav.is-visible {
    display: flex;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .header-actions .btn {
    display: none;
  }
  
  .hero {
    margin: var(--space-16) 0;
    border-radius: 0;
  }

  .card-data-header {
    padding: var(--space-12);
    gap: var(--space-8);
  }

  .data-stat .label {
    font-size: 0.65rem;
  }
  
  .data-stat .value {
    font-size: 0.8rem;
  }
}

@media (max-width: 399px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  
  .card-data-header {
    grid-template-columns: 1fr;
  }
  
  .data-stat {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

/* Accessibility */
@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;
  }
}

[hidden] {
  display: none !important;
}