/* =============================================================================
   Claudio Bonaglia – Projekt Portfolio
   Heller, sachlicher Stil in Anlehnung an den Lebenslauf (Dunkelblau, Source Sans)
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --text: #1c2430;
  --text-soft: #4a5565;
  --text-muted: #6f7a89;
  --accent: #1f4e79;
  --accent-dark: #163a5b;
  --border: #d6dce4;
  --maxw: 880px;
}

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

html { scroll-behavior: smooth; height: 100%; }

body {
  font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ---------- Navigation ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.topbar .nav-name { display: none; font-weight: 700; }
.topbar:not(.morph).scrolled .nav-home { display: none; }
.topbar:not(.morph).scrolled .nav-name { display: inline; }

/* Startseite: Titel fliegt beim Scrollen in die Leiste */
.topbar.morph nav a:first-child { position: relative; display: inline-block; white-space: nowrap; }
.topbar.morph .nav-home { display: inline-block; }
.topbar.morph .nav-name { display: inline-block; position: absolute; left: 0; top: 0; visibility: hidden; white-space: nowrap; font-weight: 800; letter-spacing: -0.01em; }
.name-fly {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 101;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.2;
  transform-origin: 0 0;
  will-change: transform;
}

section[id] { scroll-margin-top: 4rem; }

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.topbar nav { display: flex; gap: 0.6rem 1.6rem; flex-wrap: wrap; font-size: 0.95rem; font-weight: 500; }
.topbar nav a { color: var(--text-soft); }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }
.topbar nav a.active { color: var(--accent); }
.topbar nav { position: relative; }
.nav-indicator {
  position: absolute;
  height: 2px;
  background: var(--accent);
  left: 0;
  width: 0;
  opacity: 0;
  transition: left 0.3s ease, width 0.3s ease, top 0.3s ease, opacity 0.2s ease;
  pointer-events: none;
}


.reveal-mail {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.reveal-mail:hover { text-decoration: none; }

/* ---------- Header / Titelbereich ---------- */

.header {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  width: 100%;
}

.header .label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
  letter-spacing: -0.01em;
  margin: 0.2rem 0 0.6rem;
}

.header .degree {
  font-size: 1.2rem;
  color: var(--text-soft);
  font-weight: 400;
  line-height: 1.4;
}

.header .contact-line {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.header .meta, .header p.meta {
  margin-top: 0.4rem;
  font-size: 1rem;
  color: var(--text-muted);
  font-family: inherit;
}

.header.small { padding-top: 2.5rem; }
.header.small h1 { font-size: 2.3rem; }

.crumb { font-size: 0.9rem; margin-bottom: 1.2rem; display: inline-block; }

/* ---------- Inhalt ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

main.post { padding-top: 0.5rem; }

.intro {
  margin: 1rem 0 0.5rem;
  max-width: 680px;
  color: var(--text-soft);
  font-size: 1.1rem;
}

h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 2.8rem 0 1.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--accent);
}

main.post h2 { margin-top: 2.4rem; }

h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }

p { color: var(--text); margin-bottom: 0.9rem; }

ul { padding-left: 1.3rem; margin-bottom: 1rem; }
li { margin-bottom: 0.35rem; color: var(--text); }
li::marker { color: var(--accent); }

strong { font-weight: 600; }

/* ---------- Projekt-Eintraege (Startseite) ---------- */

.entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: 0; }

.entry-side {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding-top: 0.15rem;
}

.entry-side .tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.entry h3 { font-size: 1.2rem; line-height: 1.3; }
.entry h3 a { color: var(--text); }
.entry h3 a:hover { color: var(--accent); text-decoration: none; }

.entry .sub { color: var(--text-muted); font-size: 0.98rem; margin-bottom: 0.5rem; }

.entry ul { margin: 0.4rem 0 0.6rem; }
.entry li { font-size: 0.98rem; }

.entry .more { font-size: 0.95rem; font-weight: 600; }

.grade {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0 0.45rem;
  margin-left: 0.5rem;
  vertical-align: 2px;
  white-space: nowrap;
}

/* ---------- Faktenbox (Projektseiten) ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem 1.5rem;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  padding: 1.1rem 1.4rem;
  margin: 1.2rem 0 0.5rem;
}
.facts dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.facts dd { font-weight: 500; }

/* ---------- Bilder ---------- */

.project-image { margin: 2rem 0; text-align: center; }
.project-image img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}
.project-image figcaption {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---------- Live Counter (PV) ---------- */

.live-counter {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 1.8rem 1.5rem;
  margin: 1.5rem 0 2rem;
  text-align: center;
}
.live-counter-dot {
  position: absolute;
  top: 1rem; right: 1rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #2e9e5b;
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,158,91,0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(46,158,91,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,158,91,0); }
}
.live-counter-value { font-size: 2.6rem; font-weight: 800; color: var(--accent); }
.live-counter-label { color: var(--text-soft); }
.live-counter-updated { margin-top: 0.6rem; font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Statistik / Karten ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card { border: 1px solid var(--border); padding: 1.2rem 1.4rem; }
.card h3 { margin-bottom: 0.3rem; }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: auto;
}
footer .footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
footer a { color: var(--text-soft); }
footer .links { display: flex; gap: 1.2rem; flex-wrap: wrap; }

.back { margin-top: 3rem; font-size: 0.95rem; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header { padding-top: 2.2rem; }
  .header h1 { font-size: 2.2rem; }
  .header.small h1 { font-size: 1.8rem; }
  .entry { grid-template-columns: 1fr; gap: 0.2rem; }
  .entry-side { padding-top: 0; }
}

@media print {
  .topbar, .name-fly, footer { display: none; }
  .entry { break-inside: avoid; }
}

/* Hochformat-Bilder begrenzen */
.project-image img.portrait { max-height: 560px; width: auto; }

/* Bilder mit geringer Aufloesung kleiner darstellen */
.project-image img.small { max-width: 520px; width: 100%; }
