/* AP CV / Portfolio – 2.0.16
 * Die zwei Zustände sind bewusst getrennt:
 * - Ausgang: linkes Register + eine Jahreszeile
 * - geöffnet: obere und linke, synchrone Kategorienavigation
 */

body.page-id-3318 { overflow: hidden; }

#apcv-page {
  --apcv-font: Arial, sans-serif;
  --apcv-red: var(--apath-click-red, #ff3b30);
  --apcv-mint: #72e8c9;
  --apcv-ink: #000;
  --apcv-muted: #e5e5e5;
  --apcv-body-size: 16px;
  --apcv-body-weight: 400;
  --apcv-body-leading: 1;
  --apcv-body-tracking: 0.9px;
  --apcv-header-size: 16px;
  --apcv-header-weight: 600;
  --apcv-header-leading: 1;
  --apcv-header-tracking: 0;
  --apcv-site-width: 1000px;
  --apcv-site-inset: 10px;
  --apcv-page-width: 100vw;
  --apcv-normal-edge: max(var(--apcv-site-inset), calc((var(--apcv-page-width) - var(--apcv-site-width)) / 2 + var(--apcv-site-inset)));
  --apcv-top: 5px;
  --apcv-row-gap: 10px;
  --apcv-column-gap: 20px;
  --apcv-entry-gap: 40px;
  --apcv-side-width: 13em;
  --apcv-language-width: 5.5em;
  --apcv-year-left: 25%;
  --apcv-year-right: 0px;
  --apcv-type-size: var(--apcv-body-size);
  --apcv-type-weight: var(--apcv-body-weight);
  --apcv-type-leading: var(--apcv-body-leading);
  --apcv-type-tracking: var(--apcv-body-tracking);
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--apcv-page-width);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0 0 0 calc(50% - var(--apcv-page-width) / 2);
  padding: 0;
  overflow: hidden;
  background: #fff;
}

body.admin-bar #apcv-page {
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
}

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

#apcv-page,
#apcv-page :where(div, header, nav, main, section, button, a, span) {
  font-family: var(--apcv-font) !important;
  font-size: var(--apcv-type-size) !important;
  font-weight: var(--apcv-type-weight) !important;
  line-height: var(--apcv-type-leading) !important;
  letter-spacing: var(--apcv-type-tracking) !important;
  word-spacing: 0 !important;
  font-style: normal !important;
  text-transform: none !important;
}

#apcv-page#apcv-page,
#apcv-page#apcv-page * { color: var(--apcv-ink) !important; }

#apcv-page button,
#apcv-page a {
  text-decoration: none !important;
  text-shadow: none !important;
}

#apcv-page button {
  appearance: none;
  display: inline-block;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left;
  cursor: pointer;
}

/* Hover/Fokus färbt immer die gesamte interaktive Fläche einschließlich
 * aller darin liegenden Spans rot. */
#apcv-page#apcv-page :is(a, button):is(:hover, :focus-visible),
#apcv-page#apcv-page :is(a, button):is(:hover, :focus-visible) * {
  color: var(--apcv-red) !important;
}

#apcv-page :is(button, a, .apcv-column):focus-visible {
  outline: 1px solid var(--apcv-red);
  outline-offset: 2px;
}

/* -------------------------------------------------------------------------
   A. Ausgangszustand
   ------------------------------------------------------------------------- */

#apcv-page .apcv-header {
  --apcv-type-size: var(--apcv-header-size);
  --apcv-type-weight: var(--apcv-header-weight);
  --apcv-type-leading: var(--apcv-header-leading);
  --apcv-type-tracking: var(--apcv-header-tracking);
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  padding: var(--apcv-top) var(--apcv-normal-edge) 0;
  background: #fff;
}

#apcv-page .apcv-identity-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: baseline;
  width: 100%;
}

#apcv-page .apcv-name { justify-self: start; }
#apcv-page .apcv-view { justify-self: center; }
#apcv-page .apcv-actions { justify-self: end; }

#apcv-page .apcv-languages {
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

