:root {
  /* Safe areas (for Mobile browser UI / Notch) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), 16px);
  --footer-h: 56px;

  --header-h: 160px;
  --nav-h: 64px;
  --top-fixed: calc(var(--header-h) + var(--nav-h));
  --footer-h: 56px;

  --header-h: 160px;
  --nav-h: 64px;
  --top-fixed: calc(var(--header-h) + var(--nav-h));
  --footer-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --header-h: 160px;
  --nav-h: 64px;
  --header-bottom: 160px;
  --top-fixed: calc(var(--header-h) + var(--nav-h));
  --top-gap: 14px;
  --footer-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  height: 100%;

  
  padding-bottom: calc(var(--footer-h) + var(--safe-bottom));
}

body {
  margin: 0;
  font-family: sans-serif;
  background-color: #292929; /* Layout-Hintergrund */
  color: #ffffff;            /* überall weiße Schrift */
  font-size: 20px;           /* Basis-Schriftgröße (~+4px) */
  /* Abstand nach unten: Footer + Safe-Area */
  padding-bottom: calc(var(--footer-h) + var(--safe-bottom));
}

/* Header und Nav immer oben halten */
.header,
.nav {
  position: relative;
  z-index: 1000;
  margin-bottom: 6px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  flex-wrap: wrap;
  row-gap: 8px;

  position: fixed;
  top: var(--header-bottom, 160px);
  left: 0;
  right: 0;
  z-index: 1600;
}

