/* Aegade Raamat - Modern Design System */
/* Theme-aware, Bento Grid, Premium Typography */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Custom Properties - Theme Colors */
:root {
  /* Light theme defaults */
  --bg-primary: #FAFAF9;
  --bg-secondary: #FFFFFF;
  --bg-accent: #F3F0ED;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border-color: #E5D5C0;
  --accent-primary: #8D4436;
  --accent-secondary: #D4A574;
  --accent-tertiary: #A1887F;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-dark: rgba(0, 0, 0, 0.15);
  --gradient-primary: linear-gradient(135deg, #8D4436 0%, #D4A574 100%);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Sizing */
  --spacing-unit: 1rem;
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 16px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Shadows */
  --shadow-sm: 0 1px 2px var(--shadow-light);
  --shadow-md: 0 4px 6px var(--shadow-medium);
  --shadow-lg: 0 10px 15px var(--shadow-dark);
  --shadow-xl: 0 20px 25px var(--shadow-dark);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal),
              color var(--transition-normal);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.8rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h4 {
  font-size: 1.375rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Header & Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow-light);
  transition: all var(--transition-normal);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  gap: 2rem;
}

.navbar-brand {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-primary);
  transition: color var(--transition-fast);
}

.navbar-brand:hover {
  color: var(--accent-secondary);
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

.nav-link {
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  font-weight: 500;
  border-radius: var(--radius-small);
  transition: background-color var(--transition-fast), color var(--transition-fast);
  cursor: pointer;
}

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

.nav-link.active {
  background-color: var(--accent-primary);
  color: #FFFFFF;
}

/* Header Controls */
.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-left: auto;
}

select[data-lang-selector],
button[data-theme-toggle] {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-small);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

select[data-lang-selector]:hover,
button[data-theme-toggle]:hover {
  background-color: var(--bg-accent);
  border-color: var(--accent-primary);
}

/* Responsive Navigation */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.5rem;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  transition: all var(--transition-fast);
}

@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    gap: 0;
  }

  .navbar-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    display: none;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-medium);
    gap: 0;
    padding: 0;
    list-style: none;
    z-index: 1000;
  }

  .navbar-nav.active {
    display: flex;
  }

  .navbar-nav li {
    border-bottom: 1px solid var(--border-color);
  }

  .navbar-nav li:last-child {
    border-bottom: none;
  }

  .nav-link {
    padding: 1rem;
    border-radius: 0;
    width: 100%;
    text-align: left;
    margin: 0;
  }

  .hamburger {
    display: flex;
    order: 2;
    margin: 0;
    padding: 0.5rem;
  }

  .navbar-brand {
    order: 1;
  }

  .header-controls {
    margin-left: 0;
    order: 3;
    gap: 0.5rem;
    margin: 0;
  }
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Bento Grid System */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.bento-item {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  padding: 2rem;
  transition: all var(--transition-normal);
  overflow: hidden;
  position: relative;
}

.bento-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.bento-item.large {
  grid-column: span 2;
}

.bento-item.tall {
  grid-row: span 2;
}

.bento-item.featured {
  background: var(--gradient-primary);
  color: #FFFFFF;
}

.bento-item.featured a {
  color: #FFFFFF;
  text-decoration: underline;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-large);
  padding: 1.5rem;
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--accent-primary);
}

/* Hero Section */
.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #FFFFFF;
  overflow: hidden;
  margin-bottom: 3rem;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('') center / cover;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
  animation: slideUp 0.8s ease-out;
}

.hero h1 {
  color: #FFFFFF;
  margin-bottom: 1rem;
  animation: slideUp 0.8s ease-out 0.1s backwards;
}

.hero p {
  color: #FFFFFF;
  font-size: 1.25rem;
  margin-bottom: 2rem;
  animation: slideUp 0.8s ease-out 0.2s backwards;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  animation: slideUp 0.8s ease-out 0.3s backwards;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-medium);
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  text-decoration: none;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-accent);
  border-color: var(--accent-primary);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Sections */
section {
  padding: 3rem 0;
}

section.alternate {
  background-color: var(--bg-accent);
}

.section-title {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 3rem;
  color: var(--accent-primary);
}

/* Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-large);
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.card-img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
}

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

.card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--accent-primary);
}

.card-text {
  margin-bottom: 1rem;
}

.card-footer {
  margin-top: auto;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 2rem;
  margin: 2rem 0;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .bento-item.large {
    grid-column: span 1;
  }
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-small);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(141, 68, 54, 0.1);
}

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

/* Footer */
footer {
  background-color: var(--accent-primary);
  color: #FFFFFF;
  padding: 3rem 0 1rem;
  margin-top: 3rem;
  transition: all var(--transition-normal);
}

footer h6 {
  color: #FFFFFF;
  margin-bottom: 1rem;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
}

footer p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

footer a {
  color: #FFFFFF;
  text-decoration: none;
  transition: color var(--transition-fast);
}

footer a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.footer-divider {
  width: 60px;
  height: 2px;
  background-color: var(--accent-secondary);
  margin: 1rem 0;
  display: inline-block;
}

/* Cookie Consent */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 1.5rem;
  box-shadow: 0 -4px 12px var(--shadow-medium);
  z-index: 99;
  display: none;
  animation: slideUp 0.3s ease-out;
}

.cookie-banner.show {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  .cookie-banner.show {
    flex-direction: column;
    align-items: stretch;
  }
}

/* List Styles */
.list-unstyled {
  list-style: none;
  padding: 0;
}

.list-unstyled li {
  padding: 0.75rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.list-unstyled li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-weight: bold;
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Stagger animations for multiple elements */
.stagger-content > * {
  animation: slideUp 0.6s ease-out both;
}

.stagger-content > :nth-child(1) { animation-delay: 0.1s; }
.stagger-content > :nth-child(2) { animation-delay: 0.2s; }
.stagger-content > :nth-child(3) { animation-delay: 0.3s; }
.stagger-content > :nth-child(4) { animation-delay: 0.4s; }
.stagger-content > :nth-child(5) { animation-delay: 0.5s; }

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-5 { margin-bottom: 3rem; }

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.py-5 {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.rounded {
  border-radius: var(--radius-large);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

/* Responsive Typography */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
  }

  .hero {
    min-height: 350px;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .bento-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .container {
    padding: 0 0.75rem;
  }

  section {
    padding: 2rem 0;
  }
}

/* Print Styles */
@media print {
  body {
    background-color: #FFFFFF;
    color: #000000;
  }

  header,
  footer {
    display: none;
  }
}

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

:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