/* Im Ausgangszustand sind ausschließlich CV und Portfolio sichtbar. */
#apcv-page .apcv-navigation-top { display: none; }

#apcv-page .apcv-workspace {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex: 1 1 0;
  min-height: 0;
  padding: var(--apcv-row-gap) var(--apcv-normal-edge) 18px;
}

#apcv-page .apcv-navigation-side {
  display: flex;
  grid-column: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--apcv-row-gap);
  min-width: 0;
  margin: 0;
  padding: 0 var(--apcv-column-gap) 0 0;
}

/* Die Werte für links/rechts werden in JavaScript direkt an C von „CV“
 * und N von „EN“ gemessen. */
#apcv-page .apcv-main {
  position: absolute;
  top: var(--apcv-row-gap);
  right: var(--apcv-year-right);
  bottom: 18px;
  left: var(--apcv-year-left);
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
}

#apcv-page .apcv-columns {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0 var(--apcv-column-gap);
  width: 100%;
  height: 100%;
  min-height: 0;
}

#apcv-page .apcv-column {
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin: 0;
  padding: 0 0 var(--apcv-entry-gap);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b9b9b9 transparent;
  transition: color 180ms ease, opacity 180ms ease;
}

#apcv-page [data-apcv-list] { padding: 0; }

#apcv-page .apcv-item {
  display: block;
  margin: 0 0 var(--apcv-entry-gap);
  padding: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

#apcv-page .apcv-item-date,
#apcv-page .apcv-item-person,
#apcv-page .apcv-item-title,
#apcv-page .apcv-item-meta,
#apcv-page .apcv-date-full { display: block; }

#apcv-page .apcv-date-year { display: none; }

#apcv-page .apcv-year-rail { display: none; }

#apcv-page .apcv-item-person,
#apcv-page .apcv-item-meta { white-space: pre-line; }

#apcv-page .apcv-item-title { font-style: italic !important; }

@media (min-width: 768px) {
  /* Jede Kategorie erhält eine vollständige eigene Datenzeile. Die sechs
   * Zeilen beginnen an derselben C-von-CV-Achse und enden an EN. */
  #apcv-page:not(.apcv-expanded) .apcv-columns {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: minmax(1em, auto);
    gap: var(--apcv-row-gap) 0;
    height: auto;
  }

  #apcv-page:not(.apcv-expanded) .apcv-column {
    height: auto;
    min-height: 1em;
    overflow: hidden;
    padding: 0;
  }

  #apcv-page:not(.apcv-expanded) .apcv-item { display: none; }

  #apcv-page:not(.apcv-expanded) .apcv-year-rail {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--apcv-column-gap);
    min-height: 1.15em;
    min-width: 0;
    color: var(--apcv-mint) !important;
  }

  #apcv-page:not(.apcv-expanded) .apcv-year-rail-value {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #apcv-page:not(.apcv-expanded) .apcv-year-rail,
  #apcv-page:not(.apcv-expanded) .apcv-year-rail * {
    color: var(--apcv-mint) !important;
  }

  #apcv-page:not(.apcv-expanded) .apcv-date-full,
  #apcv-page:not(.apcv-expanded) .apcv-item-person,
  #apcv-page:not(.apcv-expanded) .apcv-item-title,
  #apcv-page:not(.apcv-expanded) .apcv-item-meta { display: none; }

  #apcv-page:not(.apcv-expanded) .apcv-date-year {
    display: none;
  }

}

/* -------------------------------------------------------------------------
   B. Geöffneter Zustand
   ------------------------------------------------------------------------- */

#apcv-page.apcv-expanded {
  --apcv-type-size: var(--apcv-body-size);
  --apcv-type-weight: var(--apcv-body-weight);
  --apcv-type-leading: var(--apcv-body-leading);
  --apcv-type-tracking: var(--apcv-body-tracking);
}

#apcv-page.apcv-expanded .apcv-header {
  padding-right: var(--apcv-site-inset);
  padding-left: var(--apcv-site-inset);
}

