/*
Theme Name: Notar Gaertner
Theme URI: https://www2.notar-gaertner.de
Author: Migration
Description: Custom theme for Notar Dr. Franz X. Gärtner, Lauingen – 1:1 migration from original design
Version: 1.6
*/

@import url('https://fonts.googleapis.com/css2?family=Athiti:wght@400;600;700&family=Gilda+Display&display=swap');

/* ============================================
   CSS Custom Properties (exact original colors)
   ============================================ */
:root {
    --primary:      #692D46;   /* Burgundy */
    --accent:       #3C4B59;   /* Dark Slate Blue */
    --bg:           #FEFDFC;
    --text:         #828282;
    --border:       #E2E2E2;
    --sidebar-bg:   #F8F8F8;
    --font-heading: 'Gilda Display', serif;
    --font-body:    'Athiti', sans-serif;
    --max-width:    1200px;
    --header-h:     100px;
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; transition: color 0.3s; }
a:hover { text-decoration: underline; color: var(--primary); }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4, h5 {
    font-family: var(--font-heading);
    color: var(--primary);
    font-weight: normal;
    line-height: 1.2;
}
h1 { font-size: 36px; margin-bottom: 18px; }
h2 { font-size: 26px; margin-bottom: 12px; margin-top: 1.4rem; }
h3 { font-size: 21px; margin-bottom: 10px; color: var(--primary); margin-top: 1.2rem; }
p  { margin-bottom: 16px; }
ul, ol { margin: 0 0 16px 20px; }
li { margin-bottom: 4px; }

.centerer { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ============================================
   Header
   ============================================ */
.site-header {
    padding: 15px 0;
    background: var(--bg);
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    gap: 24px;
}

.site-logo img {
    max-height: 80px;
    width: auto;
}

.logo-text-wrap {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--primary);
    line-height: 1.2;
}

.logo-subtitle {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--accent);
}

/* ============================================
   Navigation – Hauptmenü
   ============================================ */
.main-nav {
    flex-grow: 1;
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 1000;
}

/* Obere Ebene */
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.main-nav > ul > li { position: relative; }
.main-nav > ul > li > a {
    display: block;
    padding: 8px 0;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.3s;
    white-space: nowrap;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.current-menu-item > a,
.main-nav > ul > li.current-menu-ancestor > a { color: var(--accent); text-decoration: none; }

/* Dropdown – kompakt & gut lesbar */
.main-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 1001;
    border-top: 3px solid var(--primary);
    flex-direction: column;
    list-style: none;
    padding: 4px 0;
}
.main-nav > ul > li:hover > ul { display: flex; }
.main-nav ul ul li {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
}
.main-nav ul ul li:last-child { border-bottom: none; }
.main-nav ul ul a {
    display: block;
    padding: 9px 18px;         /* Kompakterer Abstand – war 12px */
    line-height: 1.3;
    font-weight: 500;
    color: var(--accent);
    transition: background 0.2s;
    text-decoration: none;
    text-transform: none;
    font-size: 15px;
}
.main-nav ul ul a:hover { background: #f5f0ef; color: var(--primary); text-decoration: none; }

/* Burger Button */
.burger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: none;
    border: none;
    padding: 4px;
}
.burger span { display: block; width: 28px; height: 3px; background: var(--primary); margin: 5px 0; border-radius: 2px; transition: all 0.3s; }
.burger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

/* ============================================
   Hero / Keyvisual – Rotierendes Banner
   ============================================ */
.keyvisual {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #ddd;
    margin-bottom: 0;
    /* Volle Breite über den Zentrierer hinaus */
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    width: 100vw;
}
.keyvisual img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    object-position: center 30%;
    transition: opacity 0.7s ease;
    display: block;
}

/* Slideshow */
.hero-slide { display: none; position: relative; }
.hero-slide.active { display: block; }

/* ============================================
   Page Layout – CSS Grid (2-spaltig)
   ============================================ */
.content_wrapper {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 40px;
    margin-top: 36px;
    margin-bottom: 60px;
    align-items: start;
}

#content_main {
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
#content_main p { margin-bottom: 16px; }
#content_main ul { padding-left: 20px; }

/* ============================================
   Impressum – saubere Tabellen-Darstellung
   ============================================ */
.impressum-table {
    width: auto;
    border-collapse: collapse;
    margin: 0 0 1.5rem 0;
}
.impressum-table td {
    padding: 3px 14px 3px 0;
    vertical-align: top;
    font-size: 17px;
    line-height: 1.5;
    border: none;
}
.impressum-table td.label {
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text);
    white-space: nowrap;
    padding-top: 5px;
    min-width: 120px;
}

