/* Reimesch Kommunikationssysteme – Stylesheet
   Aufbau: Variablen, Grundlayout, Header/Navigation, Inhalt, Footer, Meldung, Responsive */

:root {
  --blue: #0877b9;
  --grey: #f0f0f0;
  --grey-dark: #d0d0d0;
  --text: #000;
  --font-text: Verdana, Geneva, sans-serif;
  --font-head: Tahoma, Geneva, sans-serif;
  --content-width: 1140px;
  --gutter: 3rem;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 16px/22px var(--font-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Footer bleibt auch bei kurzen Seiten am unteren Fensterrand */
main { flex: 1 0 auto; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ---------- Header und Navigation ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 80px;
  padding: 0 40px;
  background: var(--blue);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 22px;
  color: #fff;
  font: bold 20px/22px var(--font-head);
}
.brand:hover { text-decoration: none; }
.brand img { display: block; width: 50px; height: 50px; }

.menu, .menu ul { margin: 0; padding: 0; list-style: none; }
.menu { display: flex; }
.menu li { margin: 0; }
.menu > li { position: relative; }
.menu > li > span {
  display: block;
  padding: 0 22px;
  line-height: 80px;
  color: #fff;
  cursor: default;
}
.menu > li:hover > span,
.menu > li:focus-within > span,
.menu > li.current > span { color: #000; }

.menu li ul {
  display: none;
  position: absolute;
  z-index: 10;
  top: 100%;
  right: 0;
  min-width: 100%;
  background: #fff;
  box-shadow: 0 5px 15px rgba(0, 0, 0, .15);
}
.menu li:hover > ul,
.menu li:focus-within > ul { display: block; }
.menu li ul a {
  display: block;
  padding: 9.6px 20px;
  line-height: 24px;
  color: #333;
  white-space: nowrap;
}
.menu li ul a:hover { color: var(--blue); background: var(--grey); text-decoration: none; }

.nav-toggle { display: none; }

/* ---------- Seiteninhalt ---------- */

/* Seitentitel: graues Band mit zentrierter Überschrift */
.title { padding: .5rem 0; background: var(--grey); }
.title.plain { background: none; }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1.2rem;
  padding-top: 1.5rem;
  font-family: var(--font-head);
  line-height: 1.4;
}
h1:first-child, h2:first-child, h3:first-child, h4:first-child,
h1 + h2, h1 + h3, h1 + h4, h2 + h3, h2 + h4, h3 + h4, h4 + h5 { padding-top: 0; }

h1 { margin: 0; font-size: 42px; color: var(--blue); text-align: center; }
h2 { font-size: 32px; }
h3 { font-size: 28px; }
h4 { font-size: 22px; }
h5 { font-size: 20px; }
h6 { font-size: 18px; }

p, ul, ol, table, figure { margin: 0 0 1.5rem; }
li { margin-bottom: 8px; }
ul, ol { padding-left: 40px; }
ul.square { list-style-type: square; }
h1:last-child, h2:last-child, h3:last-child, h4:last-child, h5:last-child, h6:last-child,
p:last-child, ul:last-child, ol:last-child, li:last-child, table:last-child, figure:last-child { margin-bottom: 0; }

/* Zeile mit bis zu 12 Spalten, Standard 8 + 4 */
.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  max-width: calc(var(--content-width) + 5rem);
  margin: 0 auto;
  padding: 2rem 2.5rem;
}
.row.cont { padding-top: 0; }
.row > div { min-width: 0; }
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }

/* Grau hinterlegte Spalte (z. B. Inhaltsübersicht) */
.box { margin: -.5rem -1rem; padding: .5rem; background: var(--grey); }

figure { text-align: center; }
figcaption { margin-top: .5rem; }

table { width: 100%; margin-bottom: 0; border-collapse: collapse; font-size: .8rem; }
tr:nth-child(odd) { background: var(--grey); }
/* Tabellen mit Spaltenraster (class="matrix"): jede zweite Spalte dezent abgedunkelt,
   erste Spalte leicht blau getönt, kein Zeilenumbruch in Zellen (bei Bedarf horizontal scrollbar) */
