/* SEWA — Sonnenenergie für Westafrika e.V. — static site styles */

:root {
  --gold: #dda52b;
  --gold-dark: #b3811a;
  --gold-light: #f3d891;
  --brown: #5c4130;
  --brown-dark: #3b2a1e;
  --terracotta: #c1592b;
  --terracotta-dark: #a0451e;
  --cream: #fbf6ec;
  --cream-alt: #f3e9d6;
  --white: #ffffff;
  --text: #2b2118;
  --text-muted: #7a6a58;
  --border: #e8dcc4;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(60, 40, 20, 0.09);
  --shadow-lg: 0 12px 40px rgba(60, 40, 20, 0.16);
  --max-width: 1180px;
  --font-body: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--terracotta); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--brown-dark);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.1em; }
ul.plain { list-style: none; margin: 0; padding: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--brown-dark);
  color: #fff; padding: 10px 16px; z-index: 200; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  max-width: var(--max-width); margin: 0 auto;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; color: var(--brown-dark); }
.brand img { height: 46px; width: auto; }
.brand-text { line-height: 1.1; }
.brand-text .sub { display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; color: var(--text-muted); text-transform: uppercase; }
.brand:hover { text-decoration: none; }

nav.main-nav { display: flex; align-items: center; gap: 4px; }
nav.main-nav a {
  color: var(--brown-dark); font-weight: 700; font-size: 0.92rem;
  padding: 10px 14px; border-radius: 999px; text-decoration: none;
  letter-spacing: 0.01em;
}
nav.main-nav a:hover, nav.main-nav a.active,
/* current section: set per page via <body data-section> (see partials/header.html) */
body[data-section="verein"] nav.main-nav a[data-nav="verein"],
body[data-section="projekte"] nav.main-nav a[data-nav="projekte"],
body[data-section="neuigkeiten"] nav.main-nav a[data-nav="neuigkeiten"],
body[data-section="fotos"] nav.main-nav a[data-nav="fotos"],
body[data-section="kontakt"] nav.main-nav a[data-nav="kontakt"],
body[data-section="mitmachen"] nav.main-nav a[data-nav="mitmachen"] { background: var(--cream-alt); text-decoration: none; }
.btn-donate {
  background: var(--terracotta) !important; color: #fff !important;
  padding: 10px 20px !important; border-radius: 999px;
  box-shadow: var(--shadow);
}
.btn-donate:hover { background: var(--terracotta-dark) !important; }

.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; color: var(--brown-dark);
}
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 880px) {
  nav.main-nav {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 84vw); height: 100vh;
    background: var(--white); flex-direction: column; align-items: stretch;
    padding: 90px 20px 20px; gap: 2px; box-shadow: var(--shadow-lg);
    transform: translateX(100%); transition: transform 0.25s ease;
    overflow-y: auto;
  }
  nav.main-nav.open { transform: translateX(0); }
  nav.main-nav a { padding: 14px 16px; font-size: 1.05rem; }
  .nav-toggle { display: block; }
  .nav-scrim {
    display: none; position: fixed; inset: 0; background: rgba(20,14,8,0.4); z-index: 90;
  }
  .nav-scrim.open { display: block; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px;
  font-weight: 700; font-size: 0.95rem; text-decoration: none; border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--terracotta); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--terracotta-dark); color: #fff; }
