@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400&display=swap');

:root {
  --wald-bg: #1c1a14;
  --wald-bg-dark: #141208;
  --wald-gruen: #a8c472;
  --wald-gruen-muted: #5a7a3a;
  --wald-text: #d4c9a8;
  --wald-text-weich: #b8aa88;
  --wald-text-muted: #9a9070;
  --wald-text-sehr-muted: #6a6048;
  --wald-text-extramuted: #4a4530;
  --wald-linie: #2e2a1e;
  --wald-linie-alt: #3a3520;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; }
body {
  font-family: 'Source Sans 3', sans-serif;
  font-weight: 300;
  background: var(--wald-bg);
  color: var(--wald-text);
  line-height: 1.75;
  min-height: 100vh;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 { line-height: 1.15; }
p { margin-bottom: 1.25rem; max-width: 65ch; }
a { color: var(--wald-gruen); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.75; }

.wald-wrap { max-width: 800px; margin: 0 auto; padding: 0 2rem; }

.wald-hero {
  position: relative;
  height: 380px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.wald-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #2a3d1e 0%, #1a2810 30%, #0d1a08 70%, #1c1a14 100%);
  filter: contrast(1.1) brightness(0.7);
}

.wald-hero-bg.has-photo {
  background-size: cover;
  background-position: center;
  filter: brightness(0.5) saturate(0.7);
}

.wald-hero-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.wald-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(28,26,20,0.95) 0%, rgba(28,26,20,0.4) 50%, transparent 100%);
}

.wald-hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
}

.wald-eyebrow { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--wald-gruen); margin-bottom: 0.75rem; opacity: 0.8; }
.wald-eyebrow a { color: var(--wald-gruen); text-decoration: none; }

.wald-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 4.2rem;
  font-weight: 700;
  line-height: 0.95;
  color: #e8dcc0;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  text-shadow: 2px 3px 12px rgba(0,0,0,0.6);
}

.wald-title em { font-style: italic; color: var(--wald-gruen); font-weight: 400; }
.wald-subtitle { font-size: 0.88rem; color: var(--wald-text-muted); font-weight: 300; max-width: 45ch; line-height: 1.5; }

.wald-nav {
  display: flex;
  background: var(--wald-bg-dark);
  border-bottom: 1px solid var(--wald-linie);
  padding: 0 2rem;
  flex-wrap: wrap;
  max-width: 800px;
  margin: 0 auto;
}

.wald-nav a {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wald-text-extramuted);
  padding: 0.9rem 1rem 0.9rem 0;
  margin-right: 1.5rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.wald-nav a:hover, .wald-nav a.aktiv { color: var(--wald-gruen); border-bottom-color: var(--wald-gruen); opacity: 1; }

.wald-content { max-width: 800px; margin: 0 auto; padding: 2.5rem 2rem; }

.wald-section { margin-bottom: 3.5rem; }

.wald-section-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.wald-section-label { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 1.1rem; color: var(--wald-gruen); white-space: nowrap; }
.wald-section-rule { flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--wald-linie-alt) 0px, var(--wald-linie-alt) 4px, transparent 4px, transparent 8px); }

.wald-fragmente-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; list-style: none; padding: 0; }

.wald-fragment {
  background: var(--wald-bg-dark);
  border-left: 3px solid var(--wald-gruen-muted);
  padding: 1.1rem 1.25rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--wald-text-weich);
  position: relative;
}

.wald-fragment::before {
  content: '"';
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 3rem;
  color: var(--wald-linie-alt);
  position: absolute;
  top: -0.5rem;
  right: 0.75rem;
  line-height: 1;
}

.wald-fragment p { margin: 0; max-width: none; }
.wald-fragment a { color: var(--wald-gruen); text-decoration: underline; }
.wald-fragment-datum { display: block; font-size: 10px; color: var(--wald-text-extramuted); margin-top: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }

.wald-texte-liste { list-style: none; padding: 0; }
.wald-text-item { display: flex; gap: 1.5rem; padding: 1rem 0; border-bottom: 1px dashed var(--wald-linie); }
.wald-text-item:last-child { border-bottom: none; }
.wald-text-datum { font-size: 10px; color: var(--wald-text-extramuted); min-width: 2.5rem; text-align: right; padding-top: 0.2rem; }
.wald-text-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1rem; color: var(--wald-text); }
.wald-text-title a { color: var(--wald-text); text-decoration: none; }
.wald-text-title a:hover { color: var(--wald-gruen); opacity: 1; }
.wald-text-excerpt { font-size: 0.82rem; color: var(--wald-text-sehr-muted); margin-top: 0.2rem; line-height: 1.5; }

