/* ── MEMI 2.0 — Global Styles ───────────────────────────────────────────── */
/* Design-Prinzip: "Modern Light Retro"                                       */

:root {
  /* Section accent colors */
  --color-sec-encyclopedia: #900000;
  --color-sec-ht:           #6b1a9e;
  --color-sec-vlab:         #eebb00;
  --color-sec-szene:        #5b5b5b;

  /* Default accent (homepage / no section) */
  --color-accent:       #900000;
  --color-accent-light: #b31515;

  --color-bg:           #ffffff;
  --color-bg-subtle:    #f0f0f0;
  --color-text:         #1a1a1a;
  --color-text-muted:   #555555;
  --color-border:       #d0d0d0;
  --color-link:         #8b1a1a;

  --color-header-bg:    #e7e7e7;
  --color-header-border:#b5b5b5;
  --color-header-text:  #1a1a1a;

  --font-sans: 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Courier New', monospace;

  --content-width: 68rem;
  --header-height: 52px;
  --logo-height: 100px;
  --logo-height-small: 36px;
}

/* ── Per-section accent overrides ────────────────────────────────────────── */
[data-section="encyclopedia"] {
  --color-accent:       #900000;
  --color-accent-light: #b31515;
}
[data-section="ht"] {
  --color-accent:       #6b1a9e;
  --color-accent-light: #8a2abe;
}
[data-section="vlab"] {
  --color-accent:       #eebb00;
  --color-accent-light: #ffd533;
}
[data-section="szene"] {
  --color-accent:       #5b5b5b;
  --color-accent-light: #7a7a7a;
}

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

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  line-height: 1.6;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--color-header-bg);
  border-bottom: 2px solid var(--color-header-border);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: visible;
  transition: border-color 0.25s;
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo-link {
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 4px;
  position: relative;
  z-index: 101;
  display: block;
  line-height: 0;
}

.logo {
  height: var(--logo-height);
  width: auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.18));
  transition: height 0.35s ease, filter 0.35s ease;
}

.site-header.shrunk .logo {
  height: var(--logo-height-small);
  filter: none;
}

.main-nav {
  display: flex;
  gap: 0;
  margin-left: auto;
}

.main-nav a {
  color: var(--color-header-text);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 1rem;
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s, height 0.3s ease;
}

/* nav link height unchanged on shrunk — header stays 52px */

/* Hover & active: filled background block using section accent */
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: var(--color-accent);
  color: #fff;
}

/* Vintage Lab: dark text on yellow background */
[data-section="vlab"] .main-nav a:hover,
[data-section="vlab"] .main-nav a[aria-current="page"] {
  background: var(--color-accent);
  color: #3a2c00;
}

/* ── Search button ───────────────────────────────────────────────────────── */
.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--header-height);
  height: var(--header-height);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-header-text);
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.search-btn:hover,
.search-btn[aria-expanded="true"] {
  background: var(--color-accent);
  color: #fff;
}

/* ── Search panel ────────────────────────────────────────────────────────── */
.search-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 50vw;
  min-width: 280px;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-accent);
  border-left: 1px solid var(--color-border);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  z-index: 98;
}
.search-panel[aria-hidden="true"] { display: none; }

.search-panel-inner {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-input {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 1rem;
  border: none;
  border-bottom: 2px solid var(--color-border);
  padding: 0.4rem 0;
  background: transparent;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-bottom-color: var(--color-accent); }
.search-input::placeholder { color: var(--color-text-muted); }

.search-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-text-muted);
  padding: 0.25rem 0.5rem;
  flex-shrink: 0;
  transition: color 0.15s;
}
.search-close:hover { color: var(--color-accent); }

/* ── Search results ──────────────────────────────────────────────────────── */
.search-results {
  list-style: none;
  padding: 0 1.25rem 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
}

.sr-empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  padding: 0.5rem 0 0.75rem;
}

.sr-item { border-top: 1px solid var(--color-border); }

.sr-link {
  display: block;
  padding: 0.6rem 0;
  text-decoration: none;
  color: inherit;
}
.sr-link:hover .sr-title { color: var(--color-accent); }

.sr-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}

.sr-excerpt {
  display: block;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* highlight match */
.sr-excerpt :global(mark) {
  background: #fff0a0;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Mobile nav header (Start + close) — hidden on desktop ─────────────── */
.nav-mobile-header {
  display: none;
}

/* ── Burger button (hidden on desktop) ──────────────────────────────────── */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.burger span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--color-header-text);
  border-radius: 2px;
  transition: background 0.15s;
}
.burger:hover span { background: var(--color-accent); }

/* ── Nav overlay (mobile) ────────────────────────────────────────────────── */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99;
}
.nav-overlay.open { display: block; }

/* ── Main Content ───────────────────────────────────────────────────────── */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  padding-top: 4.5rem;
  min-height: calc(100vh - var(--header-height) - 60px);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-bg-subtle);
  border-top: 1px solid var(--color-border);
}

.footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.footer-inner a { color: var(--color-text-muted); }

/* ── Typography ─────────────────────────────────────────────────────────── */
h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; line-height: 1.3; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; line-height: 1.4; margin-bottom: 0.5rem; }

a { color: var(--color-link); }
a:hover { color: var(--color-accent-light); }

p { margin-bottom: 1rem; }

/* ── Section Divider ────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 0.4rem;
  margin-bottom: 1.5rem;
}

/* ── Cards / Grid ───────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.card {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  padding: 1.25rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card a { text-decoration: none; color: inherit; }
.card h3 { color: var(--color-text); }
.card .meta { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.4rem; }

/* ── Vintage Disclaimer ──────────────────────────────────────────────────── */
.vintage-notice {
  background: #fffbf0;
  border-left: 4px solid var(--color-accent);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #6b5500;
  margin-bottom: 2rem;
}

/* ── Audio Player ────────────────────────────────────────────────────────── */
audio {
  width: 100%;
  margin: 1rem 0;
  accent-color: var(--color-accent);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .burger { display: flex; }

  .main-nav {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(280px, 80vw);
    background: var(--color-header-bg);
    border-left: 2px solid var(--color-header-border);
    flex-direction: column;
    z-index: 100;
    padding-top: 0;
    overflow-y: auto;
  }
  .main-nav.open { display: flex; }

  .nav-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 0.75rem 0 1.5rem;
    border-bottom: 1px solid var(--color-header-border);
    flex-shrink: 0;
  }

  .nav-start-link {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-header-text);
    text-decoration: none;
    padding: 0.4rem 0;
  }
  .nav-start-link:hover,
  .nav-start-link[aria-current="page"] {
    color: var(--color-accent);
  }

  .nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-text-muted);
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
  }
  .nav-close:hover {
    color: var(--color-accent);
    background: rgba(0,0,0,0.06);
  }

  .main-nav a {
    height: auto;
    padding: 0.9rem 1.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    border-left: 4px solid transparent;
  }
  .main-nav a:hover,
  .main-nav a[aria-current="page"] {
    background: var(--color-accent);
    color: #fff;
    border-left-color: transparent;
  }
  [data-section="vlab"] .main-nav a:hover,
  [data-section="vlab"] .main-nav a[aria-current="page"] {
    background: var(--color-accent);
    color: #3a2c00;
  }

  :root {
    --logo-height: var(--logo-height-small);
  }
  .logo-link {
    align-self: center;
    padding-top: 0;
  }
  .logo { filter: none; }
  h1 { font-size: 1.5rem; }
}