table.matrix { display: block; overflow-x: auto; }
table.matrix > tbody { display: table; min-width: 100%; }
table.matrix td { white-space: nowrap; }
table.matrix.wrap td { white-space: normal; }
table.matrix + table.matrix { margin-top: 1.5rem; }
table.matrix td:nth-child(even) { background: rgba(0, 0, 0, .035); }
table.matrix td:first-child { width: 14rem; min-width: 14rem; background: rgba(8, 119, 185, .09); font-weight: bold; }
caption { padding: 1rem 0 .5rem; font-weight: bold; text-align: left; }
td, th { padding: 9.6px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid #ebebeb; }

/* Startseite: Kacheln mit Bild */
.row.tiles {
  max-width: calc(var(--content-width) + 3rem);
  padding: .5rem 1.5rem;
  column-gap: 1rem;
}
.tile { margin: .5rem 0; background: var(--grey); }
.tile figure { margin: 0 0 1rem; background: var(--grey-dark); line-height: 0; }
.tile figure img { display: inline-block; }
.tile h4, .tile p { padding: 0 1rem; }
.tile h4 a { color: #000; }
.tile p { padding-bottom: 1.5rem; }

/* ---------- Meldung (siehe _partials/banner.html) ---------- */

.notice { --notice-time: .45s;   /* Dauer des Einlaufens; der Text wird in derselben Zeit getippt (js/main.js liest den Wert) */
  padding: 12px 40px; background: #fff3cd; color: #000; text-align: center; border-bottom: 1px solid #e6d48f; }
.notice p { margin: 0; }

/* Auftritt (Höhe bleibt konstant): Farbe läuft einmal von links nach rechts ein und leuchtet kurz auf,
   der Text wird dabei "live getippt" (js/main.js setzt jeden Buchstaben in ein <span class="ch">).
   Ohne JavaScript oder bei "Bewegung reduzieren" steht der Banner sofort da. */
@media (prefers-reduced-motion: no-preference) {
  .notice {
    animation: notice-wipe var(--notice-time) ease-out backwards, notice-glow 1.2s ease-out var(--notice-time) backwards;
  }
  .js .notice p { opacity: 0; animation: notice-fallback 0s 3s forwards; }   /* Notausgang, falls das Skript nicht läuft */
  .js .notice.typed p { opacity: 1; animation: none; }
  .notice .ch { opacity: 0; animation: notice-char 0s forwards; }
}
@keyframes notice-wipe {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes notice-glow {
  from { background: #ffe08a; }
  to   { background: #fff3cd; }
}
@keyframes notice-char { to { opacity: 1; } }
@keyframes notice-fallback { to { opacity: 1; } }

/* ---------- Footer ---------- */

.site-footer { background: var(--grey); }
.footer-in {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--gutter);
  padding: 2rem 40px;
  background: var(--grey);
}
.footer-in ul { margin: 0; padding: 0; list-style: none; }
.footer-in li { margin: 0 0 8px; line-height: 22.4px; }
.footer-in lih1:last-child, h2:last-child, h3:last-child, h4:last-child, h5:last-child, h6:last-child,
p:last-child, ul:last-child, ol:last-child, li:last-child, table:last-child, figure:last-child { margin-bottom: 0; }

/* Nach-oben-Schaltfläche (Einblenden per js/main.js) */
.to-top {
  display: none;
  position: fixed;
  z-index: 20;
  right: 15px;
  bottom: 15px;
  width: 50px;
  height: 50px;
  border-radius: 4.8px;
  background: rgba(0, 0, 0, .3);
}
.to-top::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 21px;
  width: 12px;
  height: 12px;
  border: solid #fff;
  border-width: 3px 0 0 3px;
  transform: rotate(45deg);
}
.to-top.show { display: block; }
.to-top:hover { background: var(--blue); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .row { display: block; padding: 1.5rem 1rem; }
  .row.tiles { padding: .5rem 1rem; }
  .row > div + div { margin-top: 1.5rem; }
  .row.cont { padding-top: 0; }
  .footer-in { padding: 2rem 1rem; text-align: center; }
  .footer-in ul + ul { margin-top: 8px; }
  .site-header { padding: 0 1rem; flex-wrap: wrap; }
  h1 { font-size: 32px; }
  .box { margin: 1.5rem -1rem 0; }
  .row > .box:first-child { margin-top: 0; }
  .brand { flex: 1 1 0; min-width: 0; gap: 12px; font-size: 18px; }

  .nav-toggle {
    display: block;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }
  .nav-toggle i, .nav-toggle i::before, .nav-toggle i::after {
    display: block;
    position: absolute;
    width: 26px;
    height: 3px;
    border-radius: 2px;
    background: #fff;
    content: "";
  }
  .nav-toggle i { margin: 0 12px; }
  .nav-toggle i::before { top: -8px; left: 0; }
  .nav-toggle i::after { top: 8px; left: 0; }

  #nav { display: none; width: 100%; padding-bottom: 1rem; }
  .nav-open #nav { display: block; }
  .menu { display: block; }
  .menu > li > span { line-height: 44px; padding: 0 4px; font-weight: bold; color: #fff !important; }
  .menu li ul { display: block; position: static; background: none; box-shadow: none; }
  .menu li ul a { color: #fff; padding: 6px 4px 6px 20px; white-space: normal; }
  .menu li ul a:hover { background: none; color: #fff; text-decoration: underline; }
}

/* Ohne JavaScript bleibt das Menü sichtbar */
@media (max-width: 900px) {
  html:not(.js) #nav { display: block; }
  html:not(.js) .nav-toggle { display: none; }
}

@media (max-width: 600px) {
  h1 { font-size: 28px; }
  h4 { font-size: 20px; }
  .notice { padding: 12px 1rem; }
}

/* ---------- Produktseiten (circuit-design/<produkt>/) ---------- */

.row.product { grid-template-columns: repeat(12, 1fr); }
.product h1 { margin: 0 0 1.2rem; text-align: left; }
.product figure { margin: 0; }
.breadcrumb { margin-bottom: .6rem; font-size: .9rem; line-height: 1.6; }
.meta { font-size: .9rem; line-height: 1.6; }

/* Ähnliche Produkte */
.related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.related li { margin: 0; }
.related a { display: block; padding: 1rem; color: #000; }
.related img { display: block; width: 100%; height: auto; margin-bottom: .8rem; }
.related a:hover span { color: var(--blue); }

@media (max-width: 900px) {
  .related { grid-template-columns: 1fr; }
}

/* ---------- Seitenleiste mit Abschnittsmarkierung (nur auf breiten Bildschirmen) ---------- */

.sidenav { display: none; }

@media (min-width: 1600px) {
  .sidenav {
    display: block;
    position: fixed;
    z-index: 5;
    top: 12rem;
    right: calc(50% + var(--content-width) / 2 + 3rem);
    width: 12.65rem;
    font-size: 1rem;
  }
  .sidenav ul { margin: 0; padding: 0; list-style: none; }
  .sidenav li { margin: 0; }
  .sidenav a {
    display: block;
    padding: .4rem 1.15rem .4rem 0;
    border-right: 2px solid var(--grey-dark);
    color: #777;
    text-align: right;
    transition: color .2s, border-color .2s;
  }
  .sidenav a:hover { color: var(--blue); text-decoration: none; }
  .sidenav a[aria-current] { border-right-color: var(--blue); color: var(--blue); font-weight: bold; }
}

h4[id] { scroll-margin-top: 1rem; }

/* ---------- Hinweis "Achtung" (z. B. Auslaufprodukt / EOL) ----------
   <div class="warning"><strong>Achtung:</strong> Dieses Produkt wird nicht mehr hergestellt.</div> */

.warning {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem 1rem 4rem;
  border-left: 5px solid #d9730d;
  background: #fff4e5;
  color: #000;
}
.warning::before {
  content: "!";
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: #d9730d;
  color: #fff;
  font: bold 1.1rem/1.75rem var(--font-head);
  text-align: center;
}
.warning > :last-child { margin-bottom: 0; }
.warning strong { color: #a85408; }
