/* ===================================================
   meeh.us – Hauptstildatei
   Modern/clean, helles Layout, technische Ästhetik
   =================================================== */

/* ── Schriften (lokal, SIL OFL 1.1 – Lizenztexte in assets/fonts/) ──
   Aus den variablen Google-Fonts-Dateien mit fontTools erzeugt:
   lateinischer Zeichenumfang, Gewicht 300–600 (opsz 16), Kursiv nur 400,
   JetBrains Mono Gewicht 400–500.
   "Meeh Serif" ist das verkleinerte Source Serif 4; umbenannt wegen des
   Reserved Font Name "Source" (OFL Abschnitt 3). */
@font-face {
  font-family: 'Meeh Serif';
  src: url('fonts/MeehSerif.woff2') format('woff2');
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Meeh Serif';
  src: url('fonts/MeehSerif-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --col-bg:        #f8f7f4;
  --col-surface:   #ffffff;
  --col-border:    #e2e0d8;
  --col-text:      #1e1d1b;
  --col-muted:     #6b6a66;
  --col-accent:    #2b4c7e;      /* ruhiges Stahlblau */
  --col-accent-lt: #e8edf5;
  --col-link:      #2b4c7e;
  --sidebar-w:     220px;
  --font-body:     'Meeh Serif', Georgia, serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;
  --radius:        6px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--col-bg);
  color: var(--col-text);
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

/* ── Icons (lokal, Tabler Icons, MIT – Lizenztext in assets/icons/) ──
   <i class="ti ti-NAME"></i> wird über eine CSS-Maske mit der SVG-Datei
   eingefärbt (currentColor) und skaliert mit font-size. */
.ti {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  vertical-align: -.125em;
  background-color: currentColor;
  -webkit-mask: var(--ti-icon) center / contain no-repeat;
          mask: var(--ti-icon) center / contain no-repeat;
}
.ti-antenna           { --ti-icon: url('icons/antenna.svg'); }
.ti-broadcast         { --ti-icon: url('icons/broadcast.svg'); }
.ti-building-factory  { --ti-icon: url('icons/building-factory.svg'); }
.ti-car               { --ti-icon: url('icons/car.svg'); }
.ti-cpu               { --ti-icon: url('icons/cpu.svg'); }
.ti-device-desktop    { --ti-icon: url('icons/device-desktop.svg'); }
.ti-download          { --ti-icon: url('icons/download.svg'); }
.ti-file-code         { --ti-icon: url('icons/file-code.svg'); }
.ti-file-text         { --ti-icon: url('icons/file-text.svg'); }
.ti-file-zip          { --ti-icon: url('icons/file-zip.svg'); }
.ti-gauge             { --ti-icon: url('icons/gauge.svg'); }
.ti-menu-2            { --ti-icon: url('icons/menu-2.svg'); }
.ti-photo             { --ti-icon: url('icons/photo.svg'); }
.ti-shield-lock       { --ti-icon: url('icons/shield-lock.svg'); }
.ti-tool              { --ti-icon: url('icons/tool.svg'); }
.ti-user              { --ti-icon: url('icons/user.svg'); }
.ti-wave-sine         { --ti-icon: url('icons/wave-sine.svg'); }

/* ── Sidebar ─────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--col-surface);
  border-right: 1px solid var(--col-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 0 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--col-border);
  margin-bottom: 1rem;
}
.sidebar-brand .callsign {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--col-accent);
  letter-spacing: .04em;
  display: block;
}
.sidebar-brand .name {
  font-size: .8rem;
  color: var(--col-muted);
  margin-top: .15rem;
  display: block;
}

#sidebar-nav ul {
  list-style: none;
  padding: 0 .75rem;
}
#sidebar-nav li { margin: .1rem 0; }
#sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  color: var(--col-muted);
  text-decoration: none;
  font-size: .9rem;
  transition: background .15s, color .15s;
}
#sidebar-nav a:hover {
  background: var(--col-accent-lt);
  color: var(--col-accent);
}
#sidebar-nav a.active {
  background: var(--col-accent-lt);
  color: var(--col-accent);
  font-weight: 600;
}
#sidebar-nav .ti { font-size: 1rem; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem 0;
  border-top: 1px solid var(--col-border);
  font-size: .75rem;
  color: var(--col-muted);
  line-height: 1.5;
}
.sidebar-footer a { color: var(--col-muted); }

/* ── Hamburger (nur Mobile) ──────────────────────── */
#nav-toggle {
  display: none;
  position: fixed;
  top: .9rem;
  left: .9rem;
  z-index: 200;
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}
#nav-toggle .ti { font-size: 1.3rem; color: var(--col-accent); }

