/* chronicler-web — dark/slate-gold, glasmorphism, responsive */

:root {
  --bg: #0b0e14;
  --bg2: #10141d;
  --panel: rgba(255, 251, 240, 0.045);
  --panel-strong: rgba(255, 251, 240, 0.07);
  --line: rgba(212, 175, 106, 0.22);
  --line-soft: rgba(255, 251, 240, 0.1);
  --ink: #ece4cf;
  --ink-dim: #b4a88e;
  --ink-faint: #8a7f66;
  --gold: #d4af6a;
  --gold-bright: #e8c88a;
  --gold-deep: #a5813f;
  --grad-hi: #f3ddab;
  --grad-lo: #9a7a45;
  --crimson: #b03a2e;
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.75);
  --font-display: "Cinzel", "Trajan Pro", serif;
  --font-body: "Spectral", Georgia, serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 62px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Background atmosphere ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(212, 175, 106, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(176, 58, 46, 0.07), transparent 55%),
    radial-gradient(1000px 800px at 50% 115%, rgba(212, 175, 106, 0.07), transparent 60%),
    linear-gradient(180deg, #0b0e14, #0d1120 50%, #0b0e14);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2f3d; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }

/* ---------- Emblem ---------- */
.emblem { display: inline-block; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(11, 14, 20, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  text-decoration: none;
}
.brand .emblem { filter: drop-shadow(0 0 10px rgba(212, 175, 106, 0.45)); }
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 0.98rem;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a,
.nav-search {
  color: var(--ink-dim);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover,
.nav-search:hover { color: var(--gold-bright); background: var(--panel); }
.nav-links a.nav-codex { color: var(--gold); }
.nav-links a.nav-codex:hover { color: var(--gold-bright); }

/* ---------- Hero ---------- */
.hero { padding: 52px 20px 24px; text-align: center; }
.hero-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.hero-inner > .emblem {
  color: var(--gold);
  margin-bottom: 8px;
  filter: drop-shadow(0 0 24px rgba(212, 175, 106, 0.5));
  animation: glow 5s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(212, 175, 106, 0.35)); }
  50% { filter: drop-shadow(0 0 30px rgba(232, 200, 138, 0.65)); }
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5.2vw, 3.0rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.04em;
  margin: 0;
  background: linear-gradient(120deg, var(--grad-hi) 0%, var(--gold) 45%, var(--grad-lo) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--gold);
}
.hero-sub {
  margin: 12px 0 0;
  color: var(--ink-dim);
  font-style: italic;
  font-size: 1.02rem;
  max-width: 56ch;
}
.about-wrap {
  max-width: 620px;
  margin: 8px 0 0;
}
.about-text {
  color: var(--ink-dim);
  font-size: 1.02rem;
  line-height: 1.75;
  margin: 0;
}
.hero-invite {
  margin: 12px 0 0;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--gold);
  font-style: italic;
}

.hero-search {
  position: relative;
  z-index: 20;
  margin-top: 34px;
  width: 100%;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--gold);
}
.hero-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(212, 175, 106, 0.14), var(--shadow); }
.hero-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 6px 2px;
}
.hero-search input::placeholder { color: var(--ink-faint); }

.hero-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #11151f;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
  text-align: left;
}
.hero-dropdown[hidden] { display: none; }

.btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-deep));
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(212, 175, 106, 0.7); }

/* ---------- Stats ---------- */
.stats {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 640px;
}
.stat {
  padding: 18px 10px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat .count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--gold-bright);
}
.stat-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Glass ---------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- Sections ---------- */
.section { max-width: 1180px; margin: 0 auto; padding: 26px 20px 20px; }
.section[hidden], .reveal[hidden] { display: none !important; }
.about-close {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  margin-left: auto;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.about-close:hover { color: var(--gold); border-color: var(--line); }
.sec-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 14px;
}
.sec-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ---------- Category cards ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2), border-color 0.25s, box-shadow 0.25s;
}
.cat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(300px 120px at 80% -20%, rgba(212, 175, 106, 0.16), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.cat-card:hover {
  transform: translateY(-4px);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.cat-card:hover::before { opacity: 1; }
.cat-num {
  font-family: var(--font-display);
  color: var(--gold-deep);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}
.cat-name { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; }
.cat-desc {
  margin: 6px 0 0;
  color: var(--ink-dim);
  font-size: 0.85rem;
  line-height: 1.5;
}
.cat-arrow {
  position: absolute;
  right: 18px;
  bottom: 16px;
  color: var(--gold);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s, transform 0.25s;
}
.cat-card:hover .cat-arrow { opacity: 1; transform: translateX(0); }

/* ---------- Note cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 251, 240, 0.07), rgba(255, 251, 240, 0.03));
  border: 1px solid var(--line-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2), border-color 0.25s, box-shadow 0.25s;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), rgba(212, 175, 106, 0.1));
  opacity: 0.85;
}
.card:hover {
  transform: translateY(-5px);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.more-wrap { display: flex; justify-content: center; padding: 34px 0 10px; }
#more-btn { display: inline-flex; align-items: center; gap: 8px; }
.card-img { height: 150px; overflow: hidden; }
.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.9);
  transition: transform 0.5s, filter 0.4s;
}
.card:hover .card-img img { transform: scale(1.06); filter: saturate(1.1) brightness(1); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.card-title { margin: 0; font-family: var(--font-display); font-size: 1.08rem; font-weight: 600; line-height: 1.3; }
.card-sub { margin: 0; color: var(--ink-dim); font-size: 0.92rem; font-style: italic; line-height: 1.5; }
.card-tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Chips ---------- */
.chip {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--ink-dim);
  border: 1px solid var(--line-soft);
  background: rgba(255, 251, 240, 0.03);
  border-radius: 999px;
  padding: 3px 10px;
  line-height: 1.6;
}
.chip-cat { color: var(--gold); border-color: var(--line); }
.chip-link {
  text-decoration: none;
  color: var(--gold-bright);
  border-color: var(--line);
  transition: background 0.2s, color 0.2s;
}
.chip-link:hover { background: rgba(212, 175, 106, 0.14); color: var(--ink); }

/* ---------- Spotlight ---------- */
.spotlight { max-width: 1180px; margin: 0 auto; padding: 26px 20px 0; }
.spot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }

/* ---------- Category page ---------- */
.cat-page { max-width: 1180px; margin: 0 auto; padding: 30px 20px 40px; }
.cat-head { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 10px 0 30px; }
.cat-head .emblem { color: var(--gold); }
.cat-head h1 { margin: 10px 0 0; font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: 0.05em; }
.cat-head p { margin: 0; color: var(--ink-faint); font-family: var(--font-ui); font-size: 0.9rem; }

/* ---------- Breadcrumbs ---------- */
.disclaimer {
  max-width: 1180px;
  margin: 0 auto 22px;
  padding: 14px 18px;
  border: 1px solid rgba(176, 58, 46, 0.4);
  background: rgba(176, 58, 46, 0.08);
  border-radius: 12px;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.6;
}
.disclaimer strong { color: var(--crimson); }

.source-note {
  margin-top: 30px;
  padding: 14px 18px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 0.88rem;
  line-height: 1.6;
}
.source-note a { color: var(--gold-bright); border-bottom: 1px solid var(--line); text-decoration: none; }

/* ---------- Breadcrumbs ---------- */
.crumbs {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.crumbs a { color: var(--ink-dim); text-decoration: none; transition: color 0.2s; }
.crumbs a:hover { color: var(--gold); }

/* ---------- Note layout ---------- */
.note { max-width: 1180px; margin: 0 auto; padding: 34px 20px 60px; position: relative; }
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
}
#progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  box-shadow: 0 0 12px rgba(212, 175, 106, 0.8);
}
.note-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
.note-aside { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 18px; }
.note-main { min-width: 0; }

.note-head { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 20px; }
.note-head > .emblem { color: var(--gold); margin-top: 6px; flex-shrink: 0; }
.note-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: 0.03em;
}
.note-sub { margin: 10px 0 0; color: var(--ink-dim); font-style: italic; font-size: 1.1rem; }
.note-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }

.note-hero { margin-bottom: 26px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); }
.note-hero img { width: 100%; max-height: 340px; object-fit: cover; display: block; filter: brightness(0.92); }

/* ---------- Article typography ---------- */
.note-body { font-size: 1.06rem; }
.note-body > :first-child { margin-top: 0; }
.note-body h2, .note-body h3, .note-body h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.3;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}
.note-body h2 {
  font-size: 1.5rem;
  margin: 2.1em 0 0.7em;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
}
.note-body h2::before {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 64px; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.note-body h3 { font-size: 1.18rem; margin: 1.6em 0 0.5em; color: var(--gold-bright); }
.note-body h4 { font-size: 1.05rem; margin: 1.4em 0 0.4em; }
.note-body p { margin: 0.8em 0; }
.note-body a.wl, .note-body a {
  color: var(--gold-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(212, 175, 106, 0.35);
  transition: border-color 0.2s, color 0.2s;
}
.note-body a:hover { border-bottom-color: var(--gold); color: var(--ink); }
.wl-missing {
  color: var(--ink-faint);
  border-bottom: 1px dashed var(--line);
  cursor: help;
}
.note-body strong { color: var(--ink); }
.note-body em { color: var(--ink-dim); }
.note-body blockquote {
  margin: 1.2em 0;
  padding: 0.4em 0 0.4em 1.1em;
  border-left: 3px solid var(--gold);
  color: var(--ink-dim);
  font-style: italic;
  background: linear-gradient(90deg, rgba(212, 175, 106, 0.07), transparent);
}
.note-body ul, .note-body ol { padding-left: 1.4em; margin: 0.8em 0; }
.note-body li { margin: 0.35em 0; }
.note-body li::marker { color: var(--gold); }
.note-body hr { border: none; border-top: 1px solid var(--line-soft); margin: 2em 0; }
.note-body img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  margin: 1em 0;
}
.note-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: rgba(255, 251, 240, 0.07);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 0.15em 0.45em;
  color: var(--gold-bright);
}
.note-body pre {
  background: #0a0d13;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
}
.note-body pre code { background: none; border: none; padding: 0; color: var(--ink); }
.note-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.95rem;
}
.note-body th {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}
.note-body td { border-bottom: 1px solid var(--line-soft); padding: 8px 12px; color: var(--ink-dim); }
.note-body tr:hover td { color: var(--ink); }