/* address-Tags (Notarkammer, Behörde) */
address {
    font-style: normal;
    margin-bottom: 1.2rem;
    padding: 14px 18px;
    border-left: 3px solid var(--border);
    background: var(--sidebar-bg);
    border-radius: 0 4px 4px 0;
    font-size: 16px;
    line-height: 1.7;
}
address strong { color: var(--primary); display: block; margin-bottom: 4px; }
address a { color: var(--accent); }

/* ============================================
   Sidebar
   ============================================ */
.sidebar-right {
    background: var(--sidebar-bg);
    padding: 24px;
    border-radius: 4px;
    border-top: 4px solid var(--primary);
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    min-width: 0;
}

.sidebar-right h3 { color: var(--primary); font-size: 17px; margin-bottom: 10px; margin-top: 0; }
.sidebar-right p { margin-bottom: 8px; font-size: 15px; line-height: 1.5; color: var(--accent); }
.sidebar-right a { color: var(--accent); }
.sidebar-right a:hover { color: var(--primary); }
.sidebar-sep { height: 1px; background: var(--border); margin: 18px 0; }

/* ============================================
   Team Grid
   ============================================ */
.team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    margin: 20px 0;
}
.team-card {
    background: #faf9f8;
    border-radius: 6px;
    border-top: 3px solid var(--primary);
    padding: 18px 14px;
    text-align: center;
}
.team-card h2 { font-size: 17px; margin-bottom: 4px; margin-top: 0; color: var(--primary); }
.team-card h3 { font-size: 15px; margin-top: 0; }
.team-card p  { font-size: 15px; margin-bottom: 4px; line-height: 1.4; }
.team-card img { width: 100%; max-width: 160px; margin: 0 auto 12px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.team-grid:has(.team-card:empty) { display: none; }

/* ============================================
   Tabellen-Reset (cm_table aus altem CMS)
   ============================================ */
#content_main [style*="overflow-x"] {
    overflow-x: visible !important;
    overflow: visible !important;
}

/* Basis für alle cm_table */
.cm_table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: 1.5rem;
    table-layout: auto;
}
.cm_table td {
    vertical-align: top;
    text-align: left;
    padding: 7px 12px;
    border-bottom: 1px solid #f0f0f0;
}
.cm_table tr:last-child td { border-bottom: none; }
.cm_table td:empty { display: none; }
.cm_table h2 { font-size: 17px; margin: 0 0 4px; }
.cm_table p  { font-size: 16px; margin-bottom: 0; line-height: 1.4; }

/* ============================================
   CV / Lebenslauf – Jahres-Spalte links, Text Mitte
   ============================================ */
.cm_table td.cm_firstcol {
    width: 155px;
    min-width: 120px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    vertical-align: top;
    padding-right: 20px;
    padding-top: 9px;
    font-size: 16px;
}
/* Leere dritte Spalte ausblenden */
.cm_table td.cm_lastcol:empty,
.cm_table td:last-child:empty { display: none; width: 0; padding: 0; }

/* ============================================
   Leistungen – Bilder-Grid (3-spaltige Tabelle)
   ============================================ */
.cm_table:has(img) {
    table-layout: fixed;
    width: 100%;
}
.cm_table:has(img) td {
    text-align: center;
    border-bottom: none;
    padding: 12px 8px;
    vertical-align: top;
}
.cm_table:has(img) td:empty {
    display: table-cell; /* Platzhalter für Symmetrie */
}
.cm_table:has(img) img {
    max-width: 200px;
    width: 100%;
    margin: 0 auto;
    transition: opacity 0.2s;
}
.cm_table:has(img) a:hover img { opacity: 0.85; }

/* ============================================
   Impressum – kompakte Adressdarstellung
   ============================================ */
.cm_table[id*="CM19b058c"] {
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 0.5rem;
    table-layout: auto;
}
.cm_table[id*="CM19b058c"] td {
    padding: 2px 8px 2px 0;
    border-bottom: none;
    background: transparent;
    font-size: 16px;
    line-height: 1.4;
}
.cm_table[id*="CM19b058c"] td.cm_firstcol {
    width: 160px;
    min-width: 120px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: none;
    white-space: nowrap;
    padding-top: 3px;
}
/* Impressum: Institutions-Trennlinie */
#content_main h3 + .cm_table[id*="CM19b058c"],
.cm_table[id*="CM19b058c"] + h3 {
    margin-top: 1rem;
}

/* ============================================
   cm_column_wrapper (2-Spalten-Layouts)
   ============================================ */
.cm_column_wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 28px;
    width: 100%;
    margin: 24px 0;
}
.cm_column {
    width: auto !important;
    min-width: 0;
}
.cm_column img {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 12px;
}
/* Spalten-Gap-Divs ausblenden */
.cm_column_gap { display: none !important; }

