/* ==========================================================
   DocuFlow · Swiss Design Frontend
   Version: 1.0 · 2026-02
   Verwendung: howto.php, step.php (self-contained templates)
   ========================================================== */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #E30613;
  --black:    #0A0A0A;
  --grey-1:   #1C1C1C;
  --grey-2:   #6B6B6B;
  --grey-3:   #B8B8B8;
  --grey-4:   #E8E8E8;
  --grey-5:   #F4F4F4;
  --white:    #FFFFFF;
  --col:      680px;    /* max-width Inhaltskolumne */
  --nav-w:    240px;    /* Sidebar-Breite */
  --header-h: 56px;     /* Header-Höhe */
  --font:     'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ease:     cubic-bezier(.4,0,.2,1);
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  color: var(--black);
  background: var(--white);
  line-height: 1.5;
  overflow-x: clip; /* clip: kein Child-Scrolling-Block auf Mobile */
}

/* ── Layout ────────────────────────────────────────────────── */
.site-wrap {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--black);
  background: var(--white);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: inherit;
}

.site-logo-mark {
  width: 24px; height: 24px;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.site-logo-mark svg { width: 14px; height: 14px; fill: var(--white); }

.site-meta {
  font-size: 11px;
  color: var(--grey-2);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Hamburger – nur mobil sichtbar */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px; height: 32px;
  cursor: pointer;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 1.5px;
  background: var(--black);
  transition: transform .25s var(--ease), opacity .2s;
  transform-origin: center;
}

body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Sidebar ───────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--grey-4);
  padding: 32px 0;
  background: var(--grey-5);
  overscroll-behavior: contain;
}

.nav-section { margin-bottom: 32px; }

.nav-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--grey-3);
  padding: 0 24px 8px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 24px;
  font-size: 13px;
  color: var(--grey-1);
  text-decoration: none;
  cursor: pointer;
  transition: background .1s;
}

.nav-item:hover { background: var(--grey-4); }

.nav-item.active {
  background: var(--white);
  color: var(--black);
  font-weight: 500;
  border-right: 2px solid var(--red);
}

.nav-dot {
  width: 6px; height: 6px;
  background: var(--grey-3);
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-item.active .nav-dot { background: var(--red); }

/* Sub-Nav (HowTo-Liste unter aktivem Produkt) */
.nav-sub {
  padding: 2px 0 6px 32px;
}

.nav-item--sub {
  font-size: 12px;
  padding: 5px 12px;
  color: var(--grey-2);
  border-radius: 0;
}

.nav-item--sub.active {
  color: var(--black);
  font-weight: 600;
  border-right: 2px solid var(--red);
  background: var(--white);
}

/* ── Main Content ──────────────────────────────────────────── */
.site-main {
  padding: 48px 64px 80px;
  min-width: 0; /* verhindert overflow bei grid */
}

/* ── Breadcrumb ────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey-2);
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.breadcrumb a { color: inherit; text-decoration: none; }
.breadcrumb a:hover { color: var(--black); }
.breadcrumb-sep { color: var(--grey-3); }
.breadcrumb-current { color: var(--black); font-weight: 500; }

/* ── HowTo Header ──────────────────────────────────────────── */
.howto-header {
  max-width: var(--col);
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--grey-4);
}

.howto-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 12px;
}

.howto-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.02em;
  color: var(--black);
  margin-bottom: 16px;
}

.howto-description {
  font-size: 15px;
  color: var(--grey-1);
  line-height: 1.6;
  margin-bottom: 20px;
}

.howto-meta {
  display: flex;
  gap: 24px;
  font-size: 11px;
  color: var(--grey-2);
  letter-spacing: .04em;
  flex-wrap: wrap;
}

.howto-meta span { display: flex; align-items: center; gap: 5px; }

/* ── Step ──────────────────────────────────────────────────── */
.step {
  max-width: var(--col);
  margin-bottom: 48px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0 20px;
}

.step-number-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 2px;
}

.step-number {
  width: 28px; height: 28px;
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-line {
  width: 1px;
  flex: 1;
  background: var(--grey-4);
  margin-top: 8px;
}

.step-body { padding-bottom: 16px; }

.step-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -.01em;
  margin-bottom: 10px;
  padding-top: 4px;
}

/* Schritt-Text (Parsedown-Output) */
.step-text {
  font-size: 14px;
  color: var(--grey-1);
  line-height: 1.65;
  margin-bottom: 16px;
}

.step-text p  { margin-bottom: .75em; }
.step-text ul,
.step-text ol { margin: .5em 0 .75em 1.25em; }
.step-text li { margin-bottom: .25em; }
.step-text strong { color: var(--black); font-weight: 600; }
.step-text em     { font-style: italic; }
.step-text a  { color: var(--black); text-underline-offset: 2px; }
.step-text a:hover { color: var(--red); }