/* ===== Header: schwarz + neues Logo zentriert (100px) ===== */
.header {
  background-color: #000000 !important;
  background-image: url("https://poseidon-gladbeck.de/wp-content/uploads/Poseidon_Logo.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: auto 100px;    /* Logo-Höhe: 100px (TEST) */
  min-height: 160px;              /* Platz für das Logo */
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #ccc;
  color: #ffffff;
  padding-top: var(--safe-top);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1500;
}
/* Altes Header-IMG ausblenden (kein doppeltes Logo) */
.header img { display: none !important; }

@media (max-width: 768px) {
  .header { background-size: auto 80px; min-height: 130px; }
}

/* --- NAVIGATION --- */
.nav {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 20px;
  background-color: #292929; /* gewünschte Nav-Farbe */
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: #ffffff; /* weiße Schrift in der Navigation */
  padding: 6px 12px;
  border-radius: 20px;
  transition: background-color 0.3s, color 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}
.nav a:hover { background-color: #1c1c1c; color: #ffffff; }

/* Aktive Navi-Kategorie dauerhaft hervorheben (hohe Spezifität) */
.nav a.active,
.nav a[aria-current="page"] { background-color: #1c1c1c !important; color: #ffffff !important; }
.nav a:hover.active,
.nav a.active:hover { background-color: #1c1c1c !important; color: #ffffff !important; }
.nav a:hover:not(.active) { background-color: #1c1c1c; color: #ffffff; }

/* --- INHALT --- */
.content {
  display: flex;
  justify-content: center;
  
  color: #ffffff;

  position: fixed;
  top: calc(var(--top-fixed, 232px) + var(--top-gap, 14px));
  left: 0; right: 0;
  bottom: calc(var(--footer-h, 56px) + var(--safe-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.recommendation-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.recommendation-item {
  display: grid;
  grid-template-columns: 1fr minmax(0,1fr) 96px 120px;
  align-items: center;
  gap: 10px;
  width: 90%;
  max-width: 700px;
  border-bottom: 1px solid #888;
  padding-bottom: 15px;
  margin-bottom: 15px;
  color: #ffffff;
}
.jahr { font-weight: bold; min-width: 50px; }
.name { cursor: pointer; color: #ffffff; }
.beschreibungKurz { text-align: center; }
.recommendation-item select {
  padding: 6px 12px;
  font-size: 20px;
  border-radius: 5px;
  text-align: center;
  height: 44px;
}
.price { font-weight: bold; font-size: 20px; min-width: 80px; }

/* === Detail-Block Overlay === */
.detail-block {
  scroll-margin-top: calc(var(--top-fixed, 232px) + var(--top-gap, 14px));
  position: fixed;
  left: 0; right: 0;
  top: var(--top-fixed, 232px);
  bottom: 0;
  background: #292929; /* gewünschte Detail-Block-Farbe */
  padding: 20px;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
  z-index: 500;
  overflow-y: auto;
  max-height: min(
    calc(100dvh - var(--nav-offset, 0px)),
    calc(100svh - var(--nav-offset, 0px)),
    calc(100vh  - var(--nav-offset, 0px))
  );
  transform: translateY(100%);
  transition: transform 0.5s ease-in-out;
  font-family: Georgia, serif;
  color: #ffffff;
  /* genug Platz unten */
  padding-bottom: calc(var(--footer-h) + var(--safe-bottom) + 12px);
}
.detail-block.active { transform: translateY(0); }

/* Header im Detail-Overlay (Desktop-Default) */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.detail-header .back { cursor: pointer; color: #ffffff; font-size: 18px; }
.detail-header .title { font-size: 22px; font-weight: 500; color: #ffffff; }
.detail-header .close-btn { cursor: pointer; font-size: 28px; color: #ffffff; }
.detail-header .close-btn:hover { color: #ffffff; }

/* === Meta-Daten (Region + Land) – vertikal & zentriert === */
.detail-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  margin-bottom: 20px;
}
.detail-meta p { margin: 0; font-size: 18px; color: #ffffff; }
.detail-meta p strong { font-weight: 600; margin-right: 0.5rem; }

/* === Detail: alles mittig, Bild zuerst, Text darunter === */
.detail-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  text-align: center;
}
.detail-main .detail-img {
  flex: 0 0 auto;
  width: min(600px, 90vw);
  height: clamp(260px, 45vw, 520px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.detail-main .detail-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.detail-main .detail-text {
  flex: 1;
  color: #ffffff;
  line-height: 1.6;
  max-width: 800px;
}
.detail-main .detail-text p { margin: 0 0 1rem; font-size: 18px; }

/* Farblicher Trenner */
.detail-separator { border: 0; height: 2px; background: #292929; margin: 20px 0; }

/* === Winzerbereich: Logo zuerst, darunter Beschreibung, alles mittig === */
.detail-winzer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 2rem;
  text-align: center;
}
.detail-winzer-logo {
  width: min(260px, 70vw);
  height: 120px;
  margin: 1rem auto 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-winzer-logo img { width: 100%; height: 100%; object-fit: contain; }
.detail-winzer-info { flex: 1; max-width: 800px; }
.detail-winzer-info p { margin: 0 0 0.5rem; font-size: 18px; line-height: 1.5; color: #ffffff; }
.detail-winzer-info p:first-child { font-weight: 600; font-size: 18px; }

/* Footer bleibt oben */
.footer {
  position: fixed;
  bottom: 0; width: 100%;
  background-color: #292929; /* an Layoutfarbe angepasst */
  text-align: center;
  padding: 10px;
  border-top: 1px solid #ccc;
  color: #ffffff;
  z-index: 300;
  min-height: 56px;

  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1400;

  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  width: 100%;
  z-index: 1700;
  min-height: var(--footer-h, 56px);
  padding-bottom: max(var(--safe-bottom, 0px), 0px);
}
.footer a {
  margin: 0 20px;
  color: #ffffff;
  font-size: 24px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* --- Footer-Icons (Home & Wein) --- */
.footer a::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 22px;
  background-repeat: no-repeat;
  background-size: 22px 22px;
}

/* HOME Icon im Footer (einfaches Haus) */
.footer a[href*="index"]::before,
.footer a[href="/"]::before,
.footer a[href$="/index.php"]::before {
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="%23ffffff" d="M12 3 2 12h3v8h6v-5h2v5h6v-8h3z"/></svg>');
}

/* WEIN Icon im Footer (Flasche + Glas) */
.footer a[href*="wein"]::before,
.footer a[href*="weiss"]::before,
.footer a[href*="weiß"]::before,
.footer a[href*="rot"]::before,
.footer a[href*="rose"]::before,
.footer a[href*="ros%C3%A9"]::before,
.footer a[href*="champagner"]::before,
.footer a[href*="empfehl"]::before {
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><path fill="%23ffffff" d="M22 4h6v8c0 9-4 12-4 16v20h-4V28c0-4-4-7-4-16V4h6zM44 8c5 0 9 4 9 9 0 7-6 12-9 14-3-2-9-7-9-14 0-5 4-9 9-9zm-1 23h2v19h6v3H37v-3h6V31z"/></svg>');
}

/* --- HOME: Introbereich, Text über Bild, voll responsiv --- */

.content .intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  margin: 32px auto 48px;
  padding: 0;
  max-width: 900px;
  width: 100%;
}

/* Text über dem Bild */
.intro-text {
  font-size: 20px;
  line-height: 1.4;
  color: #ffffff;
  max-width: 760px;
  padding: 0 16px;
  margin: 0;
}

/* Bild — mobil kleiner, Tablet mittel, Desktop größer */
.intro-img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
}

/* Smartphone (bis 520px) */
@media (max-width: 520px) {
  .intro-img {
    max-height: 220px;
  }
  .intro-text {
    font-size: 18px;
    padding: 0 10px;
  }
}

/* Kleine Tablets (bis 900px) */
@media (max-width: 900px) {
  .intro-img {
    max-height: 320px;
    max-width: 95%;
  }
  .intro-text {
    font-size: 19px;
  }
}

/* Große Tablets + normale Desktops */
@media (min-width: 901px) {
  .intro-img {
    max-width: 700px;
    max-height: 420px;
  }
  .intro-text {
    font-size: 21px;
  }
}


/* Page wrapper */
.page-wrapper {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #292929; /* an Layoutfarbe angepasst */
  transition: transform 1s ease-in-out, opacity 1s ease-in-out;
  transform: translateX(100%);
  opacity: 0;
  z-index: 100;
}
.page-wrapper.slide-in { transform: translateX(0); opacity: 1; }
.page-wrapper.slide-out { transform: translateX(-100%); opacity: 0; }

/* Globale Linkfarbe */
a { color: #ffffff; }

/* Responsive */
@media (max-width: 768px) { .detail-main .detail-text { text-align: center; } }

/* Rebsorte-Zeile im Detail */
.detail-rebsorte { margin: 10px 0 20px 0; }
.detail-rebsorte p { margin: 0; }

/* ---- Mobile Tweaks ---- */
@media (max-width: 480px) {
  .recommendation-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "name price"
      "desc select";
    gap: 8px 12px;
    width: 100%;
  }
  .recommendation-item .name { grid-area: name; }
  .recommendation-item .beschreibungKurz { grid-area: desc; }
  .recommendation-item select { grid-area: select; width: 88px; justify-self: start; }
  .recommendation-item .price { grid-area: price; justify-self: end; min-width: 0; }
}

/* ---- Narrow phones (e.g., folded outer displays) ---- */
@media (max-width: 430px) {
  .nav { gap: 16px; }
  .nav a { padding: 6px 10px; }
  .recommendation-item { padding-bottom: 14px; margin-bottom: 14px; width: 100%; }
  .recommendation-item select { width: 88px; }
  .recommendation-item .price { font-size: 0.95em; }
  .detail-block { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .detail-header .title { font-size: 20px; }
}

/* ---- OnePlus Open (outer display ~6.31", 20:9) & very narrow phones ---- */
@media (max-width: 430px) {
  html { font-size: 18px; }
  body { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }

  .nav { gap: 12px; padding-top: 8px; padding-bottom: 10px; }
  .nav a { padding: 6px 10px; border-radius: 16px; font-size: 0.98rem; }

  .content, .page-wrapper { width: 100%; }

  .recommendation-item { width: 100%; padding-left: 0; padding-right: 0; }

  /* Name darf 2 Zeilen, bricht sauber um */
  .recommendation-item .name { line-height: 1.2; word-break: break-word; }

  /* Select & Preis kompakt */
  .recommendation-item select { width: 84px; }
  .recommendation-item .price { min-width: 108px; font-size: 0.95rem; }

  /* Detail Overlay Innenabstände */
  .detail-block {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .detail-header .title { font-size: 20px; }
  .detail-meta p { font-size: 17px; }
  .detail-main { gap: 14px; }
  .detail-img { width: min(520px, 92vw); height: clamp(240px, 52vw, 480px); }
  .detail-winzer-logo { width: min(220px, 70vw); height: 110px; }
}

@media (max-width: 380px) {
  html { font-size: 17px; }
  .nav { gap: 10px; }
  .nav a { padding: 5px 9px; }
  .recommendation-item select { width: 80px; }
  .recommendation-item .price { min-width: 100px; font-size: 0.92rem; }
  .detail-header .title { font-size: 19px; }
}

/* Robust text wrapping for long labels/titles across browsers */
.name, .detail-header .title, .detail-text p, .detail-meta p {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

/* ---- Broad responsive tiers ---- */
@media (max-width: 900px) {
  .nav a { font-size: 1rem; }
  .recommendation-item { width: 96%; }
}
@media (max-width: 768px) {
  .nav a { padding: 6px 12px; }
  .recommendation-item { width: 100%; }
}
@media (max-width: 600px) {
  .detail-header .title { font-size: 21px; }
  .detail-meta p { font-size: 18px; }
}

/* Reserve space so Inhalt nicht hinter OS- oder Site-Footer rutscht */
.content::after,
#recommendation-list::after {
  content: "";
  display: block;
  height: calc(var(--footer-h) + var(--safe-bottom) + 24px);
}

/* --- Mobile: Footer ausblenden; nur Safe-Area/Spacer nutzen --- */


/* === Mobile-Layout für Detail-Header: Titel in die zweite Zeile === */
@media (max-width: 768px) {
  .detail-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "back close"
      "title title";
    row-gap: 8px;
    align-items: center;
    text-align: center;
  }
  .detail-header .back { grid-area: back; justify-self: start; }
  .detail-header .close-btn { grid-area: close; justify-self: end; }
  .detail-header .title {
    grid-area: title;
    justify-self: center;
    margin: 0;
    display: block;
  }
}

.content, .intro {  }

.content,.intro,.recommendation-list{margin-top:0 !important;padding-top:0 !important;}

/* footer-shadow-added */
.footer{box-shadow:0 -3px 10px rgba(0,0,0,.25);}
/* ========== SEARCH OVERLAY (non-intrusive) ========== */
.search-panel{ position: fixed; top: calc(var(--top-fixed, 232px)); left:0; right:0;
  bottom: calc(var(--footer-h,56px) + var(--safe-bottom,0px)); z-index:5000;
  display:grid; grid-template-rows:auto 1fr; background:rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.search-panel[hidden]{ display:none !important; }

.search-bar{ display:grid; grid-template-columns:1fr auto; gap:8px; padding:10px 14px;
  background:#292929; border-bottom:1px solid #aaa; }
#searchInput{ font-size:18px; padding:10px 12px; border-radius:8px; border:1px solid #888; width:100%; }
#searchClose{ font-size:24px; line-height:1; border:0; background:#292929; color:#fff; border-radius:8px; padding:8px 12px; cursor:pointer; }

.search-results{ overflow:auto; -webkit-overflow-scrolling:touch; background:#292929; color:#fff; padding:8px 12px 12px; }
.search-item{ display:grid; grid-template-columns:1fr auto; gap:8px; padding:12px 8px; border-bottom:1px solid #555; cursor:pointer; }
.search-item .title{ font-weight:600; } .search-item .meta{ opacity:.85; font-size:.95em; }
.search-item mark{ background:#f8e27c; color:#000; padding:0 2px; border-radius:3px; }

.content.no-scroll{ overflow:hidden !important; }
@media(max-width:480px){ #searchInput{font-size:16px;} }

/* === SEARCH PANEL FIXED === */
.search-panel{
  position: fixed;
  top: calc(var(--top-fixed, 232px));
  left: 0; right: 0;
  bottom: calc(var(--footer-h, 56px) + var(--safe-bottom, 0px));
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  display: grid;
  grid-template-rows: auto 1fr;
  z-index: 5000;
}
.search-panel[hidden]{ display:none !important; }
.search-bar{
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 10px 14px; background: #292929; border-bottom: 1px solid #aaa;
}
#searchInput{
  font-size: 18px; padding: 10px 12px; border: 1px solid #888; border-radius: 8px; width: 100%;
}
#searchClose{
  font-size: 24px; line-height: 1; border: 0; background: #292929; color: #fff;
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.search-results{ overflow: auto; -webkit-overflow-scrolling: touch; background: #292929; color: #fff; padding: 8px 12px 12px; }
.search-item{ display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 8px; border-bottom: 1px solid #555; cursor: pointer; }
.search-item .title{ font-weight: 600; } .search-item .meta{ opacity: .85; font-size: .95em; }
.search-item mark{ background:#f8e27c; color:#000; padding:0 2px; border-radius:3px; }
.content.no-scroll{ overflow: hidden !important; }
