:root {
  color-scheme: dark;
  --void: #05070c;
  --ink: #e8eef7;
  --ink-soft: #9aa8bc;
  --line: rgba(120, 180, 255, 0.22);
  --accent: #3ecfbf;
  --accent-soft: rgba(62, 207, 191, 0.18);
  --panel: rgba(8, 12, 20, 0.92);
  --font-display: "Syne", "Avenir Next", sans-serif;
  --font-body: "DM Sans", "Avenir Next", sans-serif;
  --map-w: 1536;
  --map-h: 1024;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 30;
  padding: 0.55rem 0.85rem;
  background: var(--ink);
  color: var(--void);
  text-decoration: none;
  font-weight: 500;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

/* --- Full map visible (contain), centered --- */

.map-stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #02040a;
}

.map-scroll {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.map-zoom {
  width: min(100%, calc(100dvh * var(--map-w) / var(--map-h)));
  max-height: 100%;
  aspect-ratio: var(--map-w) / var(--map-h);
  transform-origin: center center;
  animation: map-zoom 4.8s cubic-bezier(0.33, 0.1, 0.25, 1) both;
}

.map-fit {
  position: relative;
  width: 100%;
  height: 100%;
  animation: map-drift 28s ease-in-out 4.8s infinite alternate;
}

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
  -webkit-user-drag: none;
}

/* --- Brand --- */

.brand-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 4.5rem 1.25rem 1.75rem;
  background: linear-gradient(to top, rgba(2, 4, 10, 0.92) 40%, transparent);
  text-align: center;
  pointer-events: none;
}

.brand-link {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.brand-link:hover,
.brand-link:focus-visible {
  opacity: 0.88;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  color: var(--ink);
  text-shadow:
    0 0 18px rgba(62, 207, 191, 0.35),
    0 0 48px rgba(90, 150, 255, 0.2);
  animation: brand-in 2.4s ease 2.2s both;
}

.tagline {
  margin: 0.65rem 0 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(62, 207, 191, 0.35);
  animation: brand-in 2.4s ease 3.2s both;
}

/* --- Building Blocks --- */

.blocks {
  position: relative;
  padding: 4.5rem 1.25rem 5rem;
  background:
    radial-gradient(ellipse 70% 40% at 10% 0%, rgba(62, 207, 191, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 30% at 90% 10%, rgba(99, 140, 255, 0.07), transparent 50%),
    var(--void);
}

.blocks__intro {
  max-width: 40rem;
  margin: 0 auto 2.75rem;
}

.blocks__eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.blocks__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 2.85rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.blocks__links {
  margin: 1rem 0 0;
}

.blocks__links a {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.05rem;
}

.blocks__links a:hover,
.blocks__links a:focus-visible {
  color: var(--ink);
}

.blocks__list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 68rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.block {
  --tone: var(--accent);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem 1.5rem;
  align-items: stretch;
  padding: 1.15rem 0 1.25rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1.5rem;
  transition: background 0.25s ease;
}

.block:last-child {
  border-bottom: 1px solid var(--line);
}

.block:target,
.block:hover {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--tone) 12%, transparent),
    transparent 55%
  );
}

.block__main {
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid color-mix(in srgb, var(--tone) 75%, transparent);
  min-width: 0;
}

.block__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.block__name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.block__name a:hover,
.block__name a:focus-visible {
  color: var(--tone);
}

.block__desc {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 34rem;
}

.block__parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  align-content: center;
}

.block__slot {
  min-height: 3.25rem;
  border: 1px dashed color-mix(in srgb, var(--tone) 35%, transparent);
  background: color-mix(in srgb, var(--tone) 5%, transparent);
  border-radius: 2px;
}

/* Gefüllte Teilbereiche: .block__part */
.block__part {
  display: flex;
  align-items: center;
  min-height: 3.25rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent);
  background: color-mix(in srgb, var(--tone) 10%, rgba(8, 12, 20, 0.6));
  border-radius: 2px;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

a.block__part:hover,
a.block__part:focus-visible {
  border-color: color-mix(in srgb, var(--tone) 70%, transparent);
  background: color-mix(in srgb, var(--tone) 18%, rgba(8, 12, 20, 0.6));
  color: var(--ink);
}

/* --- Unterseiten --- */

.page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 40% at 10% 0%, rgba(62, 207, 191, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 30% at 90% 10%, rgba(99, 140, 255, 0.07), transparent 50%),
    var(--void);
}