/* ── Hauptinhalt ─────────────────────────────────── */
#main {
  flex: 1;
  padding: 3rem 3.5rem;
  max-width: 860px;
}

/* ── Typographie ─────────────────────────────────── */
h1 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--col-text);
  line-height: 1.2;
  margin-bottom: 1rem;
}
h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--col-accent);
  margin: 2.5rem 0 .75rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--col-border);
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 .4rem;
}
p { margin-bottom: 1rem; color: var(--col-text); }
a { color: var(--col-link); }
a:hover { text-decoration: underline; }

.lead {
  font-size: 1.1rem;
  color: var(--col-muted);
  margin-bottom: 2rem;
  font-style: italic;
}

/* ── Seiten-Header ───────────────────────────────── */
.page-header {
  border-bottom: 2px solid var(--col-accent);
  padding-bottom: 1.25rem;
  margin-bottom: 2.5rem;
}
.page-header .badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  background: var(--col-accent-lt);
  color: var(--col-accent);
  padding: .2rem .6rem;
  border-radius: 3px;
  margin-bottom: .5rem;
  letter-spacing: .05em;
}

/* ── Fließtext-Listen ─────────────────────────────── */
.text-list { margin: 0 0 1rem 1.25rem; }
.text-list li { margin-bottom: .25rem; }

/* ── Werdegang ───────────────────────────────────── */
.cv-list {
  list-style: none;
  margin: 1rem 0 1.5rem;
  border-left: 2px solid var(--col-border);
}
.cv-list li {
  position: relative;
  padding: 0 0 1rem 1.25rem;
}
.cv-list li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: .55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--col-surface);
  border: 2px solid var(--col-accent);
}
.cv-list .cv-title {
  display: block;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--col-accent);
  letter-spacing: .03em;
}

/* ── Info-Box (Visitenkarte o.ä.) ────────────────── */
.info-box {
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-left: 3px solid var(--col-accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
  clear: both;
}
.info-box dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.5rem; }
.info-box dt { font-size: .8rem; color: var(--col-muted); font-family: var(--font-mono); align-self: center; }
.info-box dd { font-size: .95rem; }

/* ── Gerätetabellen ──────────────────────────────── */
.table-wrap { margin: 1.5rem 0; }
.device-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: .92rem;
  line-height: 1.45;
}
.device-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  color: var(--col-muted);
  letter-spacing: .04em;
  padding: .7rem .9rem;
  border-bottom: 2px solid var(--col-border);
}
.device-table td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--col-border);
  vertical-align: top;
}
.device-table tbody tr:last-child td { border-bottom: none; }
.device-table td:first-child { color: var(--col-muted); white-space: nowrap; }
.device-table strong { font-weight: 600; }
.device-table .dev-desc {
  display: block;
  font-size: .8rem;
  color: var(--col-muted);
}
.device-table .qty { color: var(--col-muted); }
.device-table .marks { white-space: nowrap; text-align: right; }

.measure-table td:first-child { color: var(--col-text); white-space: normal; width: 40%; }
.measure-table .maker { color: var(--col-muted); }

