/*
 * abiOM Theme: maildienste
 * Kompatibel mit abiOM 3.06 Template-Struktur
 * Daniel Weihmann, abi Online-Marketing
 *
 * Farben: #005BB5 (Blau) / #E87722 (Orange aus Logo)
 * Fonts: Source Sans 3 (Heading) + Source Serif 4 (Body) - lokal gehostet
 */

/* === FONT-FACE === */
/* Dateien per https://gwfh.mranftl.com/ herunterladen, ablegen unter /themes/maildienste/fonts/ */
@font-face {
  font-family: 'Source Sans 3';
  src: url('/themes/maildienste/fonts/source-sans-3-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/themes/maildienste/fonts/source-sans-3-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/themes/maildienste/fonts/source-serif-4-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/themes/maildienste/fonts/source-serif-4-400i.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}

/* === CUSTOM PROPERTIES === */
:root {
  --primary:       #005BB5;
  --primary-dark:  #003D7A;
  --primary-light: #E8F0FB;
  --accent:        #E87722;
  --accent-dark:   #C45F0A;
  --bg:            #F5F7FA;
  --surface:       #FFFFFF;
  --border:        #D6DDE8;
  --text:          #1A1A2E;
  --text-muted:    #5A6578;
  --text-subtle:   #8896A8;

  --font-heading: 'Source Sans 3', system-ui, sans-serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'Courier New', monospace;

  --radius:   8px;
  --shadow-s: 0 1px 3px rgba(0,0,0,.08);
  --shadow-m: 0 4px 12px rgba(0,0,0,.09);

  --content-max: 760px;
  --layout-max:  1060px;
  --sidebar-w:   250px;
}

/* === BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.72;
  color: var(--text);
  background: var(--bg);
}

/* === SKIP LINK === */
.skip-link {
  position: absolute;
  top: -120%;
  left: 1rem;
  background: var(--primary);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-weight: 700;
  text-decoration: none;
  z-index: 9999;
  transition: top .15s;
}
.skip-link:focus { top: 1rem; }

/* === WRAPPER === */
#wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* === HEADER === */
#site-header {
  background: var(--primary);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}

.header-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Branding */
#site-branding { flex-shrink: 0; }

#site-branding a { text-decoration: none; display: flex; align-items: center; gap: .6rem; }

#site-branding img { height: 38px; width: auto; }

#site-branding .site-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: -.01em;
}

.site-tagline {
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  font-family: var(--font-heading);
  margin-top: 1px;
}

/* Nav */
#main-nav { display: flex; align-items: center; gap: .15rem; }

#main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: .15rem;
  margin: 0;
  padding: 0;
}

#main-nav a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .875rem;
  padding: .4rem .7rem;
  border-radius: 5px;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

#main-nav a:hover,
#main-nav a[aria-current="page"] {
  background: rgba(255,255,255,.15);
  color: #fff;
}

/* === BREADCRUMB === */
.breadcrumb-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .45rem 1.5rem;
}

.breadcrumb {
  max-width: var(--layout-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  gap: .2rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

.breadcrumb-item + .breadcrumb-item::before { content: '>'; margin-right: .2rem; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item a:hover { text-decoration: underline; }
.breadcrumb-item.active { color: var(--text-muted); }

/* === CONTENT WRAPPER === */
#content-wrapper {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  width: 100%;
  flex: 1;
}

#content-wrapper.has-sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  grid-template-areas: "main sidebar";
  gap: 2rem;
  align-items: start;
}

#main-content { grid-area: main; min-width: 0; }

/* === SIDEBAR === */
#sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-s);
  overflow: hidden;
}

.sidebar-widget-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: .65rem 1rem .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.sidebar-widget-body { padding: .65rem .9rem 1.25rem; }

/* TOC */
.toc-list { list-style: none; font-size: .875rem; }

.toc-list li { margin-bottom: .1rem; }

