/*
Theme Name: Matratzenliebe
Theme URI: https://www.matratzenliebe.de
Author: Jürgens Internetlösungen
Author URI: https://www.matratzenliebe.de
Description: Premium WordPress Theme für Matratzenliebe.de – Schlafberatung mit Herz
Version: 3.5.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: matratzenliebe
Tags: custom-menu, featured-images, translation-ready
*/

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --color-green:       #6E7F5F;
  --color-green-dark:  #5a6b4e;
  --color-footer:      #2F3E34;
  --color-bg:          #F5F1EB;
  --color-bg-light:    #FAF8F4;
  --color-beige:       #EAE3D8;
  --color-text:        #2B2B2B;
  --color-text-muted:  #6B6B6B;
  --color-white:       #FFFFFF;
  --font-serif:        'Playfair Display', Georgia, serif;
  --font-body:         'Inter', 'Open Sans', sans-serif;
  --container:         1200px;
  --container-pad:     32px;
  --radius:            12px;
  --radius-sm:         8px;
  --radius-full:       999px;
  --transition:        all 0.3s ease;
  --header-h:          72px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* WP Admin Bar offset */
.admin-bar #site-header { top: 32px; }
@media (max-width: 782px) { .admin-bar #site-header { top: 46px; } }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: var(--transition); }
ul { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
  color: var(--color-text);
}
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; }
h3 {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: var(--font-body);
}
p { color: var(--color-text-muted); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-green);
  color: var(--color-white);
  border-color: var(--color-green);
}
.btn-primary:hover {
  background: var(--color-green-dark);
  border-color: var(--color-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(110,127,95,.28);
  color: var(--color-white);
}

/* ============================================================
   HEADER
   ============================================================ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-bg);
  border-bottom: 1px solid rgba(234,227,216,.8);
  box-shadow: 0 1px 12px rgba(0,0,0,.04);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 24px;
}

/* ── Logo ─────────────────────────────────────── */
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo .logo-icon svg {
  width: 30px; height: 30px;
  stroke: var(--color-green);
  fill: none;
  stroke-width: 1.8;
}
.site-logo .logo-name {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--color-text);
  display: block;
  line-height: 1.1;
}
.site-logo .logo-name span { color: var(--color-green); }
.site-logo .logo-sub {
  font-size: .64rem;
  color: var(--color-text-muted);
  letter-spacing: .03em;
  display: block;
}

/* ── Primary Nav ──────────────────────────────── */
#main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

/* Reset WP menu defaults */
#main-nav .menu,
#main-nav ul {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0; padding: 0;
}

#main-nav a {
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text);
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  display: block;
  transition: var(--transition);
}
#main-nav a:hover,
#main-nav .current-menu-item > a,
#main-nav .current-page-ancestor > a {
  color: var(--color-green);
  background: rgba(110,127,95,.08);
}

/* ── Dropdown ─────────────────────────────────── */
#main-nav li.menu-item-has-children {
  position: relative;
}
#main-nav li.menu-item-has-children > a::after {
  content: ' ›';
  font-size: .7rem;
  opacity: .6;
}
/* CRITICAL: Hide sub-menus by default */
#main-nav .sub-menu {
  display: none !important;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  padding: 6px 0;
  border: 1px solid var(--color-beige);
  z-index: 100;
  flex-direction: column;
  gap: 0;
}
#main-nav li.menu-item-has-children:hover > .sub-menu,
#main-nav li.menu-item-has-children:focus-within > .sub-menu {
  display: flex !important;
}
#main-nav .sub-menu li { width: 100%; }
#main-nav .sub-menu a {
  display: block;
  padding: 9px 16px;
  border-radius: 0;
  font-size: .76rem;
  white-space: nowrap;
}
#main-nav .sub-menu a:hover {
  background: var(--color-bg-light);
  color: var(--color-green);
}

/* Cart */
.header-cart { flex-shrink: 0; }
.header-cart a {
  display: flex; align-items: center;
  padding: 8px; border-radius: var(--radius-sm);
  color: var(--color-text);
}
.header-cart a:hover { color: var(--color-green); }
.header-cart svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* Mobile Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}
.nav-toggle span {
  width: 22px; height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: var(--transition);
  display: block;
}

/* ============================================================
   HERO SECTION – background-image direkt auf #hero
   Das Bild wird als CSS background gesetzt (via inline style im PHP).
   Kein Kind-Element für das Bild – garantiert volle Abdeckung.
   ============================================================ */
#hero {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  overflow: hidden;
  /* background-* wird per inline style im PHP gesetzt – kein Override-Konflikt */
}

/* .hero-right wird nicht mehr genutzt – Sicherheits-Reset */
.hero-right { display: none !important; }

/* Textbereich – vollständig transparent, direkt über dem Foto */
.hero-left {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  width: 58%;
  padding-top: 60px;
  padding-bottom: 100px;
  padding-left: max(var(--container-pad), calc((100vw - var(--container)) / 2 + var(--container-pad)));
  padding-right: 64px;
  background: transparent;
}