/* ---------- Info card ---------- */
.info-card { border-radius: var(--radius); padding: 20px 20px 12px; }
.info-title {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.info-hdr {
  margin: 16px 0 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}
.info-hdr:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.info-row { margin: 0; padding: 6px 0; border-bottom: 1px solid rgba(255, 251, 240, 0.05); }
.info-row:last-child { border-bottom: none; }
.info-row dt {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.info-row dd {
  margin: 2px 0 0;
  font-size: 0.95rem;
  color: var(--ink);
}
.info-row dd .chip { margin: 2px 4px 2px 0; display: inline-block; }

/* ---------- TOC ---------- */
.toc { border-radius: var(--radius); padding: 18px 20px; }
.toc h2 {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; }
.toc a {
  display: block;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
.toc a:hover { color: var(--gold-bright); background: var(--panel); }
.toc-h3 a { padding-left: 22px; font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- Related ---------- */
.related { margin-top: 34px; }
.related h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  margin: 0 0 14px;
}
.rel-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.totop {
  display: inline-block;
  margin-top: 40px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}
.totop:hover { color: var(--gold); }

/* ---------- Footer ---------- */
.foot {
  margin-top: 60px;
  border-top: 1px solid var(--line-soft);
  background: rgba(11, 14, 20, 0.5);
  backdrop-filter: blur(8px);
}
.foot-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 20px;
  text-align: center;
}
.foot p { margin: 0; color: var(--ink-dim); font-family: var(--font-display); letter-spacing: 0.05em; font-size: 0.95rem; }
.foot-meta { margin-top: 8px !important; font-family: var(--font-ui) !important; font-size: 0.78rem !important; color: var(--ink-faint) !important; letter-spacing: 0.02em !important; }
.foot-meta a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.foot-meta a:hover { color: var(--gold); border-bottom-color: var(--line); }

/* ---------- Search overlay ---------- */
.search { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 18px 0; }
.search[hidden] { display: none; }
.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 12, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade 0.2s ease;
}
.search-panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #11151f;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: drop 0.25s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(0.98); } }
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  color: var(--gold);
  border-bottom: 1px solid var(--line-soft);
}
.search-input-wrap input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.15rem;
}
.search-input-wrap input::placeholder { color: var(--ink-faint); }
.search-input-wrap kbd {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--ink-faint);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 2px 8px;
}
.search-results { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-empty { padding: 28px; text-align: center; color: var(--ink-faint); font-style: italic; }
.sr {
  display: block;
  text-decoration: none;
  color: var(--ink);
  padding: 12px 14px;
  border-radius: 12px;
  transition: background 0.15s;
}
.sr:hover, .sr.active { background: var(--panel-strong); }
.sr-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.sr-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-family: var(--font-ui); font-size: 0.75rem; color: var(--ink-faint); }
.sr-meta .sr-cat { color: var(--gold); }
.sr-excerpt { font-size: 0.85rem; color: var(--ink-dim); font-style: italic; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr b { color: var(--gold-bright); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .note-layout { grid-template-columns: 1fr; }
  .note-aside { position: static; order: 1; }
  .note-main { order: 0; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .hero { padding-top: 46px; }
  .hero-search { flex-wrap: wrap; border-radius: 18px; }
  .hero-search input { order: 2; flex-basis: 100%; }
  .btn-random { order: 3; width: 100%; }
  .brand-name { font-size: 0.82rem; letter-spacing: 0.08em; }
  .nav-links a:not(.nav-search):not(.nav-codex) { display: none; }
  .nav-links a { padding: 8px 10px; }
  .note-head { flex-direction: column; gap: 12px; }
  .card-grid { grid-template-columns: 1fr; }
  .note-body { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* Mermaid: SVGs von mermaid.run sind position:absolute -> Diagramme überlappen; auf statisch setzen */
.mermaid{text-align:center;margin:20px 0}
.mermaid svg{position:static !important;display:inline-block;max-width:100%;height:auto}