.toc-list a {
  display: block;
  color: var(--primary);
  text-decoration: none;
  padding: .25rem .4rem;
  border-radius: 4px;
  border-left: 2px solid transparent;
  line-height: 1.4;
  transition: background .1s, border-color .1s;
}

.toc-list a:hover,
.toc-list a.is-active {
  background: var(--primary-light);
  border-left-color: var(--primary);
}

/* Sidebar post list */
.sidebar-post-list { list-style: none; font-size: .875rem; }

.sidebar-post-list li {
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.sidebar-post-list li:last-child { border-bottom: none; }

.sidebar-post-list a {
  color: var(--text);
  text-decoration: none;
  line-height: 1.35;
  transition: color .1s;
}

.sidebar-post-list a:hover { color: var(--primary); }

.sidebar-post-list small {
  color: var(--text-subtle);
  font-size: .75rem;
  font-family: var(--font-heading);
}

/* === ARTIKEL === */
.post-single { }

.article-header { margin-bottom: 1.5rem; }

.article-kicker {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin-bottom: .4rem;
}

.article-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  line-height: 1.22;
  color: var(--text);
  margin-bottom: .75rem;
}

.article-meta {
  font-size: .82rem;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

.article-meta a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* Article body */
.article-body {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-s);
}

.article-body h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--text);
  margin: 2.25rem 0 .65rem;
  padding-top: .4rem;
  border-top: 2px solid var(--primary-light);
  scroll-margin-top: 80px;
}

.article-body h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }

.article-body h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin: 1.6rem 0 .5rem;
  scroll-margin-top: 80px;
}

.article-body h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin: 1.3rem 0 .4rem;
}

.article-body p { margin-bottom: 1rem; }

.article-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .12s;
}
.article-body a:hover { color: var(--primary-dark); }

.article-body ul,
.article-body ol { margin: .65rem 0 1rem 1.35rem; }

.article-body li { margin-bottom: .3rem; }

.article-body strong { font-weight: 700; }

.article-body code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .1em .35em;
  border-radius: 3px;
  color: var(--primary-dark);
}

.article-body pre {
  background: #1A1A2E;
  color: #E8F0FB;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.1rem 0;
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.55;
}

.article-body pre code { background: none; border: none; padding: 0; color: inherit; }

/* Tabellen */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: .9375rem;
}

.article-body th {
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  padding: .6rem .9rem;
  text-align: left;
  font-size: .875rem;
}

.article-body td {
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.article-body tr:nth-child(even) td { background: var(--bg); }
.article-body tr:last-child td { border-bottom: none; }

/* Bilder */
.article-body figure { margin: 1.5rem 0; }
.article-body figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-m);
  border: 1px solid var(--border);
}
.article-body figcaption {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .4rem;
  font-style: italic;
}

/* Summary-Box (Shortcode: 📌 Text) */
.summary-box {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .8rem 1rem;
  margin: 1.25rem 0;
  font-size: .9375rem;
  font-family: var(--font-heading);
}

/* Blockquote */
.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding: .75rem 1rem;
  margin: 1.25rem 0;
  background: #FFF7ED;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-muted);
}

/* === STARTSEITE === */
.home-intro {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-s);
  border-left: 4px solid var(--primary);
}

.home-intro h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin-bottom: .5rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
  margin-top: 1.25rem;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  transition: box-shadow .12s, border-color .12s, transform .1s;
}

.post-card:hover {
  box-shadow: var(--shadow-m);
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}

.post-card__cat {
  font-family: var(--font-heading);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
}

.post-card__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
}

.post-card:hover .post-card__title { color: var(--primary); }

.post-card__excerpt {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* === FOOTER === */
#site-footer {
  background: #12172A;
  color: rgba(255,255,255,.7);
  padding: 2rem 1.5rem 1.25rem;
}