/* Tabellen aus Parsedown */
.step-text table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
  margin-bottom: 1em;
}
.step-text th,
.step-text td {
  padding: 6px 10px;
  border: 1px solid var(--grey-4);
  text-align: left;
}
.step-text th {
  background: var(--grey-5);
  font-weight: 600;
}

/* ── Code (inline + Parsedown-Blöcke) ─────────────────────── */
code {
  font-family: 'Courier New', monospace;
  font-size: .85em;
  background: var(--grey-4);
  padding: 1px 5px;
  color: var(--black);
}

pre {
  background: var(--grey-5);
  border: 1px solid var(--grey-4);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ── Step Visuals (Bild / Video) ───────────────────────────── */
.step-visual {
  margin-bottom: 16px;
}

.step-visual img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--grey-4);
}

/* Bild klickbar für Vollgrösse */
.step-visual a { display: block; }
.step-visual a img { transition: opacity .15s; }
.step-visual a:hover img { opacity: .92; }

/* Bild mit Play-Overlay */
.step-visual-wrap {
  position: relative;
  display: block;
  cursor: pointer;
}

.play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 1;
  transition: background .15s;
  pointer-events: none;
}

.step-visual-wrap:hover .play-btn { background: var(--red); }
.play-btn svg { width: 20px; height: 20px; fill: #fff; margin-left: 4px; }

/* Nur Video */
.step-visual--video-only video {
  max-width: 100%;
  width: 100%;
  border: 1px solid var(--grey-4);
}

/* ── Video Dialog ──────────────────────────────────────────── */
dialog.df-video-dialog {
  border: none;
  border-radius: 4px;
  padding: 0;
  max-width: 90vw;
  background: #000;
  position: relative;
}

dialog.df-video-dialog::backdrop { background: rgba(0,0,0,.78); }

dialog.df-video-dialog video {
  display: block;
  max-width: 100%;
  max-height: 80vh;
}

.df-dialog-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

/* ── Mermaid / Diagram ─────────────────────────────────────── */
.step-text .mermaid,
.step-diagram {
  background: var(--grey-5);
  border: 1px solid var(--grey-4);
  border-left: 3px solid var(--black);
  padding: 20px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mermaid rendert SVG mit fixem width-Attribut → max-width none damit's scrollt */
.step-text .mermaid svg,
.step-diagram svg {
  max-width: none;
  height: auto;
  display: block;
}

/* ── Hints ─────────────────────────────────────────────────── */
.step-hint {
  display: flex;
  gap: 12px;
  background: var(--grey-5);
  border-left: 3px solid var(--grey-3);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--grey-1);
  line-height: 1.55;
}

.step-hint.hint-tip { border-color: var(--black); }

.hint-icon {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--grey-2);
  padding-top: 1px;
}

.hint-tip .hint-icon { color: var(--black); }

/* ── Footer Nav (Prev/Next HowTo) ──────────────────────────── */
.howto-footer {
  max-width: var(--col);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid var(--grey-4);
  margin-top: 16px;
  gap: 12px;
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--black);
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid var(--black);
  cursor: pointer;
  transition: background .1s, color .1s;
  white-space: nowrap;
  flex-shrink: 0;
}

.footer-btn:hover { background: var(--black); color: var(--white); }
.footer-btn.primary { background: var(--black); color: var(--white); }
.footer-btn.primary:hover { background: var(--red); border-color: var(--red); }
.footer-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Mobile Overlay ────────────────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 149;
  opacity: 0;
  transition: opacity .3s var(--ease);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {

  .site-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }

  /* Hamburger sichtbar, Meta ausblenden */
  .nav-toggle  { display: flex; }
  .site-meta   { display: none; }
  .site-header { padding: 0 20px; }

  /* Nav: slidet von links rein */
  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: min(var(--nav-w), 80vw);
    height: 100%;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform .32s var(--ease);
    box-shadow: none;
    padding-top: calc(var(--header-h) + 16px);
  }

  body.nav-open .site-nav {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.12);
  }

  /* Overlay */
  .nav-overlay { display: block; }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: all; }

  /* Main: volle Breite */
  .site-main {
    padding: 32px 20px 64px;
    grid-column: 1;
  }

  .howto-title { font-size: 22px; }

  .step { grid-template-columns: 32px 1fr; gap: 0 14px; }
  .step-number { width: 24px; height: 24px; font-size: 11px; }

  .howto-footer { flex-direction: column; align-items: stretch; }
  .footer-btn   { justify-content: center; }

  .howto-meta { gap: 12px; }
}

@media (max-width: 480px) {
  .site-main  { padding: 24px 16px 56px; }
  .breadcrumb { font-size: 10px; }
}
