/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: '';
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
  }

  abbr[title]::after {
    content: ' (' attr(title) ')';
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^='#']::after,
  a[href^='javascript:']::after {
    content: '';
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* =========================================================
   THEME / LAYOUT
   ========================================================= */

:root {
  --bg-page: #0f172a; /* sehr dunkles Blau/Anthrazit */
  --bg-card: #1e2537; /* dunklere Card */
  --bg-card-hover: #242c42;
  --border-card: rgba(255, 255, 255, 0.07);

  --text-primary: #f8fafc; /* fast weiß */
  --text-dim: #94a3b8; /* grau/blau */
  --accent: #38bdf8; /* helles Cyan */
  --radius-lg: 1rem;
  --radius-md: 0.5rem;

  --surface-shadow: 0 24px 48px rgba(0, 0, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
  --surface-shadow-hover: 0 32px 64px rgba(0, 0, 0, 0.7),
    0 4px 8px rgba(0, 0, 0, 0.5);

  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI',
    Roboto, 'Helvetica Neue', Arial, sans-serif;
}

html {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1280px;
  padding: 1.5rem;
  margin-inline: auto;
}

/* =========================================================
   HEADER / NAV
   ========================================================= */

.site-header {
  background: rgba(15, 23, 42, 0.6); /* halbtransparent über dunklem BG */
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.brand-sub {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.2;
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  line-height: 1.2;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.main-nav a:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.06);
}

.main-nav a.active {
  color: var(--accent);
  background-color: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* =========================================================
   MAIN
   ========================================================= */

.site-main {
  flex: 1 0 auto;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.section-headline {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.section-headline::after {
  content: '';
  height: 1px;
  flex: 1;
  background: linear-gradient(
    to right,
    rgba(56, 189, 248, 0.6),
    rgba(56, 189, 248, 0) 70%
  );
  opacity: 0.4;
}

/* =========================================================
   PROJECT GRID + CARD
   ========================================================= */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* =========================================================
   CERTIFICATES
   ========================================================= */

.certificate-grid {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
}

.certificate-block {
  text-align: center;
}

/* Einheitliche Höhe und optisch gleiche Darstellung */
.certificate-file {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 420px;
  width: 300px;
  overflow: hidden;
}

.certificate-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background: #111;
  cursor: zoom-in;
}

/* Nur Bilder mit Sprachvariante (DE/EN) zunächst ausblenden */
.certificate-img[data-lang] {
  display: none;
}

/* Aktiv gewählte Sprachvariante sichtbar machen */
.certificate-img[data-lang].active {
  display: block;
}

.certificate-img.active {
  display: inline-block;
  opacity: 1;
}

.lang-toggle {
  margin-bottom: 0.5rem;
}

.toggle-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-size: 0.9rem;
  margin: 0.3rem 0.2rem;
}

.toggle-btn.active {
  background-color: var(--accent);
  color: #0f172a;
  border-color: rgba(56, 189, 248, 0.8);
}

.toggle-btn:hover {
  background-color: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* Lightbox standardmäßig unsichtbar */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

/* sichtbare Lightbox */
#lightbox.active {
  display: flex;
}

/* das große Bild */
#lightbox-img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
}

/* optional: Cursor-Hinweis über Vorschaubildern */
.certificate-img {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.certificate-img:hover {
  transform: scale(1.03);
}

@media (min-width: 900px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/*Project-Cards */
.project-card {
  max-width: 100%;
  min-width: 0;
  min-height: 850px;
  overflow: hidden;
  box-sizing: border-box;
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--surface-shadow);
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s ease, background-color 0.18s ease,
    border-color 0.18s ease;
}

.project-card:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: var(--surface-shadow-hover);
}

/* Header im Card */
.project-card-header {
  margin-bottom: 1rem;
}

.project-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.project-meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background-color: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.5rem;
  line-height: 1.2;
  display: inline-block;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* Inhalt */
.project-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card {
  position: relative;
}

.project-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: block;
  border-radius: var(--radius-lg);
  background: transparent;
  color: transparent;
  text-indent: -9999px;
  overflow: hidden;
}

/* =========================================================
   BUTTON DESIGN (modern dark theme)
   ========================================================= */

.project-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

body.code-view {
  background-color: #0f172a;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
    monospace;
  line-height: 1.5;
  padding: 2rem;
}

.code-wrapper {
  max-width: 1200px;
  margin-inline: auto;
  background-color: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.4);
  padding: 1rem 1rem 1.5rem;
  overflow: hidden;
}