.footer-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-left p { font-size: .875rem; line-height: 1.6; }
.footer-left strong { color: #fff; font-family: var(--font-heading); }
.footer-left a { color: rgba(255,255,255,.6); text-decoration: none; }
.footer-left a:hover { color: #fff; }

.footer-affiliate {
  max-width: var(--layout-max);
  margin: 1rem auto 0;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: .75rem;
}

/* Ad slots */
.ad-slot { min-height: 1px; }

/* === SEITEN-TEMPLATE === */
.page-content h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin-bottom: 1rem;
}

.page-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-s);
}

/* === FOCUS === */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* === RESPONSIVE === */
@media (max-width: 860px) {
  #content-wrapper.has-sidebar {
    grid-template-columns: 1fr;
    grid-template-areas: "main";
  }
  #sidebar {
    display: none; /* Mobile: Sidebar ausblenden, TOC ist inline nicht verfuegbar */
  }
}

@media (max-width: 640px) {
  .header-inner { height: 52px; padding: 0 1rem; }
  #site-branding img { height: 32px; }
  #main-nav { display: none; } /* Mobile-Nav: optional per JS toggle nachruestbar */
  #content-wrapper { padding: 1rem 1rem 2rem; }
  .article-body { padding: 1.1rem .9rem; }
  .home-grid { grid-template-columns: 1fr; }
}

@media print {
  #site-header, #sidebar, #site-footer, .breadcrumb-nav { display: none; }
  #content-wrapper.has-sidebar { display: block; }
  .article-body { box-shadow: none; padding: 0; }
  a[href]::after { content: ' (' attr(href) ')'; font-size: .8em; color: #666; }
}

/* === FEATURED LINKS (Startseite) === */
.home-featured {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: .75rem 0 1.5rem;
}

.home-featured__link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: .5rem .9rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: .9rem;
  transition: background .12s, border-color .12s, transform .1s;
  white-space: nowrap;
}

.home-featured__link::before {
  content: '>';
  color: var(--primary);
  font-size: .9em;
}

.home-featured__link:hover {
  background: var(--primary-light);
  border-left-color: var(--accent);
  color: var(--primary-dark);
  transform: translateX(2px);
  text-decoration: none;
}

/* Home section titles */
.home-section { margin-bottom: 2rem; }

.home-section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--primary-light);
}

/* Home intro box */
#home-intro {
  background: var(--surface);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-s);
}

#home-intro h1 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
  line-height: 1.25;
  margin-bottom: .5rem;
}

#home-intro h1 span {
  display: block;
  font-size: .75em;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: .2rem;
}

#home-intro p {
  font-size: .9375rem;
  color: var(--text-muted);
  margin: 0;
}

/* === STARTSEITE CONTENT-BEREICH === */
.home-content {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-s);
}

.home-content h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
  margin: 2rem 0 .65rem;
  padding-top: .4rem;
  border-top: 2px solid var(--primary-light);
}

.home-content h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.home-content p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.72;
}

.home-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-content a:hover { color: var(--primary-dark); }

/* === HERO-BILD === */
.hero-img {
  display: block;
  width: calc(100% + 4rem);
  margin-left: -2rem;
  margin-right: -2rem;
  max-width: calc(100% + 4rem);
  height: auto;
  border-radius: 0;
}

@media (max-width: 640px) {
  .hero-img {
    width: calc(100% + 1.8rem);
    margin-left: -.9rem;
    margin-right: -.9rem;
    max-width: calc(100% + 1.8rem);
  }
}

/* === ARTIKEL-BILDER (lightbox-faehig) === */
.img-wrap {
  display: block;
  margin: 1.25rem 0;
}

.img-link {
  display: block;
  margin: 0;
}

.article-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  cursor: zoom-in;
}

/* Markdown-generierte Bilder (ohne Lightbox) */
.article-body img:not(.article-img):not(.hero-img) {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  margin: 1.25rem 0;
}

/* Lightbox - Bild in natürlicher Größe */
.lb-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