/* table-scroll Wrapper */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 14px 0;
}

/* ============================================
   Kontaktformular
   ============================================ */
.contact-form { margin-top: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--primary); margin-bottom: 0.3rem; }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 1rem;
    background: #fff;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(105,45,70,0.1);
}
.contact-form textarea { resize: vertical; min-height: 120px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.88rem; cursor: pointer; }
.checkbox-label input { margin-top: 3px; flex-shrink: 0; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 11px 28px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: #501e32; transform: translateY(-1px); }
.form-success { background: #d4edda; color: #155724; padding: 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.92rem; }
.form-error   { background: #f8d7da; color: #721c24; padding: 1rem; border-radius: 4px; margin-bottom: 1rem; font-size: 0.92rem; }

/* ============================================
   OSM Karte
   ============================================ */
.map-container { margin: 1.5rem 0; border-radius: 4px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
#osm-map { height: 400px; width: 100%; }

/* ============================================
   Footer
   ============================================ */
.site-footer {
    width: 100%;
    background: var(--accent);
    color: #fff;
    padding: 30px 5%;
    margin-top: 50px;
}
.site-footer .centerer { text-align: center; }
.site-footer a { color: #fff; margin: 0 8px; transition: color 0.3s; text-decoration: none; }
.site-footer a:hover { color: #ccc; text-decoration: none; }
.site-footer p { margin-bottom: 8px; font-size: 15px; }

/* ============================================
   Cookie Banner
   ============================================ */
#cookie-banner {
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    background: #fff;
    border-top: 3px solid var(--primary);
    padding: 18px 20px;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    z-index: 9999;
    display: none;
    text-align: center;
}
#cookie-banner h4 { color: var(--primary); font-family: var(--font-heading); margin-bottom: 6px; }
#cookie-banner p { margin-bottom: 12px; font-size: 14px; max-width: 800px; margin-left: auto; margin-right: auto; line-height: 1.5; }
#cookie-banner button { margin: 0 5px; padding: 9px 18px; border: none; cursor: pointer; border-radius: 4px; font-weight: 600; font-family: var(--font-body); font-size: 15px; }
.btn-cookie-accept { background: var(--primary); color: #fff; }
.btn-cookie-decline { background: #eee; color: #333; }

/* ============================================
   Responsive – Tablet (≤ 900px)
   ============================================ */
@media (max-width: 900px) {
    .content_wrapper {
        grid-template-columns: 1fr 220px;
        gap: 28px;
    }
}

/* ============================================
   Responsive – Mobil (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Einspaltiges Layout */
    .content_wrapper {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 24px;
    }
    .sidebar-right {
        position: static;
        margin-top: 28px;
        border-top-width: 3px;
    }
    /* Team Grid: 2 Spalten */
    .team-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    /* Spalten-Layout: 1 Spalte */
    .cm_column_wrapper { grid-template-columns: 1fr; gap: 18px; }

    /* Banner */
    .keyvisual img { height: 220px; }

    /* Header */
    .header-content { padding: 8px 16px; }
    .site-logo img { max-height: 60px; }
    .logo-title { font-size: 1.1rem; }

    /* Burger Menü */
    .burger { display: flex; }
    .main-nav {
        display: none;
        position: absolute;
        top: calc(100% + 3px);
        left: 0;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        background: var(--primary);
        padding: 8px 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        z-index: 1002;
        justify-content: flex-start;
    }
    .main-nav.open { display: block; }
    .main-nav > ul { flex-direction: column; gap: 0; }
    .main-nav > ul > li > a {
        padding: 13px 20px;
        color: #fff;
        font-size: 14px;
        border-bottom: 1px solid rgba(255,255,255,0.12);
    }
    .main-nav > ul > li > a:hover { color: #eee; }
    .main-nav ul ul { position: static; display: none; background: rgba(0,0,0,0.18); box-shadow: none; border: none; padding: 0; }
    .main-nav ul ul a { padding: 10px 10px 10px 36px; color: #fff; font-size: 14px; }
    .main-nav > ul > li.open > ul { display: flex; }

    h1 { font-size: 28px; }
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }
    .form-row { grid-template-columns: 1fr; }

    /* Leistungen-Tabelle: 1 Spalte auf Mobil */
    .cm_table:has(img) { display: block; }
    .cm_table:has(img) tbody,
    .cm_table:has(img) tr { display: flex; flex-wrap: wrap; }
    .cm_table:has(img) td { flex: 0 0 50%; max-width: 50%; }
    .cm_table:has(img) td:empty { display: none; }
}

@media (max-width: 480px) {
    .team-grid { grid-template-columns: 1fr; }
    .cm_table:has(img) td { flex: 0 0 100%; max-width: 100%; }
}