.hero-content h1 {
  margin-bottom: 20px;
  font-weight: 700;
  color: #1a1a1a;
  text-shadow: 0 1px 8px rgba(255,255,255,.6);
}
.hero-content h1 .highlight {
  color: var(--color-green);
  text-shadow: 0 1px 8px rgba(255,255,255,.5);
}
.hero-content .hero-sub {
  font-size: 1rem;
  color: #3a3a3a;
  margin-bottom: 36px;
  max-width: 400px;
  line-height: 1.75;
  text-shadow: 0 1px 4px rgba(255,255,255,.5);
}
.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.hero-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  color: #3a3a3a;
  text-shadow: 0 1px 3px rgba(255,255,255,.4);
}
.hero-badge svg {
  width: 14px; height: 14px;
  stroke: var(--color-green);
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}


/* Heart decoration bottom-right of image */
.hero-heart {
  position: absolute;
  bottom: 36px;
  right: 36px;
  z-index: 2;
  pointer-events: none;
}
.hero-heart svg {
  width: 44px; height: 44px;
  stroke: rgba(255,255,255,.5);
  fill: none;
  stroke-width: 1.5;
}

/* Bottom wave between hero and next section */
.hero-wave {
  position: absolute;
  bottom: -1px; left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  z-index: 2;
}
.hero-wave svg { display: block; width: 100%; }

/* ============================================================
   PRODUCTS SECTION
   ============================================================ */
#products {
  background: var(--color-bg-light);
  padding: 90px 0 110px;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Row: icon+text LEFT, image RIGHT */
.product-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.product-info { flex: 1; min-width: 0; }

.product-icon-wrap {
  width: 48px; height: 48px;
  background: var(--color-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  flex-shrink: 0;
}
.product-icon-wrap svg {
  width: 22px; height: 22px;
  stroke: white; fill: none;
  stroke-width: 1.8;
}

.product-card h3 { margin-bottom: 8px; color: var(--color-text); }
.product-card p { font-size: .87rem; margin-bottom: 14px; line-height: 1.6; }

/* Thumbnail – right side of row */
.product-thumb {
  width: 140px;
  height: 140px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-beige);
  margin-top: 4px;
}
.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .product-thumb img { transform: scale(1.05); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text);
  transition: var(--transition);
}
.link-arrow:hover { color: var(--color-green); }
.link-arrow::after { content: '→'; transition: transform .2s; }
.link-arrow:hover::after { transform: translateX(3px); }

/* ============================================================
   USP SECTION
   ============================================================ */
#usp-section {
  background: var(--color-bg);
  padding: 100px 0;
}

.usp-inner {
  display: grid;
  grid-template-columns: 55% 1fr;
  gap: 80px;
  align-items: center;
}

.usp-content h2 { margin-bottom: 16px; }
.usp-content .usp-intro {
  font-size: .97rem;
  color: var(--color-text-muted);
  max-width: 440px;
  line-height: 1.75;
  margin-bottom: 48px;
}

.usp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 48px;
}
.usp-item { display: flex; flex-direction: column; gap: 3px; }
.usp-item-icon { margin-bottom: 6px; }
.usp-item-icon svg {
  width: 26px; height: 26px;
  stroke: var(--color-green);
  fill: none;
  stroke-width: 1.6;
}
.usp-item-title { font-size: .84rem; font-weight: 600; color: var(--color-text); }
.usp-item-sub   { font-size: .77rem; color: var(--color-text-muted); }

/* Circular woman image */
.usp-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.usp-circle {
  width: 340px; height: 340px;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid var(--color-beige);
  position: relative;
  z-index: 2;
}
.usp-circle img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
}
.usp-circle-deco {
  position: absolute;
  width: 375px; height: 375px;
  border-radius: 50%;
  border: 1.5px dashed rgba(110,127,95,.28);
  z-index: 1;
}
.usp-leaf {
  position: absolute;
  bottom: -10px; left: 0px;
  z-index: 3;
  opacity: .5;
}
.usp-leaf svg {
  width: 70px; height: 90px;
  stroke: var(--color-green);
  fill: none;
  stroke-width: .9;
}

/* ============================================================
   CTA SECTION
   ============================================================ */
#cta-section {
  background: var(--color-bg-light);
  padding: 70px 0;
}

.cta-inner {
  display: flex;
  align-items: center;
  gap: 36px;
}
.cta-icon-wrap {
  width: 76px; height: 76px;
  background: var(--color-beige);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cta-icon-wrap svg {
  width: 32px; height: 32px;
  stroke: var(--color-green);
  fill: none;
  stroke-width: 1.6;
}
.cta-text { flex: 1; }
.cta-text h2 { font-size: 1.7rem; margin-bottom: 6px; }
.cta-text p  { font-size: .93rem; }

/* ============================================================
   FOOTER
   ============================================================ */
#site-footer {
  background: var(--color-footer);
  color: rgba(255,255,255,.7);
  padding: 64px 0 0;
}

