/*
 * Base layout styles for the unified BesserGrowen articles.
 *
 * This stylesheet defines a modern, responsive layout inspired by the
 * original grow-tipps page while aiming for a high PageSpeed score.  It
 * relies on CSS custom properties for easy theming and keeps the
 * critical styles minimal to reduce render‑blocking time.
 */

/* Theme variables */
:root {
  --primary-color: #6b46c1;
  --primary-light: #f3e8ff;
  --primary-dark: #553c9a;
  --secondary-color: #764ba2;
  --accent-color: #667eea;
  --background-color: #f8f9fa;
  --card-background: #ffffff;
  --text-color: #2d3748;
  --heading-color: #1a202c;
  --border-color: #e2e8f0;
  --success-color: #34a853;
  --danger-color: #ea4335;
  --border-radius: 12px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* Reset & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  /* Verhindere initialen künstlichen Overflow bevor Header injiziert wurde */
  padding-top: 0;
}
/* Sobald Header/Footer via JS geladen wurden */
body.hf-loaded { padding-top: 70px; }

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--card-background);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.site-logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--primary-color);
  text-decoration: none;
}
.site-nav a {
  margin-left: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--heading-color);
  text-decoration: none;
  transition: color 0.2s;
}
.site-nav a:hover {
  color: var(--primary-color);
}

/* Container */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  position: relative;
}

/* Hero section */
.hero-container {
  text-align: center;
  margin-bottom: 40px;
}
.hero-image {
  width: 100%;
  max-width: 320px;
  height: auto;
  border-radius: 20px;
  margin: 0 auto 24px;
  box-shadow: var(--shadow-sm);
  border: 3px solid #fff;
  display: block;
}
.hero-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.hero-tag,
.hero-date,
.hero-reading-time {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 16px;
  font-weight: 600;
}
.hero-tag {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
}
.hero-date {
  background: rgba(248,250,252,0.9);
  border: 1px solid var(--border-color);
  color: var(--text-color);
}
.hero-reading-time {
  background: rgba(107,70,193,0.1);
  color: var(--primary-color);
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 8px;
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--heading-color);
  margin-top: 8px;
}

/* Main content */
.main-content {
  background: var(--card-background);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}
.main-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
  border-radius: 24px 24px 0 0;
}
.main-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 24px 0 12px;
  position: relative;
  padding-left: 20px;
}
.main-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}
.main-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--heading-color);
  margin: 18px 0 8px;
}
.main-content p {
  margin-bottom: 18px;
  font-size: 1rem;
  color: var(--text-color);
}
.main-content ul,
.main-content ol {
  margin: 18px 0 18px 20px;
}
.main-content li {
  margin-bottom: 6px;
}

/* Progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(107,70,193,0.1);
  z-index: 2000;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 100%);
  transition: width 0.1s ease;
  box-shadow: 0 0 6px rgba(102,126,234,0.5);
}

/* Progress tracker */
.progress-tracker {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 16px 12px;
  box-shadow: var(--shadow-sm);
  z-index: 1200;
  max-height: 70vh;
  overflow-y: auto;
  display: none;
}
.progress-tracker h4 {
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 700;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s ease;
  cursor: pointer;
}
.progress-step .step-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
}
.progress-step .step-label {
  font-size: 0.8rem;
  color: #4b5563;
  font-weight: 500;
}
.progress-step.active {
  background: rgba(103,70,193,0.1);
}
.progress-step.completed {
  background: rgba(52,168,83,0.1);
}
.progress-step.completed .step-icon {
  background: var(--success-color);
  color: #fff;
}
.progress-step.active .step-icon {
  background: var(--primary-color);
  color: #fff;
}

/* Floating action button */
.fab-reading {
  display: none !important;
}
.fab-reading:hover {
  transform: scale(1.08);
}

/* Current chapter display */
.current-chapter {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  max-width: 300px;
  text-align: center;
}
.current-chapter.visible {
  opacity: 1;
  visibility: visible;
}

/* TOC overlay */
.toc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 1400;
}
.toc-overlay.active {
  opacity: 1;
  visibility: visible;
}
.toc-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--card-background);
  border-radius: 24px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease;
}
.toc-overlay.active .toc-modal {
  transform: translate(-50%, -50%) scale(1);
}
.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}
.toc-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
}
.toc-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
}
.toc-content a {
  display: block;
  padding: 10px 0;
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
  transition: color 0.15s ease;
}
.toc-content a:hover {
  color: var(--primary-color);
}
/* Responsive */
@media (max-width: 768px) {
  /* Hide ALL reading progress elements on mobile */
  .reading-progress,
  .reading-progress-bar,
  .reading-progress-bar-container,
  /* also hide the floating side progress tracker and its FAB on small screens */
  .progress-tracker,
  .fab-reading {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .progress-tracker {
    display: block;
  }
  .fab-reading {
    display: none !important;
  }
}

/* === GLOBAL UGC GALLERY (Glass Cards) ===
   These styles mirror the ones in thai.css so short pages that only load
   layout.css get the same gallery appearance as long pages that include
   strain-specific CSS. */
.user-generated-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
}
.ugc-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 3/4;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.4);
  transition: box-shadow .4s ease;
}
.ugc-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,0) 60%);
  z-index: 1;
}
.ugc-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.03);
  transition: transform .8s ease;
  will-change: transform;
}
.ugc-card:hover img { transform: scale(1.12); }
.ugc-card:hover { box-shadow: 0 10px 28px -6px rgba(0,0,0,0.55); }
.ugc-meta {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: .85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  color: #fff;
  font-size: .8rem;
  line-height: 1.2;
  letter-spacing: .3px;
}
.ugc-rows { display: flex; flex-direction: column; gap: .45rem; }
.ugc-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .7rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .7px;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  text-decoration: none;
  position: relative;
}
.badge-platform {
  background: linear-gradient(90deg,#ef4444,#f97316,#f59e0b);
  border: 1px solid rgba(255,255,255,.4);
  box-shadow: 0 0 0 1px rgba(0,0,0,.15), 0 4px 12px -4px rgba(0,0,0,.5);
}
.ugc-source-link:hover { background: rgba(255,255,255,.28); }
@media (prefers-reduced-motion: reduce) { .ugc-card img, .ugc-card { transition: none; } }
@media (max-width: 640px){ .ugc-card { aspect-ratio: 4/5; } }
body.light .ugc-card { background: rgba(255,255,255,0.6); }