.btn-secondary { background: transparent; border-color: var(--brown-dark); color: var(--brown-dark); }
.btn-secondary:hover { background: var(--brown-dark); color: #fff; }

/* ---------- Hero ---------- */
/* Layering: hero-bg photo (z -2) < gradient scrim ::before (z -1) < text (normal flow).
   Previously the scrim was painted as .hero's own background, which a stacking-context
   root always paints *below* its negative-z-index children -- so the photo silently
   covered it and the heading/lead sat on raw, undarkened photo. Text-shadow is a second,
   independent line of defense so legibility doesn't rely on the gradient alone. */
.hero {
  position: relative; z-index: 0; color: #fff; overflow: hidden;
  background: var(--brown-dark);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(195deg, rgba(20,12,6,0.25) 0%, rgba(20,12,6,0.55) 55%, rgba(20,12,6,0.8) 100%);
}
.hero img.hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2;
  filter: saturate(0.85);
}
.hero-inner { padding: 88px 24px 76px; max-width: var(--max-width); margin: 0 auto; }
.hero h1 { color: #fff; max-width: 720px; text-shadow: 0 2px 16px rgba(0,0,0,0.45); }
.hero p.lead { max-width: 620px; font-size: 1.15rem; color: #f8f1e2; text-shadow: 0 1px 10px rgba(0,0,0,0.4); }
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }
.eyebrow {
  display: inline-block; text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.78rem; font-weight: 800; color: var(--gold-light, var(--gold));
  background: rgba(255,255,255,0.12); padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}

/* small hero used on inner pages */
.page-hero { background: var(--brown-dark); color: #fff; padding: 56px 24px 46px; }
.page-hero .wrap { max-width: var(--max-width); }
.page-hero h1 { color: #fff; margin-bottom: 6px; }
.page-hero p { color: #e8d9bf; max-width: 680px; margin: 0; }
.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.breadcrumbs a { color: var(--text-muted); }

/* ---------- Night hero (homepage: rendered frames, scrubbed by scroll) ---------- */
/* The section is taller than the viewport; .night-hero-stage sticks below the
   header while the section scrolls past, and main.js maps that scroll run to
   --p (0 to 1). Frame 1 (no --t) is always opaque; every later frame and every
   .ns-fade element fades in at its own --t over 0.15 of --p, so scrolling back
   up runs the sequence in reverse. --scroll is how much page scroll the
   sequence takes. */
.night-hero { --scroll: 140vh; height: calc(100vh + var(--scroll)); overflow: visible; background: #0c0804; }
.night-hero::before { content: none; }
.night-hero-stage {
  position: sticky; top: var(--header-h, 71px); z-index: 0; overflow: hidden;
  height: calc(100vh - var(--header-h, 71px));
}
.night-hero-stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(195deg, rgba(12,8,4,0.15) 0%, rgba(12,8,4,0.35) 55%, rgba(12,8,4,0.7) 100%);
}
.night-hero .night-scene-frames { position: absolute; inset: 0; z-index: -2; }
.ns-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ns-frame[style*="--t"], .ns-fade {
  opacity: clamp(0, calc((var(--p, 0) - var(--t, 0)) / 0.15), 1);
  transition: opacity 0.2s ease-out;
}
/* Buttons sit centred on the ground below the middle door. The frames are
   object-fit: cover and centred, so the door is at 50% across; with the image
   filling the stage height (any viewport narrower than 2.7:1) the ground below
   the doors starts at ~82% down. Phones keep the buttons in the text flow. */
@media (min-width: 760px) {
  .night-hero .actions {
    position: absolute; left: 50%; top: 83%; transform: translateX(-50%);
    margin-top: 0; justify-content: center; flex-wrap: nowrap;
  }
}
/* keyboard focus on a not-yet-visible button still shows it */
.ns-fade:focus-within { opacity: 1; }

/* Dark band under the hero, kept from the former standalone night scene. */
.night-scene { position: relative; background: #0c0804; overflow: hidden; }

/* In normal flow below the frames, not overlaid on them -- overlaying put
   the text on top of the building's windows with nowhere clean to sit. */
.night-scene-caption { background: #0c0804; color: #fff; text-align: center; padding: 36px 24px 44px; }
.night-scene-caption h2 { color: #fff; margin-bottom: 10px; }
.night-scene-caption p { max-width: 54ch; margin: 0 auto 20px; color: #e7dcc8; font-size: 0.98rem; }
.night-scene-caption .btn-secondary { border-color: #fff; color: #fff; }
.night-scene-caption .btn-secondary:hover { background: #fff; color: var(--brown-dark); }

@media (prefers-reduced-motion: reduce) {
  .ns-frame[style*="--t"], .ns-fade { transition: none; }
  /* main.js sets --p: 1 once (no scroll listener) when this is set, so the
     clamp() above already resolves every frame to fully lit -- nothing
     more to do here. */
}

/* ---------- Sections ---------- */
section.section { padding: 64px 0; }
section.section.alt { background: var(--cream-alt); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 32px; flex-wrap: wrap; }
.section-head p { color: var(--text-muted); margin: 6px 0 0; max-width: 60ch; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 26px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  border: 1px solid var(--border);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .thumb { aspect-ratio: 4/3; background: var(--cream-alt); position: relative; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
/* cards without a photo (58 of them on the projects page alone) get a branded
   placeholder instead of a near-invisible 50px logo on a flat background */
.card .thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,0.65), transparent 60%),
    linear-gradient(145deg, var(--gold-light), var(--gold) 70%);
}
.card .thumb.placeholder img { width: 30%; height: auto; opacity: 0.88; filter: drop-shadow(0 2px 6px rgba(60,40,10,0.25)); }
.card .body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .body h3 { margin: 0; font-size: 1.08rem; }
.card .body h3 a { color: var(--brown-dark); text-decoration: none; }
.card .body p { color: var(--text-muted); font-size: 0.95rem; margin: 0; flex: 1; }
.card .tag {
  display: inline-block; font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gold-dark); background: rgba(221,165,43,0.15);
  padding: 4px 10px; border-radius: 999px; align-self: flex-start;
}
.card .readmore { font-size: 0.88rem; font-weight: 700; margin-top: 4px; }

/* ---------- Article / page content ---------- */
.content-layout {
  display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 48px;
  padding: 48px 0 80px;
}
@media (max-width: 880px) { .content-layout { grid-template-columns: 1fr; } }
.prose { max-width: 72ch; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.2em; }
.prose img { border-radius: var(--radius); margin: 8px 0 20px; box-shadow: var(--shadow); }
/* legacy align="left|right" images from the old site: keep text off them */
.prose img[align="right"] { float: right; margin: 6px 0 16px 1em; }
.prose img[align="left"]  { float: left;  margin: 6px 1em 16px 0; }
@media (max-width: 600px) {
  .prose img[align] { float: none; margin: 8px 0 20px; }
}
.prose h2, .prose h3 { margin-top: 1.6em; }
.prose ul { padding-left: 1.3em; }
.prose blockquote {
  margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--gold);
  color: var(--text-muted); font-style: italic;
}
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.prose table td, .prose table th { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }

.sidebar .box {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow);
}
.sidebar .box h3 { margin: 0 0 12px; font-size: 1.02rem; }
.sidebar .box p { font-size: 0.92rem; color: var(--text-muted); }
.sidebar .box.donate { background: linear-gradient(160deg, var(--gold), var(--gold-dark)); border: none; color: #3b2a1e; }
.sidebar .box.donate h3, .sidebar .box.donate p { color: #3b2a1e; }
.sidebar .box.donate .btn-primary { background: var(--brown-dark); }
.sidebar .box.donate .btn-primary:hover { background: #221708; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 18px; }
.meta-row strong { color: var(--text); }

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-grid a { display: block; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; background: var(--cream-alt); box-shadow: var(--shadow); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.gallery-grid a:hover img { transform: scale(1.06); }

/* Attachments list */
.attachments { list-style: none; padding: 0; margin: 0 0 1.5em; }
.attachments li { margin-bottom: 8px; }
.attachments a {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--cream-alt); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem;
}
.attachments a:hover { background: var(--border); text-decoration: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; background: rgba(15,10,5,0.92); z-index: 300;
  display: none; align-items: center; justify-content: center; padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox .lb-close, .lightbox .lb-prev, .lightbox .lb-next {
  position: absolute; background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 48px; height: 48px; border-radius: 999px; cursor: pointer; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center;
}
.lightbox .lb-close:hover, .lightbox .lb-prev:hover, .lightbox .lb-next:hover { background: rgba(255,255,255,0.25); }
.lightbox .lb-close { top: 20px; right: 20px; }
.lightbox .lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* ---------- Team ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 24px; }
.team-card { text-align: center; }
.team-card .photo { width: 130px; height: 130px; border-radius: 50%; overflow: hidden; margin: 0 auto 14px; background: var(--cream-alt); box-shadow: var(--shadow); }
.team-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.team-card .photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 800; color: var(--gold-dark); }
.team-card h3 { font-size: 1rem; margin: 0 0 2px; }
.team-card .role { color: var(--text-muted); font-size: 0.85rem; }

/* ---------- Category tabs (projects) ---------- */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.tabs a {
  padding: 9px 18px; border-radius: 999px; border: 2px solid var(--border);
  font-weight: 700; font-size: 0.9rem; color: var(--brown-dark);
}
.tabs a.active { background: var(--brown-dark); border-color: var(--brown-dark); color: #fff; }
.tabs a:hover { text-decoration: none; border-color: var(--gold); }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(var(--stat-count, 4), 1fr); gap: 24px; text-align: center; max-width: 760px; margin: 0 auto; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stats .stat strong { display: block; font-size: 2.1rem; color: var(--gold-dark); font-weight: 800; }
.stats .stat span { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Footer ---------- */
footer.site-footer { background: var(--brown-dark); color: #e8d9bf; padding: 56px 0 28px; margin-top: 40px; }
footer.site-footer a { color: #f3e6cc; }
footer.site-footer .grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 780px) { footer.site-footer .grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { footer.site-footer .grid { grid-template-columns: 1fr; } }
footer.site-footer h4 { color: #fff; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; }
footer.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
footer.site-footer .brand-foot { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
footer.site-footer .brand-foot img { height: 40px; }
footer.site-footer p.blurb { color: #cbb897; font-size: 0.92rem; max-width: 42ch; }
.footer-bottom {
  max-width: var(--max-width); margin: 40px auto 0; padding: 20px 24px 0; border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 0.82rem; color: #b3a082;
}
.footer-bottom a { color: #b3a082; }

/* ---------- Misc ---------- */
.empty-note { color: var(--text-muted); font-style: italic; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Scroll-in reveal (applied by assets/main.js) ----------
   One consistent, orchestrated effect (plain IntersectionObserver), not
   scattered micro-interactions. This rule's transition intentionally also
   covers .card's hover properties (transform, box-shadow): it comes after
   .card's own rule in the cascade, so on elements that are both .card and
   .reveal, this is the one that wins -- list every property either needs. */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.18s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