.code-header-blank-target {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 0.5rem;
}

.code-header-blank-target .file {
  color: #38bdf8;
  font-weight: 600;
}

.code-header-blank-target .lang {
  background-color: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  border-radius: 0.4rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.2;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

pre.code-block {
  background: transparent;
  color: #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.4;
  max-height: 80vh;
  overflow: auto;
  margin: 0;
  border-radius: 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  white-space: pre;
}

pre code {
  color: inherit;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

/* Grundstruktur */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

/* Subtiler Glanz bei Hover */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover::after {
  opacity: 1;
}

/* Live ansehen */
.btn-live {
  color: #0f172a;
  background: var(--accent);
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.btn-live:hover {
  background: #5fd6ff;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.6);
}

/* Code ansehen */
.btn-code {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2) inset;
}

.btn-code:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

/* Fokuszustand für Tastaturnavigation */
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.3);
}

/* Zweispaltige Preview-Zone (iframe / Code) */
.preview-split {
  display: flex;
  flex-direction: column; /* immer untereinander */
  gap: 1rem;
}

hr {
  border-color: rgba(56, 189, 248, 0.5);
  margin: 1rem 0;
}

@media (min-width: 700px) {
  .preview-split {
    flex-direction: column;
  }
}

.preview-left {
  height: 500px;
}

.preview-left,
.preview-right {
  /*flex: 1;*/
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Frame Wrapper für iframe */
.frame-wrapper {
  position: relative;
  background-color: #0b1120;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.4);
  min-height: 500px;
}

.frame-wrapper iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  color-scheme: light;
}

@media (min-width: 700px) {
  .frame-wrapper iframe {
    height: 100%;
  }
}

/* Code Box rechts */
/* Inhalt der Code-Vorschau */
.code-box {
  background-color: #0b1120;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 200px;
  max-height: 260px; /* Wichtig: Box begrenzen */
  overflow: hidden; /* kein Overflow außerhalb der Box */
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.4);
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
    monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #cbd5e1;
  display: flex;
  flex-direction: column; /* vertikale Anordnung */
  gap: 0.5rem;
}

.code-box pre {
  margin: 0;
  padding: 0.75rem;
  width: 100%;
  height: 100%;
  max-height: 260px;
  overflow-x: auto;
  overflow-y: auto;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre; /* keine weichen Umbrüche */
}

.code-box code {
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  display: block;
  white-space: inherit;
}

/* Header oben (Dateiname + Button) */
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: 0.5rem;
}

/* Dateiname im Header */
.code-header .code-filename {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 0.25rem 0.5rem;
}

/* Code-Vorschau (unterhalb) */
.code-viewer {
  display: block;
  margin: 0;
  padding: 0.75rem;
  background-color: transparent;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1; /* nutzt restliche Höhe */
}

.code-viewer code {
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo,
    monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #cbd5e1;
  white-space: pre;
}

/* Placeholder "Code wird geladen..." */
.code-placeholder {
  display: grid;
  gap: 0.5rem;
}

.code-placeholder .line {
  height: 0.6rem;
  background: linear-gradient(
    90deg,
    rgba(226, 232, 240, 0.08) 0%,
    rgba(226, 232, 240, 0.2) 50%,
    rgba(226, 232, 240, 0.08) 100%
  );
  border-radius: 0.3rem;
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.code-placeholder .line.short {
  width: 60%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Beschreibung unterhalb */
.project-desc {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-dim);
  line-height: 1.5;
}

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background-color: #0b1120;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

@media (min-width: 600px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
}

.footer-copy {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.4;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
  line-height: 1.4;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.15s ease;
}

.footer-links a:hover {
  background-color: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

@media (max-width: 768px) {
  .certificate-grid {
    flex-direction: column;
    align-items: center;
  }
  .certificate-file {
    width: 90%;
    height: auto;
  }
}
