:root {
  /* Default Dark Theme */
  --primary-color: #3b82f6;
  --text-color: #e2e8f0;
  --text-light: #94a3b8;
  --bg-color: #1a1a20;
  --card-bg: #272730;
  --border-color: #3f3f4e;
  --font-sans: 'Inter', Arial, sans-serif;
  --max-width: 900px;
  --border-radius: 4px;

  --header-bg: #111115;
  --header-border: #555;
  --footer-bg: #111;
  --footer-border: #222;
  --footer-text: #666;
  --heading-color: #ffffff;
  --brand-text: #8da0b3;
  --brand-hover-text: #ffffff;
  --category-thumb-border: #000000;
  --theme-btn-bg: #333333;
  --theme-btn-color: #ffffff;
}

:root[data-theme="light"] {
  /* Dynamic Light Theme */
  --primary-color: #2b6cb0;
  --text-color: #2d3748;
  --text-light: #718096;
  --bg-color: #f7fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;

  --header-bg: #ffffff;
  --header-border: #e2e8f0;
  --footer-bg: #e2e8f0;
  --footer-border: #cbd5e1;
  --footer-text: #4a5568;
  --heading-color: #1a202c;
  --brand-text: #718096;
  --brand-hover-text: #1a202c;
  --category-thumb-border: #cbd5e1;
  --theme-btn-bg: #edf2f7;
  --theme-btn-color: #2d3748;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--text-color);
  background-color: var(--bg-color);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a { color: var(--primary-color); text-decoration: none; transition: color 0.2s ease; }
a:hover { text-decoration: underline; }

.site-header {
  background: var(--header-bg);
  border-bottom: 2px solid var(--header-border);
  padding: 1rem 0;
  transition: background-color 0.3s ease;
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 1.5rem; 
  font-weight: 800; 
  color: var(--heading-color); 
  font-style: italic; 
  letter-spacing: -0.5px; 
}
.site-title img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
.site-title:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: var(--text-light); font-size: 0.9rem; }
.nav-links a:hover { color: var(--heading-color); text-decoration: none; }

.main-content {
  max-width: var(--max-width);
  margin: 2rem auto;
  padding: 0 1rem;
  min-height: calc(100vh - 160px);
}

.section-label {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.section-sublabel {
  text-align: center;
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Brand Grid (Logs) */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
  justify-items: center;
}

.brand-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--brand-text);
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  border: none;
  background: transparent;
  padding: 0;
}

.brand-item svg {
  width: 50px;
  height: 50px;
  margin-bottom: 8px;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  color: var(--brand-text);
}

.brand-item:hover {
  text-decoration: none;
  color: var(--brand-hover-text);
}

.brand-item:hover svg {
  transform: scale(1.1);
  color: var(--brand-hover-text);
}

/* Category Grid */
.category-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 4rem;
}

@media (max-width: 768px) {
  .category-thumb-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .category-thumb-grid {
    grid-template-columns: 1fr;
  }
}

.category-thumb {
  position: relative;
  display: block;
  border: 1px solid var(--category-thumb-border);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
  text-decoration: none;
}

