/* ===== Tokens ===== */
:root{
  --bg: #0a0e17;
  --panel: #0e1420;
  --line: #1c2436;
  --line-bright: #2a3651;
  --text: #e7ebf3;
  --text-dim: #8792a8;
  --text-faint: #545f76;
  --amber: #f2a93b;
  --teal: #35d2a4;
  --red: #e5573f;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --header-bg: rgba(10,14,23,0.86);
  --wrap: 1080px;

  color-scheme: dark;
}

[data-theme="light"]{
  --bg: #f3f1ea;
  --panel: #ffffff;
  --line: #ded9c9;
  --line-bright: #b9b2a0;
  --text: #171a15;
  --text-dim: #55584d;
  --text-faint: #8a8c7f;
  --header-bg: rgba(243,241,234,0.88);
  color-scheme: light;
}

body{ transition: background 0.2s ease, color 0.2s ease; }

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap{
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 28px;
}

a{ color: inherit; }

::selection{ background: var(--amber); color: #12100a; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ animation: none !important; transition: none !important; }
}

/* faint background grid, evokes a schematic sheet */
.grid-overlay{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

/* ===== Header ===== */
.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}
.brand-mark{ width: 30px; height: 30px; object-fit: contain; }

.main-nav{ display: flex; gap: 32px; }
.main-nav a{
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.92rem;
  transition: color 0.15s ease;
}
.main-nav a:hover{ color: var(--text); }

@media (max-width: 640px){
  .main-nav{ gap: 18px; }
  .main-nav a{ font-size: 0.82rem; }
}