.footer-grid {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 40px;
  padding-bottom: 52px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.footer-brand  { flex: 0 0 220px !important; min-width: 0 !important; }
.footer-col    { flex: 1 1 0 !important;     min-width: 0 !important; }

/* Brand */
.footer-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; text-decoration: none;
}
.footer-logo svg { width: 26px; height: 26px; stroke: rgba(255,255,255,.65); fill: none; stroke-width: 1.8; }
.footer-logo .logo-name { font-size: .88rem; font-weight: 700; color: #fff; display: block; line-height: 1.1; }
.footer-logo .logo-name span { color: rgba(255,255,255,.5); }
.footer-logo .logo-sub { font-size: .62rem; color: rgba(255,255,255,.4); }
.footer-brand > p { font-size: .83rem; color: rgba(255,255,255,.48); line-height: 1.7; max-width: 200px; }

/* Columns */
.footer-col h4 {
  font-family: var(--font-body);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 16px;
}
/* Unterstützt sowohl plain <ul> (Fallback) als auch wp_nav_menu <ul class="menu"> */
.footer-col ul,
.footer-col .menu {
  list-style: none;
  margin: 0; padding: 0;
}
.footer-col ul li,
.footer-col .menu li { margin-bottom: 9px; }
.footer-col ul li a,
.footer-col .menu li a { font-size: .82rem; color: rgba(255,255,255,.5); transition: var(--transition); }
.footer-col ul li a:hover,
.footer-col .menu li a:hover { color: rgba(255,255,255,.9); }

/* Contact */
.footer-contact-info { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.footer-contact-info span { font-size: .82rem; color: rgba(255,255,255,.5); }
.footer-contact-info a { color: rgba(255,255,255,.5); transition: var(--transition); }
.footer-contact-info a:hover { color: rgba(255,255,255,.9); }

/* Social */
.footer-social { display: flex; gap: 8px; }
.footer-social a {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.09);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.footer-social a:hover { background: var(--color-green); }
.footer-social svg { width: 15px; height: 15px; stroke: rgba(255,255,255,.65); fill: none; stroke-width: 2; }
.footer-social a:hover svg { stroke: #fff; }

/* Bottom Bar */
.footer-bottom {
  padding: 18px 0;
}
.footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom p { font-size: .74rem; color: rgba(255,255,255,.3); }
.footer-bottom-links { display: flex; gap: 22px; }
.footer-bottom-links a { font-size: .74rem; color: rgba(255,255,255,.3); transition: var(--transition); }
.footer-bottom-links a:hover { color: rgba(255,255,255,.65); }

/* ============================================================
   SCROLL ANIMATIONS
   ============================================================ */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-up.visible { opacity: 1; transform: translateY(0); }
.fade-up:nth-child(2) { transition-delay: .12s; }
.fade-up:nth-child(3) { transition-delay: .24s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  /* Hero braucht explizite Höhe, damit das absolut positionierte Bild eine Fläche hat */
  #hero {
    min-height: 90vw;
  }
  .hero-left {
    width: 100%;
    min-height: 90vw;
    padding: 52px var(--container-pad) 52px;
    text-align: center;
    background: transparent;
  }
  .hero-actions { align-items: center; }
  .hero-content .hero-sub { margin-left: auto; margin-right: auto; }
  /* Bild füllt den gesamten Hero-Container als Hintergrund */
  .hero-right {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }
  .hero-heart { display: none; }
  .hero-wave  { display: none; }
  .usp-inner { grid-template-columns: 1fr; gap: 56px; }
  .usp-image-wrap { order: -1; }
  .usp-circle { width: 260px; height: 260px; }
  .usp-circle-deco { width: 290px; height: 290px; }
  .footer-grid { flex-wrap: wrap; }
  .footer-brand { flex: 0 0 100%; }
  .footer-col   { flex: 1 1 160px; }
}

@media (max-width: 768px) {
  :root { --header-h: 64px; }
  /* Mobile: Hero mit fester Mindesthöhe für das Hintergrundbild */
  #hero      { min-height: 120vw; }
  .hero-left { min-height: 120vw; padding-bottom: 48px; }
  #main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-beige);
    padding: 12px 0 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    flex-direction: column;
    align-items: flex-start;
    z-index: 999;
  }
  #main-nav.open { display: flex; }
  #main-nav .menu, #main-nav ul {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }
  #main-nav a { width: 100%; padding: 10px 20px; border-radius: 0; }
  #main-nav .sub-menu {
    display: none !important;
    position: static;
    box-shadow: none;
    border: none;
    padding: 0 0 0 20px;
    background: transparent;
  }
  #main-nav li.menu-item-has-children.open-sub > .sub-menu { display: flex !important; }
  .nav-toggle { display: flex; }
  #site-header { position: relative; }
  .products-grid { grid-template-columns: 1fr; gap: 28px; }
  .usp-grid { grid-template-columns: 1fr 1fr; }
  .cta-inner { flex-wrap: wrap; text-align: center; justify-content: center; }
  .footer-grid { flex-direction: column; gap: 28px; }
  .footer-brand, .footer-col { flex: 0 0 auto; }
  .footer-bottom-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .products-grid { grid-template-columns: 1fr; }
  .product-row { flex-direction: column; }
  .product-thumb { width: 100%; height: 200px; }
  .usp-grid { grid-template-columns: 1fr; }
}