.wald-links-liste { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.wald-link-item { display: flex; flex-direction: column; gap: 0.2rem; }
.wald-link-item a { color: var(--wald-gruen); font-size: 1rem; }
.wald-link-beschreibung { font-size: 0.82rem; color: var(--wald-text-sehr-muted); margin: 0; }

.wald-foto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.wald-foto-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; filter: saturate(0.6) brightness(0.85); transition: filter 0.3s; }
.wald-foto-grid img:hover { filter: saturate(0.9) brightness(1); }

.wald-artikel { padding: 2rem 0 4rem; }
.wald-artikel-titel { font-family: 'Playfair Display', Georgia, serif; font-size: 3rem; font-weight: 700; color: #e8dcc0; margin-bottom: 0.5rem; line-height: 1.1; }
.wald-artikel-titel em { font-style: italic; color: var(--wald-gruen); font-weight: 400; }
.wald-artikel-meta { font-size: 10px; color: var(--wald-text-extramuted); margin-bottom: 3rem; letter-spacing: 0.08em; text-transform: uppercase; }
.wald-artikel-body { font-size: 1rem; line-height: 1.85; color: var(--wald-text-weich); }
.wald-artikel-body p { margin-bottom: 1.5rem; }
.wald-artikel-body h2 { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 1.6rem; margin: 2.5rem 0 1rem; color: var(--wald-gruen); font-weight: 400; }
.wald-artikel-body a { color: var(--wald-gruen); text-decoration: underline; }

/* ─── Wiki: Wachstum, Marginalien, Backlinks, Wikilinks ────── */

.wiki-meta { font-size: 0.78rem; color: var(--wald-text-extramuted); display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 1.5rem; letter-spacing: 0.05em; text-transform: uppercase; }

.wiki-grid h2 { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 1.6rem; margin: 2.5rem 0 1rem; color: var(--wald-gruen); font-weight: 400; }

aside.marginal-note {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--wald-text-muted);
  margin: 0.5rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--wald-gruen-muted);
  background: var(--wald-bg-dark);
}
aside.marginal-note strong { color: var(--wald-text); font-weight: 500; }
aside.marginal-note a { color: var(--wald-gruen); }

.backlinks { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px dashed var(--wald-linie); font-size: 0.85rem; }
.backlinks p { margin-bottom: 0.75rem; color: var(--wald-text-extramuted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.7rem; }
.backlinks ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; max-width: none; }

a.wikilink-broken, span.wikilink-broken { color: var(--wald-text-sehr-muted); text-decoration: underline dotted; cursor: help; }

.wald-footer { background: var(--wald-bg-dark); border-top: 1px solid var(--wald-linie); padding: 1rem 2rem; display: flex; justify-content: space-between; font-size: 11px; color: var(--wald-text-extramuted); letter-spacing: 0.05em; }
.wald-footer a { color: var(--wald-gruen); }

@media (max-width: 640px) {
  .wald-title { font-size: 3rem; }
  .wald-fragmente-grid { grid-template-columns: 1fr; }
  .wald-foto-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── View Transitions ─────────────────────────────────────── */

@view-transition {
  navigation: auto;
}

.wald-hero {
  view-transition-name: wald-hero;
}

/* ─── Generative Baumkronen-Silhouette ─────────────────────── */

.wald-hero-bg:not(.has-photo) {
  background:
    radial-gradient(ellipse 60% 45% at 15% 110%, rgba(90, 122, 58, 0.55), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 115%, rgba(74, 100, 48, 0.5), transparent 70%),
    radial-gradient(ellipse 55% 50% at 85% 110%, rgba(58, 82, 38, 0.55), transparent 70%),
    linear-gradient(180deg, #2a3d1e 0%, #1a2810 30%, #0d1a08 70%, #1c1a14 100%);
  background-size: 140% 140%, 140% 140%, 140% 140%, 100% 100%;
  background-position: 0% 0%, 0% 0%, 0% 0%, 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .wald-hero-bg:not(.has-photo) {
    animation: wald-canopy-drift 60s ease-in-out infinite alternate;
  }
}

@keyframes wald-canopy-drift {
  0%   { background-position: 0% 0%, 100% 0%, 0% 100%, 0 0; }
  50%  { background-position: 30% 20%, 60% 30%, 30% 70%, 0 0; }
  100% { background-position: 10% 30%, 90% 10%, 60% 90%, 0 0; }
}

/* ─── Scroll-driven Reveal ──────────────────────────────────── */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .wald-fragment, .wald-text-item, .wald-section {
      animation: wald-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}

@keyframes wald-reveal {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
