/* =========================================================
   Base layout & typography
========================================================= */
html {
  font-size: clamp(15px, 1.1vw, 17px);
  background-color: #f6f7f9;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  max-width: 1200px;
  margin: 40px auto;
  background: #f6f7f9;
  color: #222;
  font-size: 1rem;
  line-height: 1.65;
}

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
}

h1, h2, h3 {
  margin-top: 1.5em;
  font-weight: 600;
}

a {
  color: #1f4fd8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =========================================================
   Containers & sections
========================================================= */

.container {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
}

.info-container {
  background-color: #ffffff;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.08);
}

.info-container h2 {
  margin-top: 0;
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }
    .info-container {
    padding: 5px;
  }
}

/* =========================================================
   Python Code Blocks
========================================================= */

/* Container */
.code-block {
  margin-top: 0.8rem;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
  background: #2b2b2b;
}

/* Header (immer sichtbar) */
.code-block summary {
  background: #3a3a3a;
  color: #ddd;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  user-select: none;
  transition: background 0.2s ease;
}

.code-block summary:hover {
  background: #4a4a4a;
}

/* Entfernt default Pfeil (optional sauberer Look) */
.code-block summary::-webkit-details-marker {
  display: none;
}

/* Custom Pfeil */
.code-block summary::after {
  content: "▼";
  float: right;
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.code-block[open] summary::after {
  transform: rotate(180deg);
}

/* Codebereich */
.code-block pre {
  margin: 0;
  padding: 0.9rem;
  background: #1e1e1e;
  overflow-x: auto;
}

/* Code */
.code-block code {
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  color: #ddd;
}

.code-block[open] summary {
  border-bottom: 1px solid #444;
}

/* =========================================================
   D3 Code Blocks (separate from Python!)
========================================================= */

.d3-code-block {
  margin-top: 0.8rem;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
  background: #2b2b2b;
}

.d3-code-block summary {
  background: #3a3a3a;
  color: #ddd;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  user-select: none;
  transition: background 0.2s ease;
}

.d3-code-block summary:hover {
  background: #4a4a4a;
}

.d3-code-block summary::-webkit-details-marker {
  display: none;
}

.d3-code-block summary::after {
  content: "▼";
  float: right;
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.d3-code-block[open] summary::after {
  transform: rotate(180deg);
}

.d3-code-block pre {
  margin: 0;
  padding: 0.9rem;
  background: #1e1e1e;
  overflow-x: auto;
}

.d3-code-block code {
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  color: #ddd;
}

.d3-code-block[open] summary {
  border-bottom: 1px solid #444;
}

/* =========================================================
   Hero / Profile
========================================================= */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
  margin-bottom: 3rem;
}

.hero h1 {
  margin-top: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.hero p {
  font-size: 1.05rem;
  color: #444;
  max-width: 60ch;
}

@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.profile-pic {
  display: block;
  width: clamp(72px, 15vw, 130px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (hover: hover) {
  .profile-pic {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .profile-pic:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  }
}

.project-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.2rem;
}

.project {
  padding: 1rem 1.2rem;
  border-radius: 8px;
  background: #fafafa;
  transition: background 0.2s ease, transform 0.15s ease;
}

.project:hover {
  background: #f0f3f7;
  transform: translateY(-2px);
}

.project a {
  font-weight: 600;
  text-decoration: none;
}

/* =========================================================
   Figures & media
========================================================= */

figure {
  max-width: 900px;
  margin: 2rem auto;
}

.plot {
  margin: auto;
  text-align: center;
  overflow-x: auto;
}

.responsive-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.plot img {
  height: clamp(200px, 50vw, 500px);
  width: auto;
  max-width: 100%;
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
  .plot img:hover {
    transform: scale(1.015);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  }
}

.plot::after {
  content: "Click to enlarge";
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.2rem;
}

.caption,
.plot figcaption {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #666;
  text-align: center;
}

@media (max-width: 480px) {
  .plot {
    margin: 1.2rem auto;
  }
}

/* =========================================================
   Tooltip (D3)
========================================================= */

#tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  visibility: hidden;

  font-size: clamp(0.65rem, 2vw, 0.8rem);
  line-height: 1.4;
  padding: 0.5rem 0.7rem;
  min-width: 180px;
  max-width: 320px;
}

#tooltip ul {
  margin: 0.35rem 0 0 0;
  padding-left: 1.1rem;
}

#tooltip li {
  margin: 0.15rem 0;
}

