/* ============================================================
   neuropsy.academy — Design-System
   ============================================================ */

:root {
  --accent:        #6f5d49;   /* Gehirn-Braungrau — Signaturfarbe (Hellmodus) */
  --accent-strong: #574736;
  --accent-soft:   #efe9e1;
  --brand-a:       #8a7258;   /* Logo-Verlauf */
  --brand-b:       #5d4c3a;
  --book:          #3a4f9c;
  --book-soft:     #eceefb;
  --merke:         #0f7d6b;
  --wichtig:       #b9770a;
  --achtung:       #c0392b;

  --bg:            #ffffff;
  --surface:       #f6f8fa;
  --surface-2:     #eef2f5;
  --card:          #ffffff;
  --ink:           #16242b;
  --ink-soft:      #3a4a52;
  --muted:         #647079;
  --line:          #e3e9ed;
  --line-strong:   #cdd7dd;

  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 2px rgba(16,32,40,.04), 0 4px 16px rgba(16,32,40,.05);
  --maxw:          1180px;
  --read:          74ch;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  --accent:        #4cb6c8;   /* Petrol — im Dunkelmodus besser sichtbar als Braungrau */
  --accent-strong: #6fc8d7;
  --accent-soft:   #14323a;
  --brand-a:       #3f9fb0;
  --brand-b:       #2f7d8c;
  --book:          #9aa6ee;
  --book-soft:     #1b2140;
  --merke:         #46c2ac;
  --wichtig:       #e0a437;
  --achtung:       #ec6a5c;

  --bg:            #0e1417;
  --surface:       #131b1f;
  --surface-2:     #182227;
  --card:          #141d22;
  --ink:           #e8eef1;
  --ink-soft:      #c3ced4;
  --muted:         #8c9aa2;
  --line:          #233038;
  --line-strong:   #324049;
  --shadow:        0 1px 2px rgba(0,0,0,.3), 0 6px 22px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: .6rem 1.25rem;
  display: flex; align-items: center; gap: 1.1rem;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.brand-dot { color: var(--accent); }
.brand-img { width: 30px; height: 30px; object-fit: contain; display: block; flex: none; }
.login-logo { width: 68px; height: 68px; object-fit: contain; display: block; margin: 0 auto .6rem; }
.mainnav { display: flex; gap: .25rem; margin-right: auto; }
.mainnav a {
  color: var(--ink-soft); padding: .42rem .7rem; border-radius: var(--radius-sm);
  font-size: .94rem; font-weight: 500;
}
.mainnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.mainnav a.active { color: var(--accent); background: var(--accent-soft); }
.searchbox input {
  width: 200px; max-width: 34vw; padding: .45rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  color: var(--ink);
}
.searchbox input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.theme-toggle, .nav-toggle {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  width: 38px; height: 38px; border-radius: 999px; cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover, .nav-toggle:hover { background: var(--surface-2); }
.theme-toggle .t-moon { display: none; }
html[data-theme="dark"] .theme-toggle .t-sun { display: none; }
html[data-theme="dark"] .theme-toggle .t-moon { display: inline; }
.nav-toggle { display: none; }
.logout-link { color: var(--muted); font-size: .9rem; }

/* ---------- Page ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page.reading { max-width: calc(var(--read) + 4rem); }

/* ---------- Hero / Dashboard ---------- */
.hero { padding: 1.5rem 0 1rem; }
.hero h1 { font-size: 2rem; margin: 0 0 .3rem; }
.hero p { color: var(--muted); margin: 0; max-width: 60ch; }

.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.75rem 0; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.stat .num { font-size: 1.7rem; font-weight: 700; color: var(--accent); }
.stat .lbl { color: var(--muted); font-size: .88rem; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 2.2rem 0 .9rem; }
.section-title h2 { font-size: 1.25rem; margin: 0; }
.section-title a { font-size: .9rem; }

.tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tile {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.tile h3 { margin: 0 0 .3rem; font-size: 1.02rem; color: var(--ink); }
.tile .tile-meta { color: var(--muted); font-size: .85rem; }
.tile .tile-count { float: right; color: var(--accent); font-weight: 700; }

/* ---------- Article cards (Lexikon) ---------- */
.lex-layout { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; align-items: start; }
.filters { position: sticky; top: 72px; }
.filters h4 { margin: 0 0 .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.filters .filter-group { margin-bottom: 1.4rem; }
.filters a {
  display: flex; justify-content: space-between; padding: .32rem .55rem; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: .92rem;
}
.filters a:hover { background: var(--surface-2); text-decoration: none; }
.filters a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.filters a .c { color: var(--muted); font-variant-numeric: tabular-nums; }

.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.artcard {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem 1.25rem; box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.artcard:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.artcard h3 { margin: 0 0 .4rem; font-size: 1.08rem; color: var(--ink); }
.artcard .excerpt { color: var(--muted); font-size: .9rem; margin: 0 0 .8rem; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.artcard .meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.sem-badge { background: var(--surface-2); color: var(--ink-soft); padding: .12rem .5rem; border-radius: 999px; font-weight: 600; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-block; padding: .18rem .6rem; border-radius: 999px; font-size: .78rem;
  background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.chip:hover { text-decoration: none; border-color: var(--accent); }

/* ---------- Article body ---------- */
.article { max-width: var(--read); margin: 0 auto; }
.article-head { margin-bottom: 1.5rem; }
.article-head h1 { font-size: 2rem; margin: .2rem 0 .5rem; }
.article-head .meta { color: var(--muted); font-size: .9rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.article-body { font-size: 1.02rem; }
.article-body h2 { font-size: 1.35rem; margin: 2rem 0 .6rem; padding-top: .4rem; }
.article-body h3 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; color: var(--ink-soft); }
.article-body p { margin: .7rem 0; }
.article-body ul, .article-body ol { margin: .6rem 0; padding-left: 1.3rem; }
.article-body li { margin: .25rem 0; }
.article-body strong { font-weight: 700; }
.article-body em { font-style: italic; }
.article-body code { background: var(--surface-2); padding: .08rem .35rem; border-radius: 5px; font-size: .9em; }

/* Callouts */
.callout { margin: 1.1rem 0; padding: .9rem 1.05rem; border-radius: var(--radius-sm); border-left: 4px solid var(--line-strong); background: var(--surface); font-size: .96rem; }
.callout .callout-icon { display: none; }
.callout-body > p:first-child { margin-top: 0; }
.callout-body > p:last-child { margin-bottom: 0; }
.callout.note-course { background: var(--accent-soft); border-color: var(--accent); }
.callout.note-book   { background: var(--book-soft);   border-color: var(--book); }
.callout.note-course::before,
.callout.note-book::before {
  content: "Vorlesung"; display: inline-block; font-size: .68rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; margin-bottom: .35rem;
  color: var(--accent);
}
.callout.note-book::before { content: "Lehrbuch"; color: var(--book); }

.callout-merke, .callout-wichtig, .callout-achtung {
  border-left-width: 4px; background: var(--surface);
}
.callout-merke   { border-color: var(--merke); }
.callout-wichtig { border-color: var(--wichtig); }
.callout-achtung { border-color: var(--achtung); }
.callout-label {
  font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .1rem .5rem; border-radius: 999px; margin-right: .5rem; color: #fff;
}
.callout-merke   .callout-label { background: var(--merke); }
.callout-wichtig .callout-label { background: var(--wichtig); }
.callout-achtung .callout-label { background: var(--achtung); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1.1rem 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.article-body table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.article-body th, .article-body td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.article-body thead th { background: var(--accent-soft); color: var(--accent); font-weight: 700; position: sticky; top: 0; }
.article-body tbody tr:nth-child(even) { background: var(--surface); }
.block-center { margin: 1rem 0; }

/* Figures */
.art-figure { margin: 1.4rem 0; text-align: center; }
.art-figure img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.art-figure figcaption { color: var(--muted); font-size: .85rem; margin-top: .5rem; }

/* table of contents */
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: 1.5rem; }
.toc h4 { margin: 0 0 .4rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc ul { margin: 0; padding-left: 1.1rem; columns: 2; }
.toc li { font-size: .9rem; margin: .15rem 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }

/* ---------- Self-test / Quiz ---------- */
.quiz-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.quiz-bar .pill { background: var(--surface-2); border-radius: 999px; padding: .3rem .8rem; font-size: .88rem; color: var(--ink-soft); }
.qcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; box-shadow: var(--shadow); max-width: var(--read); margin: 0 auto;
}
.qcard .qsrc { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .5rem; }
.qcard .question { font-size: 1.15rem; font-weight: 600; margin: 0 0 1rem; }
.qcard .answer { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.qcard .answer[hidden] { display: none; }
.qcard .answer ul { padding-left: 1.2rem; }
.q-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.q-rate { display: flex; gap: .5rem; }
.q-rate button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: .45rem .8rem; cursor: pointer; font: inherit; }
.q-rate button:hover { border-color: var(--accent); }

/* MC options */
.mc-option { display: block; width: 100%; text-align: left; padding: .7rem .9rem; margin: .5rem 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.mc-option:hover { border-color: var(--accent); }
.mc-option.correct { border-color: var(--merke); background: color-mix(in srgb, var(--merke) 14%, var(--card)); }
.mc-option.wrong { border-color: var(--achtung); background: color-mix(in srgb, var(--achtung) 12%, var(--card)); }

/* ---------- Login ---------- */
.login-wrap { max-width: 23rem; margin: 4rem auto; }
.login-wrap h1 { margin-bottom: .25rem; }
.login-wrap form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.login-wrap label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
.login-wrap input { padding: .6rem .7rem; font-size: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.login-wrap input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.error { background: color-mix(in srgb, var(--achtung) 12%, var(--card)); color: var(--achtung); padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .9rem; border: 1px solid color-mix(in srgb, var(--achtung) 35%, transparent); }
.notice { background: var(--accent-soft); color: var(--accent-strong); padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .92rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 3rem; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem; color: var(--muted); font-size: .85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .lex-layout { grid-template-columns: 1fr; }
  .filters { position: static; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
  .filters .filter-group { margin-bottom: .5rem; }
}
@media (max-width: 680px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; }
  body.nav-open .mainnav { display: flex; }
  .searchbox { display: none; }
  .brand { margin-right: auto; }
  .hero h1 { font-size: 1.6rem; }
}