.page-header,
.page-main {
  max-width: 42rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.page-header {
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.page-nav a {
  color: var(--accent);
  text-decoration: none;
}

.page-nav a:hover,
.page-nav a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.page-nav__dot {
  opacity: 0.55;
}

.page-eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 6vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.page-lede {
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.page-main {
  padding-bottom: 4rem;
}

.page-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.page-section__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.page-topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.page-topics a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.page-topics a:hover,
.page-topics a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.page-section--draft {
  color: var(--ink-soft);
}

.page-header--wide,
.page-main--wide {
  max-width: 52rem;
}

.topic-hero {
  margin: 0 0 2rem;
}

.topic-hero img {
  display: block;
  width: min(100%, 22rem);
  height: auto;
  border-radius: 2px;
  background: #000;
}

.topic-figure {
  margin: 0.75rem 0 1.5rem;
}

.topic-figure--lead {
  margin: 0 0 2rem;
}

.topic-figure img {
  display: block;
  width: 100%;
  max-width: 48rem;
  height: auto;
  border-radius: 2px;
  background: #000;
}

.topic-article h2 {
  margin: 2rem 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.topic-article h2:first-child {
  margin-top: 0;
}

.topic-article p,
.topic-article li {
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
}

.topic-article p {
  margin: 0 0 1rem;
  max-width: 42rem;
}

.topic-article ul {
  margin: 0 0 1.15rem;
  padding-left: 1.2rem;
  max-width: 42rem;
}

.topic-article li {
  margin: 0 0 0.4rem;
}

.topic-article a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.topic-article a:hover,
.topic-article a:focus-visible {
  color: var(--ink);
  border-bottom-color: currentColor;
}

.topic-article strong {
  color: var(--ink);
  font-weight: 600;
}

.topic-back {
  margin: 2.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.92rem;
}

.topic-back a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.05rem;
}

.topic-back a:hover,
.topic-back a:focus-visible {
  color: var(--ink);
}

/* --- Live-Demo (Streamlit iframe) --- */

.live-demo {
  margin: 0 0 2.5rem;
  padding: 0;
  border-top: none;
}

.live-demo__frame-wrap {
  border: 0;
  background: transparent;
  overflow: hidden;
  margin: 0 -0.25rem;
}

.live-demo__frame {
  display: block;
  width: 100%;
  height: min(58vh, 34rem);
  border: 0;
  background: transparent;
}

.live-demo__code-title {
  margin: 1.75rem 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.code-block {
  margin: 0;
  padding: 1.1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #0a0e14;
  color: #d7e0ea;
  font-family: "SF Mono", "Fira Code", ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

.code-block code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* --- Glossar --- */

.page-header--glossary {
  max-width: 68rem;
  padding-bottom: 1.5rem;
}

.glossary-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.5rem;
}

.glossary-index a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.glossary-index a:hover,
.glossary-index a:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.glossary {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.25rem 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.glossary-entry {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: start;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1.5rem;
}

.glossary-entry__media {
  margin: 0;
}

.glossary-entry__media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: #000;
}

.glossary-entry__term {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.45rem, 3vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.glossary-entry__copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 40rem;
}

.glossary-entry__back {
  margin-top: 1.25rem !important;
}

.glossary-entry__back a {
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 0.05rem;
}

.glossary-entry__back a:hover,
.glossary-entry__back a:focus-visible {
  color: var(--ink);
}

@media (max-width: 720px) {
  .glossary-entry {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .glossary-entry__media {
    max-width: 14rem;
  }
}

/* --- Über mich --- */

.page-header--about {
  max-width: 72rem;
  padding-bottom: 1.75rem;
}

.page-header--about .about__name {
  margin-top: 0.25rem;
}

.about {
  display: grid;
  grid-template-columns: minmax(14rem, 0.85fr) minmax(0, 1.35fr);
  gap: 2rem 3rem;
  align-items: start;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1.25rem 4.5rem;
}

.about__portrait {
  margin: 0;
  position: sticky;
  top: 1.5rem;
}

.about__portrait img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(88vh, 52rem);
  object-fit: contain;
  object-position: top center;
  user-select: none;
  -webkit-user-drag: none;
}

.about__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.about__role {
  margin: 0.55rem 0 0;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about__body {
  min-width: 0;
  margin: 0;
}

.about__body p {
  margin: 0 0 1.15rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.7;
  max-width: 40rem;
}

.about__body p:last-child {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .about {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .about__portrait {
    position: static;
    max-width: 18rem;
    margin: 0 auto;
  }

  .about__portrait img {
    max-height: 70vh;
  }
}

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

@keyframes map-drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.015) translate(-0.2%, -0.25%);
  }
}

@keyframes brand-in {
  from {
    opacity: 0;
    transform: translateY(0.6rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .block {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .block__parts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .block__slot {
    min-height: 2.5rem;
  }
}

@media (max-width: 720px) {
  .brand {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }

  .brand-bar {
    padding-bottom: 1.25rem;
  }

  /* Ganzes Bild sichtbar, kein Horizontal-Scroll */
  .map-zoom {
    width: min(100%, calc(100dvh * var(--map-w) / var(--map-h)));
    height: auto;
    max-height: 100%;
    aspect-ratio: var(--map-w) / var(--map-h);
    transform-origin: center center;
    animation: map-zoom 4.8s cubic-bezier(0.33, 0.1, 0.25, 1) both;
  }

  .map-fit {
    animation: none;
  }

  .map-image {
    object-fit: contain;
    object-position: center center;
  }

  .blocks {
    padding: 3rem 1rem 4rem;
  }

  .block__main {
    padding-left: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .map-zoom,
  .map-fit,
  .brand,
  .tagline {
    animation: none;
  }

  .brand,
  .tagline {
    opacity: 1;
  }
}