.category-thumb:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.category-color-box {
  position: relative;
  width: 100%;
  height: 130px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Gradients */
.cat-city { background: linear-gradient(135deg, #10b981, #059669); }
.cat-small { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.cat-estate { background: linear-gradient(135deg, #f59e0b, #d97706); }
.cat-suv { background: linear-gradient(135deg, #facc15, #ca8a04); }

.category-thumb img {
  width: 100%;
  height: 100%; 
  object-fit: cover;
  object-position: center center;
  mix-blend-mode: multiply; 
  opacity: 0.95;
}

.category-thumb-title {
  position: absolute;
  top: 4px;
  left: 6px;
  color: #000000;
  font-weight: 800;
  font-style: italic;
  font-size: 1.1rem;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

.category-thumb span.url {
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 100%;
  text-align: center;
  color: rgba(0,0,0,0.6);
  font-size: 0.6rem;
  font-weight: bold;
}

/* Child pages */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
}

.featured-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  display: block;
  transition: opacity 0.2s ease;
}

.featured-img:hover {
  opacity: 0.8;
}

.post-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.post-title a { color: var(--heading-color); }

.post-meta { font-size: 0.85rem; color: var(--text-light); margin-bottom: 1rem; }
.post-excerpt { color: var(--text-color); margin-bottom: 1rem; flex-grow: 1; }
.read-more { font-weight: 600; color: var(--primary-color); }

.article-header h1 { color: var(--heading-color); }
h2 { color: var(--heading-color); }

.faq-section { background: var(--card-bg); padding: 2rem; border-radius: var(--border-radius); margin-top: 2rem; }
.faq-item { border-bottom: 1px solid var(--border-color); padding: 1rem 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { color: var(--heading-color); margin-bottom: 0.5rem; }

.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--footer-text);
  border-top: 1px solid var(--footer-border);
  background: var(--footer-bg);
  transition: background-color 0.3s ease;
}

.footer-links { display: flex; justify-content: center; gap: 1rem; margin-top: 0.5rem; }

/* Tables & Infographics */
.infographic-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    margin: 2rem 0;
}
.infographic-header {
    text-align: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 20px;
}
.infographic-header h1 {
    margin: 0;
    color: var(--heading-color);
    font-size: 28px;
}
.infographic-header p {
    margin: 5px 0 0 0;
    color: var(--text-light);
    font-size: 16px;
}
.infographic-content {
    display: flex;
    align-items: center;
    gap: 40px;
}
@media (max-width: 768px) {
    .infographic-container {
        margin: 1.5rem -1rem;
        padding: 1.5rem 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .infographic-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .infographic-content {
        flex-direction: column;
        gap: 20px;
    }
    .diagram {
        flex: auto;
        width: 100%;
        max-width: 100%;
    }
    .diagram img {
        border-radius: 0;
        margin: 0;
        width: 100%;
        display: block;
    }
    .table-container {
        flex: auto;
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .table-container th, .table-container td {
        padding: 12px 8px;
        font-size: 13px;
    }
}
.diagram {
    flex: 0 0 420px;
    max-width: 100%;
}
.diagram img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.table-container {
    flex: 1;
    width: 100%;
}
.table-container table {
    width: 100%;
    border-collapse: collapse;
}
.table-container th, .table-container td {
    padding: 14px 16px;
    text-align: left;
    font-size: 15px;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}
.table-container th {
    background-color: var(--bg-color);
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.table-container tr:nth-child(even) {
    background-color: var(--bg-color);
    opacity: 0.7;
}
.highlight {
    font-weight: 800;
    color: var(--primary-color);
}
.kommentar {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
}

/* Images Grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.image-grid img {
  width: 100%;
  height: auto; 
  border-radius: var(--border-radius);
  display: block;
}

/* Video Embed */
.video-container {
  position: relative;
  padding-bottom: 56.25%; 
  height: 0;
  overflow: hidden;
  margin: 2rem 0;
  border-radius: var(--border-radius);
}

.video-container iframe {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

/* ==========================================================
   MOBILE & TABLET RESPONSIVENESS
========================================================== */
@media (max-width: 768px) {
  /* Header Stacking */
  .header-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 1.5rem 1rem;
  }
  .site-title { font-size: 2.2rem; }
  .nav-links { flex-wrap: wrap; justify-content: center; }

  /* Typography Scales */
  .hero-section h1 { font-size: 2rem !important; }
  .hero-section p { font-size: 1rem !important; }
  .section-label { font-size: 1.2rem; }
  .article-header h1, .article-title { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  /* Spacing */
  .main-content { margin-top: 1rem; }
  .brand-grid { margin-bottom: 2rem; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
  .category-thumb-grid { margin-bottom: 2rem; }

  /* Child Page Grids */
  .post-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  
  /* Tables */
  .article-content table { font-size: 0.8rem; }
  .article-content th, .article-content td { padding: 0.5rem; }
}

@media (max-width: 480px) {
  /* True Mobile Phone Optimizations */
  .site-title { font-size: 1.8rem; }
  .hero-section h1 { font-size: 1.6rem !important; }
  
  /* Make Posts explicitly 1 column */
  .post-grid { grid-template-columns: 1fr; }
  
  /* Reduce brand icon sizes slightly */
  .brand-item svg { width: 40px; height: 40px; }
  .brand-item { padding: 1rem; font-size: 0.65rem; }
  
  /* Feature Images */
  .featured-img { height: 150px; }
  
  /* Video embed margins */
  .video-container { margin: 1rem 0; }
}