#apcv-page.apcv-expanded .apcv-identity-row {
  display: grid;
  grid-template-columns: var(--apcv-side-width) minmax(0, 1fr) var(--apcv-language-width);
  align-items: baseline;
  gap: 0;
}

#apcv-page.apcv-expanded .apcv-name {
  grid-column: 1;
  justify-self: start;
}

/* Sechs gleich breite Überschriften teilen exakt die sechs Inhaltsachsen. */
#apcv-page.apcv-expanded .apcv-navigation-top {
  display: grid;
  grid-column: 2;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: baseline;
  gap: 0;
  min-width: 0;
}

#apcv-page.apcv-expanded .apcv-navigation-top button {
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
}

#apcv-page.apcv-expanded .apcv-view { display: none; }

#apcv-page.apcv-expanded .apcv-actions {
  grid-column: 3;
  justify-self: end;
}

#apcv-page.apcv-expanded .apcv-workspace {
  display: grid;
  grid-template-columns: var(--apcv-side-width) minmax(0, 1fr) var(--apcv-language-width);
  flex: 1 1 0;
  min-height: 0;
  padding: var(--apcv-row-gap) var(--apcv-site-inset) 18px;
}

#apcv-page.apcv-expanded .apcv-navigation-side {
  display: flex;
  grid-column: 1;
  align-self: start;
  padding-right: var(--apcv-column-gap);
}

#apcv-page.apcv-expanded .apcv-main {
  grid-column: 2;
  position: static;
  height: 100%;
  overflow: hidden;
}

#apcv-page.apcv-expanded .apcv-columns {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  height: 100%;
  min-height: 0;
}

/* Keine seitliche Spalte, kein Innenpadding: Überschrift und
 * zugehöriger Inhalt haben dieselbe linke Kante. */
#apcv-page.apcv-expanded .apcv-column {
  height: 100%;
  min-height: 0;
  padding-right: var(--apcv-column-gap);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#apcv-page.apcv-expanded .apcv-year-rail { display: none; }

/* Ein oberes Bedienfeld erhält beim Klick als geschlossene sichtbare Einheit
 * die rote Farbe; beim Sprachwechsel betrifft das ausdrücklich DE / EN. */
#apcv-page#apcv-page :is(.apcv-name, .apcv-view).is-clicked,
#apcv-page#apcv-page .apcv-languages.is-clicked,
#apcv-page#apcv-page .apcv-languages.is-clicked * {
  color: var(--apcv-red) !important;
}

/* Klick-Auswahl: beide Navigationen und nur das korrespondierende Register rot. */
#apcv-page#apcv-page.apcv-has-selection .apcv-navigation button.is-active,
#apcv-page#apcv-page.apcv-has-selection .apcv-navigation button.is-active * ,
#apcv-page#apcv-page.apcv-has-selection .apcv-column.is-active,
#apcv-page#apcv-page.apcv-has-selection .apcv-column.is-active * {
  color: var(--apcv-red) !important;
}

#apcv-page.apcv-has-selection .apcv-navigation button:not(.is-active),
#apcv-page.apcv-has-selection .apcv-column:not(.is-active) {
  opacity: 1;
}

#apcv-page#apcv-page.apcv-has-selection .apcv-navigation button:not(.is-active),
#apcv-page#apcv-page.apcv-has-selection .apcv-navigation button:not(.is-active) *,
#apcv-page#apcv-page.apcv-has-selection .apcv-column:not(.is-active),
#apcv-page#apcv-page.apcv-has-selection .apcv-column:not(.is-active) * {
  color: var(--apcv-muted) !important;
}

/* Die flüchtige Hover-Vorschau behält denselben visuellen Zusammenhang. */
#apcv-page#apcv-page.apcv-has-preview .apcv-navigation button.is-active,
#apcv-page#apcv-page.apcv-has-preview .apcv-navigation button.is-active *,
#apcv-page#apcv-page.apcv-has-preview .apcv-column.is-active,
#apcv-page#apcv-page.apcv-has-preview .apcv-column.is-active * {
  color: var(--apcv-red) !important;
}