/* Kennzeichen: HW = Hardware restauriert/modifiziert, SW = Software/Firmware modifiziert */
.mark {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .04em;
  padding: .05rem .4rem;
  border-radius: 3px;
  border: 1px solid;
  cursor: help;
}
.mark-hw { color: #8a4b12; background: #fbf1e6; border-color: #ecd3b6; }
.mark-sw { color: var(--col-accent); background: var(--col-accent-lt); border-color: #c9d5e8; }

.mark-legend {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem .75rem;
  align-items: center;
  font-size: .85rem;
  color: var(--col-muted);
  margin: 0 0 2rem;
}
.mark-legend .mark { cursor: default; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Projektkarten ───────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.project-card {
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.project-card:hover {
  border-color: var(--col-accent);
  box-shadow: 0 4px 12px rgba(43,76,126,.1);
  text-decoration: none;
}
.project-card .card-icon {
  font-size: 1.6rem;
  color: var(--col-accent);
  margin-bottom: .75rem;
  display: block;
}
.project-card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.project-card p  { font-size: .85rem; color: var(--col-muted); margin: 0; }
.project-card .tag {
  display: inline-block;
  margin-top: .75rem;
  font-family: var(--font-mono);
  font-size: .7rem;
  background: var(--col-accent-lt);
  color: var(--col-accent);
  padding: .15rem .5rem;
  border-radius: 3px;
}

/* ── Downloads-Liste ─────────────────────────────── */
.download-list { list-style: none; margin: 1rem 0; }
.download-list li {
  padding: .6rem 0;
  border-bottom: 1px solid var(--col-border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.download-list .ti { font-size: 1.1rem; color: var(--col-accent); flex-shrink: 0; }
.download-list a { font-size: .9rem; }
.download-list .dl-desc { font-size: .78rem; color: var(--col-muted); display: block; }

.download-list .dl-hash {
  display: block;
  font-size: .72rem;
  color: var(--col-muted);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}
.download-main a { font-weight: 600; font-size: 1rem; }

/* ── Dokumente (aus Markdown umgesetzt) ──────────── */
.doc ul, .doc ol { margin: 0 0 1rem 1.25rem; }
.doc li { margin-bottom: .3rem; }
.doc li > p { margin-bottom: .3rem; }
.doc code {
  font-family: var(--font-mono);
  font-size: .82em;
  background: var(--col-accent-lt);
  padding: .05rem .3rem;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
.doc pre {
  background: #1e1d1b;
  color: #f1efe8;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1.25rem;
  font-size: .8rem;
  line-height: 1.5;
}
.doc pre code { background: none; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
.doc blockquote {
  border-left: 3px solid var(--col-accent);
  background: var(--col-surface);
  padding: .75rem 1rem .1rem;
  margin: 0 0 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.doc hr { border: none; border-top: 1px solid var(--col-border); margin: 2rem 0; }
.doc-table {
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: .84rem;
  line-height: 1.45;
  background: var(--col-surface);
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.doc-table th, .doc-table td {
  text-align: left;
  vertical-align: top;
  padding: .45rem .7rem;
  border: 1px solid var(--col-border);
}
.doc-table th { font-weight: 600; background: var(--col-accent-lt); }
.doc-table code { overflow-wrap: normal; white-space: nowrap; }

.doc img {
  display: block;
  max-width: min(100%, 480px);
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--col-border);
  box-shadow: var(--shadow-sm);
}
.doc p:has(> img) + p > em { font-size: .85rem; color: var(--col-muted); }

.version-note {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--col-muted);
}
.version-note strong { color: var(--col-text); font-weight: 500; }

/* Rechtliche Abschnitte vor dem Download deutlich absetzen */
.legal {
  background: #fdf8f0;
  border: 1px solid #ecd3b6;
  border-left: 4px solid #c27a2c;
  border-radius: var(--radius);
  padding: .25rem 1.5rem .75rem;
  margin: 2.5rem 0;
}
.legal h2 { color: #8a4b12; border-bottom-color: #ecd3b6; margin-top: 1.25rem; }

.notice {
  background: #fdf8f0;
  border: 2px solid #c27a2c;
  border-radius: var(--radius);
  padding: 1rem 1.25rem .25rem;
  margin: 1rem 0 1.5rem;
}
.notice .notice-title { font-weight: 600; color: #8a4b12; margin-bottom: .5rem; }
.notice .notice-source {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--col-muted);
  margin-bottom: .3rem;
}
.notice ul { margin: 0 0 1rem 1.25rem; }
.notice code { font-family: var(--font-mono); font-size: .82em; }

/* Sprungmarken und Blättern */
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: -1rem 0 2rem;
}
.toc a {
  font-family: var(--font-mono);
  font-size: .75rem;
  text-decoration: none;
  padding: .2rem .6rem;
  border: 1px solid var(--col-border);
  border-radius: 3px;
  background: var(--col-surface);
}
.toc a:hover { border-color: var(--col-accent); }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--col-border);
  margin-top: 2.5rem;
  padding-top: 1rem;
  font-size: .9rem;
}
.pager a:last-child { text-align: right; }

/* ── Fotogalerie ─────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.gallery-item {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--col-border);
  aspect-ratio: 4/3;
  background: var(--col-border);
  transition: opacity .2s;
}
.gallery-item:hover { opacity: .85; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Galerie-Links, Bild mit Unterschrift ────────── */
a.gallery-item { display: block; }

.figure-inline {
  float: right;
  width: 220px;
  margin: .25rem 0 1rem 1.75rem;
}
.figure-inline img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--col-border);
  box-shadow: var(--shadow-sm);
}
.figure-inline figcaption {
  font-size: .78rem;
  color: var(--col-muted);
  line-height: 1.4;
  margin-top: .4rem;
}
h2 { clear: both; }

/* ── Technische Daten ────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-size: .9rem;
  line-height: 1.45;
  background: var(--col-surface);
  border: 1px solid var(--col-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.spec-table caption {
  text-align: left;
  font-weight: 600;
  padding: 0 0 .4rem;
}
.spec-table th, .spec-table td {
  text-align: left;
  vertical-align: top;
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--col-border);
}
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: none; }
.spec-table th {
  width: 34%;
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 400;
  color: var(--col-muted);
  padding-top: .65rem;
}

/* ── Brotkrumen ──────────────────────────────────── */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--col-muted);
  margin-bottom: .5rem;
}

/* ── Lightbox ────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#lightbox.open { display: flex; }
#lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
#lightbox-close {
  position: absolute;
  top: 1rem; right: 1.25rem;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}
#lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: .85rem;
  font-family: var(--font-mono);
}

/* ── Placeholder-Bild ────────────────────────────── */
.img-placeholder {
  background: var(--col-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--col-muted);
  font-size: .8rem;
  font-family: var(--font-mono);
}

/* ── Profilbild ──────────────────────────────────── */
.profile-img {
  float: right;
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  border: 1px solid var(--col-border);
  margin: 0 0 1.5rem 2rem;
  object-fit: cover;
  object-position: 50% 25%;
  box-shadow: var(--shadow-sm);
}

/* ── Responsive Mobile ───────────────────────────── */
@media (max-width: 768px) {
  /* Ohne JavaScript: Menü steht oben über dem Inhalt */
  body { flex-direction: column; }
  #sidebar {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--col-border);
    padding: 1.25rem 0 .75rem;
  }
  .sidebar-footer { display: none; }
  #main {
    padding: 2rem 1.25rem;
    max-width: 100%;
  }

  /* Mit JavaScript: ausklappbares Menü über den Hamburger-Knopf */
  .js body { flex-direction: row; }
  .js #nav-toggle { display: flex; }
  .js #sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 100;
    width: var(--sidebar-w);
    transition: left .25s ease;
    height: 100%;
    border-right: 1px solid var(--col-border);
    border-bottom: none;
    padding: 2rem 0 1rem;
    box-shadow: 4px 0 20px rgba(0,0,0,.12);
  }
  .js #sidebar.open { left: 0; }
  .js .sidebar-footer { display: block; }
  .js #main { padding-top: 4.5rem; }
  h1 { font-size: 1.5rem; }

  .device-table thead { display: none; }
  .device-table, .device-table tbody, .device-table tr, .device-table td { display: block; }
  .device-table tr {
    position: relative;
    padding: .7rem .9rem;
    border-bottom: 1px solid var(--col-border);
  }
  .device-table tbody tr:last-child { border-bottom: none; }
  .device-table td { padding: 0; border: none; }
  .device-table td:first-child { font-size: .78rem; }
  .device-table td:nth-child(3) { margin-top: .25rem; }
  .device-table .marks { position: absolute; top: .7rem; right: .9rem; }
  .measure-table td:first-child { font-size: inherit; width: auto; }
  .profile-img { float: none; margin: 0 0 1.5rem; display: block; }
  .figure-inline { float: none; width: 100%; max-width: 320px; margin: 0 0 1.5rem; }
  .spec-table th { width: 42%; }
}