#tooltip .tooltip-heading {
  margin-top: 0.5rem;
  font-weight: 700;
}

#tooltip .tooltip-empty {
  margin-top: 0.25rem;
  color: #666;
  font-size: 0.9em;
}


/* =========================================================
   Axes (D3)
========================================================= */

.axis path,
.axis line {
  stroke: #666;
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.axis text {
  font-size: clamp(0.7rem, 1.4vw, 0.85rem);
}

.axis-label {
  font-size: clamp(12px, 1rem, 14px);
}

@media (max-width: 480px) {
  #legend {
    margin-top: 10px;
  }
}


/* =========================================================
   D3 elements
========================================================= */

.cell {
  stroke: none;
}

.dot {
  stroke: #333;
  stroke-width: 0.5;
}


/* =========================================================
   Legend (Heatmap & Choropleth)
========================================================= */

#legend {
  max-width: 600px;
  margin: 20px auto 0;
  text-align: center;
}

.legend-label {
  font-size: clamp(10px, 1.6vw, 12px);
  fill: #222;
  dominant-baseline: middle;
}

.legend-caption {
  font-size: clamp(0.65rem, 1.7vw, 0.8rem);
  fill: #555;
}

@media (max-width: 600px) {
  .legend-caption {
    font-size: 0.65rem;          /* kleiner als clamp-Max */
  }
}

.legend-axis text {
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
}

.legend-axis path,
.legend-axis line {
  stroke-width: 1;
}

#legend svg {
  background: var(--legend-bg, #ffffff);
  border-radius: 6px;
}

@media (max-width: 480px) {
  #legend {
    margin-top: 10px;
  }
}

.figure-caption,
.caption,
.legend-caption {
  font-size: 0.85rem;
}

/* =========================================================
   Lightbox
========================================================= */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 30, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1000;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 95%;
  max-height: 90%;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   Info box
========================================================= */

.info-box {
  background: linear-gradient(135deg, #f8faff, #ffffff);
  border-left: 4px solid #1f4fd8;
}

.info-box h3 {
  margin-top: 0;
}

.info-box ul {
  padding-left: 1.2rem;
}

.info-box li {
  margin-bottom: 0.5rem;
}

.explain {
  position: relative;
}

.explanation {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  .explain:hover .explanation {
    opacity: 1;
  }
}

/* =========================================================
   Prism Fix (override base code styling)
========================================================= */

.d3-code-block code[class*="language-"] {
  color: inherit;               /* kein globales Weiß */
  background: none;
  text-shadow: none;
}

.d3-code-block pre[class*="language-"],
.d3-code-block code[class*="language-"] {
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.4;
}
.d3-code-block pre[class*="language-"] {
  background: #f5f9fb !important;
}

.d3-code-block .token {
  text-shadow: none !important;
}

/* =========================================================
   UI controls (Dropdowns, Buttons, etc.)
========================================================= */

.controls {
  margin-bottom: 20px;
  display: flex;
  gap: 30px;
  align-items: center;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 500;
}

.controls input[type="range"] {
  width: 150px;
}

.controls select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* =========================================================
   Share buttons
========================================================= */

.share-section {
    text-align: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.share-btn {
    padding: 0.75rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.15s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.facebook {
    background: #1877f2;
    color: white;
}

.linkedin {
    background: #0a66c2;
    color: white;
}

.reddit {
    background: #ff4500;
    color: white;
}

.general {
    background: #444;
    color: white;
}

.github {
    background: #24292f;
    color: white;
}

/* =========================================================
   Tables
========================================================= */

.results-table {
    margin: 2.5rem auto;
    border-collapse: collapse;
    min-width: 700px;
}

.results-table caption {

    margin-bottom: 1rem;

}

.results-table tbody tr:hover {

    background: #f4f6f8;

}

.results-table th,
.results-table td {
    padding: 0.6rem 1rem;
}

.results-table th:first-child,
.results-table td:first-child {
    text-align: left;
}

.results-table th:not(:first-child),
.results-table td:not(:first-child) {
    text-align: right;
}

.highlight-row {
    font-weight: 700;
    background: #eef6ff;
}

.summary-row {

    border-top: 2px solid #666;

    font-weight: 700;

}