#apcv-page#apcv-page.apcv-has-preview .apcv-navigation button:not(.is-active),
#apcv-page#apcv-page.apcv-has-preview .apcv-navigation button:not(.is-active) *,
#apcv-page#apcv-page.apcv-has-preview .apcv-column:not(.is-active),
#apcv-page#apcv-page.apcv-has-preview .apcv-column:not(.is-active) * {
  color: var(--apcv-muted) !important;
}

/* Auch bei einer aktiven Auswahl bleibt jeder einzeln überfahrene Link
 * vollständig rot; die Auswahl selbst wird dabei nicht aufgehoben. */
#apcv-page#apcv-page.apcv-has-selection :is(a, button):is(:hover, :focus-visible),
#apcv-page#apcv-page.apcv-has-selection :is(a, button):is(:hover, :focus-visible) * {
  color: var(--apcv-red) !important;
}

/* Die oberen Bedienelemente schalten einen bewusst globalen, roten Zustand
 * ein: jeder sichtbare Text der CV-Seite wird rot, der Hintergrund bleibt weiß. */
#apcv-page#apcv-page.apcv-global-red.apcv-global-red.apcv-global-red,
#apcv-page#apcv-page.apcv-global-red.apcv-global-red.apcv-global-red * {
  color: var(--apcv-red) !important;
}

/* -------------------------------------------------------------------------
   Bestehende mobile Navigation bleibt bewusst die bisherige Variante.
   ------------------------------------------------------------------------- */

@media (max-width: 767px) {
  body.page-id-3318 { overflow: auto; }

  #apcv-page {
    --apcv-normal-edge: 16px;
    /* Direkt aus der regulären mobilen apath-Inhaltsebene übernommen. */
    --apcv-font: Arial, Helvetica, sans-serif;
    --apcv-body-size: 16px;
    --apcv-body-weight: 400;
    --apcv-body-leading: 1;
    --apcv-body-tracking: 0.9px;
    --apcv-header-size: 16px;
    --apcv-header-weight: 600;
    --apcv-header-leading: 1;
    --apcv-header-tracking: 0;
    --apcv-top: 5px;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  body.admin-bar #apcv-page { height: auto; }

  #apcv-page .apcv-header { padding: var(--apcv-top) 16px 0; }

  #apcv-page .apcv-identity-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 16px;
  }

  #apcv-page .apcv-name,
  #apcv-page .apcv-view,
  #apcv-page .apcv-actions {
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
  }

  #apcv-page .apcv-name { flex: 1 1 auto; }

  /* Auf Mobil führt die Registerleiste direkt zum Inhalt. CV und Portfolio
   * wären dort doppelte, nicht benötigte Bedienelemente. */
  #apcv-page .apcv-view { display: none !important; }

  #apcv-page .apcv-navigation-top { display: none !important; }

  #apcv-page .apcv-workspace,
  #apcv-page.apcv-expanded .apcv-workspace {
    display: block;
    flex: none;
    height: auto;
    padding: 0 16px 24px;
  }

  #apcv-page .apcv-navigation-side,
  #apcv-page.apcv-expanded .apcv-navigation-side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    row-gap: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  #apcv-page .apcv-navigation-side button {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    white-space: normal;
  }

  #apcv-page .apcv-main,
  #apcv-page.apcv-expanded .apcv-main {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #apcv-page .apcv-columns,
  #apcv-page.apcv-expanded .apcv-columns {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
  }

  #apcv-page .apcv-column,
  #apcv-page.apcv-expanded .apcv-column {
    display: none;
    width: 100%;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0 0 24px;
    overflow: visible;
    transform: none;
  }

  #apcv-page .apcv-column.is-active,
  #apcv-page.apcv-expanded .apcv-column.is-active { display: block; }

  #apcv-page .apcv-year-rail { display: none !important; }

  #apcv-page.apcv-has-preview .apcv-column:not(.is-active),
  #apcv-page.apcv-has-selection .apcv-column:not(.is-active) {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  #apcv-page *,
  #apcv-page *::before,
  #apcv-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