/* Theme toggle */
.theme-toggle{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: 24px;
  padding: 0;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover{ color: var(--text); border-color: var(--text-dim); }
.theme-toggle svg{ width: 17px; height: 17px; }
.theme-toggle .icon-sun{ display: none; }
[data-theme="light"] .theme-toggle .icon-moon{ display: none; }
[data-theme="light"] .theme-toggle .icon-sun{ display: block; }

@media (max-width: 640px){
  .theme-toggle{ margin-left: 14px; }
}

/* ===== Hero ===== */
main{ position: relative; z-index: 1; }

.hero{
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
  padding: 88px 28px 96px;
}

.hero-kicker{
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
  margin: 0 0 22px;
  letter-spacing: 0.02em;
}

.hero-text h1{
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.12;
  font-weight: 600;
  margin: 0 0 22px;
  letter-spacing: -0.01em;
}

.hero-lead{
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 0 34px;
}

.hero-actions{ display: flex; gap: 14px; flex-wrap: wrap; }

.btn{
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border: 1px solid var(--line-bright);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-primary{
  background: var(--amber);
  border-color: var(--amber);
  color: #12100a;
}
.btn-primary:hover{ background: #f7bb5c; border-color: #f7bb5c; }
.btn-ghost:hover{ border-color: var(--text-dim); }

/* Kleine Topologie-Vorschau rechts */
.hero-diagram {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 480px;
  justify-self: end;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.coming-soon-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* Vergrößerungspfeil */
.zoom-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
  z-index: 2;
  transition: 0.2s ease;
}

.zoom-button:hover {
  background: var(--amber);
  color: #12100a;
  transform: scale(1.08);
}

/* Popup-Hintergrund */
.topology-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 40px;
  background: rgba(20, 20, 20, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Popup öffnen */
.topology-modal.active {
  display: flex;
}

/* Großes Bild */
.topology-large {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 15px 60px rgba(0, 0, 0, 0.45);
  animation: topology-zoom 0.3s ease;
}

/* Schließen-Kreuz */
.close-topology {
  position: absolute;
  top: 25px;
  right: 35px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 34px;
  cursor: pointer;
  transition: 0.2s ease;
}

.close-topology:hover {
  background: var(--amber);
  color: #12100a;
}

@keyframes topology-zoom {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Smartphone */
@media (max-width: 860px) {
  .hero-diagram {
    max-width: 100%;
    justify-self: center;
  }

  .topology-modal {
    padding: 15px;
  }

  .topology-large {
    max-width: 95vw;
    max-height: 80vh;
  }

  .close-topology {
    top: 12px;
    right: 15px;
  }
}

.node text{ font-family: var(--font-mono); fill: currentColor; }
.node-label{ font-size: 9px; fill: var(--text-faint); letter-spacing: 0.04em; }
.node-label.small{ font-size: 8px; }
.node-glyph{ font-size: 10px; font-weight: 600; fill: var(--text); }
.node-core{ color: var(--text); }
.node-core .node-glyph{ fill: var(--bg); }
.node-core rect{ fill: var(--text); }
.node-accent{ color: var(--amber); }
.node-accent-2{ color: var(--teal); }
.node-dim{ color: var(--line-bright); }
.node-dim .node-label{ fill: var(--text-faint); }

/* ===== Sections ===== */
.section{ padding: 76px 28px; border-top: 1px solid var(--line); }

.section-head{
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}
.section-index{
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 0.85rem;
}
.section-head h2{
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0;
}
.section-intro{
  color: var(--text-dim);
  max-width: 62ch;
  margin: -8px 0 36px;
}

.prose-grid{ display: grid; gap: 20px; max-width: 74ch; }
.prose-grid p{ color: var(--text-dim); margin: 0; }
.prose-grid p::first-line{ color: var(--text); }

.goal-group-title{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
  margin: 0 0 14px;
}
.goal-list + .goal-group-title{ margin-top: 48px; }

/* ===== Goals (details/summary) ===== */
.goal-list{ display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }

.goal{ background: var(--bg); }

.goal summary{
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 44px 1fr auto 20px;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
}
.goal summary::-webkit-details-marker{ display: none; }

.goal-code{
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--amber);
}
.goal-title{
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 500;
}
.goal-status{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  border: 1px solid var(--line-bright);
  padding: 4px 9px;
  white-space: nowrap;
}
.goal-chevron{
  width: 12px; height: 8px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}
.goal[open] .goal-chevron{ transform: rotate(180deg); }

.goal-body{
  padding: 0 24px 28px 86px;
  color: var(--text-dim);
  max-width: 68ch;
}
.goal-body p{ margin: 0 0 16px; }
.goal-body ul{ margin: 0; padding: 0; list-style: none; }
.goal-body li{
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  font-size: 0.94rem;
}
.goal-body li::before{
  content: "";
  position: absolute;
  left: 0; top: 9px;
  width: 6px; height: 1px;
  background: var(--amber);
}

@media (max-width: 640px){
  .goal summary{ grid-template-columns: 34px 1fr 20px; }
  .goal-status{ display: none; }
  .goal-body{ padding-left: 24px; }
}

/* Non-goals */
.non-goals{ margin-top: 48px; }
.non-goals h3{
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dim);
  margin: 0 0 16px;
}
.non-goals ul{ list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.non-goals li{ color: var(--text-faint); font-size: 0.9rem; }
.ng-code{
  font-family: var(--font-mono);
  color: var(--text-dim);
  margin-right: 10px;
}

/* ===== Tech grid ===== */
.tech-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tech-item{
  background: var(--bg);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tech-label{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}
.tech-value{
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text);
}

@media (max-width: 800px){ .tech-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px){ .tech-grid{ grid-template-columns: 1fr; } }

/* ===== Team ===== */
.team-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 1px;
}
.team-card{
  background: var(--bg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.team-role{
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber);
}
.team-name{
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 500;
}
.team-meta{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}
.team-meta a{ text-decoration: none; color: var(--text-dim); }
.team-meta a:hover{ color: var(--amber); }

.betreuer{
  border: 1px solid var(--line);
  border-top: none;
  padding: 20px 20px;
  display: flex;
  gap: 14px;
  align-items: baseline;
  flex-wrap: wrap;
}

@media (max-width: 800px){ .team-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px){ .team-grid{ grid-template-columns: 1fr; } }

/* ===== Footer ===== */
.site-footer{ border-top: 1px solid var(--line); padding: 40px 28px; }
.footer-inner{
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-title{
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 4px;
}
.footer-sub{ color: var(--text-faint); font-size: 0.88rem; margin: 0; max-width: 34ch; }
.footer-school{ color: var(--text-faint); font-size: 0.88rem; text-align: right; }
.footer-school p{ margin: 0 0 2px; }

@media (max-width: 640px){
  .footer-inner{ flex-direction: column; }
  .footer-school{ text-align: left; }
}

.footer-impressum{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.footer-logo{
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.footer-legal{
  margin: 0;
  color: var(--text-faint);
  font-size: 0.82rem;
}

@media (max-width: 480px){
  .footer-impressum{ flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ===== Responsive hero ===== */
@media (max-width: 860px){
  .hero{ grid-template-columns: 1fr; padding-top: 56px; }
  .hero-diagram{ order: -1; }
}

/* Focus visibility */
a:focus-visible, .goal summary:focus-visible, .theme-toggle:focus-visible{
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
