/* ============================================================
   Peter Wiebe — CV
   Minimalistisches, redaktionelles Design
   ============================================================ */

:root {
    --bg: #fafaf7;
    --surface: #ffffff;
    --ink: #1a1a1a;
    --ink-soft: #4a4a4a;
    --muted: #8a8a85;
    --line: #e6e4dd;
    --accent: #2b3a55;

    --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --measure: 720px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Platz für die Scrollbar dauerhaft reservieren, damit das Layout
       beim Auf-/Zuklappen nicht springt (Scrollbar erscheint/verschwindet). */
    scrollbar-gutter: stable both-edges;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Verhindert horizontales Scrollen durch die volle Galerie-Breite. */
    overflow-x: clip;
}

a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: border-color 160ms ease, color 160ms ease;
}

a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ---------- Layout ---------- */
.container {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 96px 32px 80px;
    /* Erste „Seite": der CV füllt mindestens die volle Bildschirmhöhe,
       die Galerie liegt dadurch zunächst unterhalb des Sichtbereichs. */
    min-height: 100vh;
    min-height: 100dvh;
}

/* ---------- Header ---------- */
.header {
    margin-bottom: 72px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--line);
}

.name {
    margin: 0 0 14px;
}

/* Name + Titel als SVG: skaliert auf die Inhaltsbreite, bleibt einzeilig */
.name-svg {
    display: block;
    width: 100%;
    height: auto;
    /* Höhe explizit aus der viewBox ableiten — sonst skaliert Safari den
       Titel zu klein, weil dort height:auto die viewBox-Ratio ignoriert. */
    aspect-ratio: 1300 / 112;
    overflow: visible;
}

.name-svg text {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 100px;
    letter-spacing: -2px;
}

.name-svg-main {
    fill: var(--ink);
}

.name-svg-sub {
    fill: var(--muted);
}

.role {
    font-style: italic;
    color: var(--ink-soft);
    font-size: 1.05rem;
    margin: 0 0 32px;
}

.sep {
    color: var(--muted);
    margin: 0 0.35em;
}

.contact {
    display: grid;
    grid-template-columns: max-content max-content;
    justify-content: space-between;
    gap: 10px 32px;
    font-size: 0.95rem;
}

.contact li {
    display: flex;
    gap: 12px;
    color: var(--ink-soft);
    line-height: 1.5;
}

.contact .label {
    flex: 0 0 auto;
    width: 60px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.25em;
}

/* ---------- Sections ---------- */
.section {
    margin-bottom: 64px;
}

.section h2 {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 32px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Einklappbare Kapitel: Inhalt ausblenden, wenn das Kapitel zu ist.
   Standard ohne JS = aufgeklappt; das Skript ergänzt .is-collapsed. */
.section.is-collapsed h2 {
    margin-bottom: 0;
}

.section.is-collapsed .section-body {
    display: none;
}

/* ---------- Entries (Bildung / Erfahrung) ---------- */
.entry {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 32px;
    margin-bottom: 36px;
}

.entry:last-child {
    margin-bottom: 0;
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding-top: 6px;
    letter-spacing: 0.02em;
}

.entry-body h3 {
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 1.15rem;
    margin: 0 0 4px;
    letter-spacing: -0.005em;
    line-height: 1.35;
}

.institution {
    margin: 0 0 10px;
    color: var(--ink-soft);
    font-style: italic;
    font-size: 0.98rem;
}

.detail {
    margin: 0;
    color: var(--ink-soft);
}

.muted {
    color: var(--muted);
    font-style: normal;
}

.tasks {
    margin: 10px 0 0;
    padding: 0;
}

.tasks li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 4px;
    color: var(--ink-soft);
}

.tasks li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--muted);
}

/* ---------- Skills ---------- */
.skills-group {
    margin-bottom: 28px;
}

.skills-group:last-child {
    margin-bottom: 0;
}

.skills-group h4 {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    margin: 0 0 12px;
}

.skills li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px dotted var(--line);
}

.skills li:last-child {
    border-bottom: none;
}

.skill-name {
    color: var(--ink);
}

.skill-level {
    display: inline-flex;
    gap: 5px;
    flex-shrink: 0;
}

.skill-level i {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--line);
}

.skill-level[data-level="1"] i:nth-child(-n+1),
.skill-level[data-level="2"] i:nth-child(-n+2),
.skill-level[data-level="3"] i:nth-child(-n+3),
.skill-level[data-level="4"] i:nth-child(-n+4),
.skill-level[data-level="5"] i:nth-child(-n+5) {
    background: var(--accent);
}

/* ---------- Interests ---------- */
.interests {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 32px;
    margin: 0;
}

.interests dt {
    font-family: var(--font-serif);
    font-weight: 500;
    color: var(--ink);
    padding-top: 2px;
}

.interests dd {
    margin: 0 0 14px;
    color: var(--ink-soft);
}

.interests dd:last-child {
    margin-bottom: 0;
}

/* ---------- Galerie ----------
   Vollbreites Band, das aus der zentrierten Spalte ausbricht. Die Bilder
   ordnen sich automatisch in Spalten an (Masonry über CSS-columns), egal
   wie viele es sind. */
.gallery {
    /* Eigene Bildschirmseite: nimmt mindestens die volle Höhe ein und
       rastet beim Scrollen sanft ein. Liegt außerhalb des CV-Containers
       und ist dadurch von Natur aus volle Fensterbreite. */
    min-height: 100vh;
    min-height: 100dvh;
    padding: 12vh 0 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    /* Footer wird per JS hier hineingezogen und sitzt unten am Rand. */
    display: flex;
    flex-direction: column;
}

.gallery > .footer {
    margin-top: auto;
}

.gallery[hidden] {
    display: none;
}

.gallery-inner {
    /* Etwas breiter als der Textinhalt, aber nicht randlos. */
    max-width: 1180px;
    /* Abstand nach unten zum Footer spiegelt den oberen 12vh-Abstand der
       Galerie. margin-top:auto am Footer hält ihn zusätzlich am unteren
       Rand, falls nur wenige Bilder vorhanden sind. */
    margin: 0 auto 12vh;
    padding: 0 32px;
}

.gallery-heading {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 28px;
    text-align: center;
}

.gallery-grid {
    columns: 3 260px;
    column-gap: 16px;
}

.gallery-item {
    margin: 0 0 16px;
    break-inside: avoid;
    overflow: hidden;
    border-radius: 3px;
    background: var(--bg);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    /* Sanftes Einblenden, sobald das Bild geladen ist. */
    opacity: 0;
    transition: opacity 400ms ease, transform 400ms ease;
}

.gallery-item.is-loaded img {
    opacity: 1;
}

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

.gallery-item figcaption {
    padding: 8px 10px 10px;
    font-size: 0.82rem;
    color: var(--ink-soft);
    font-style: italic;
}

/* ---------- Scroll-Hinweis ----------
   Schwebt unten mittig auf der ersten Seite und signalisiert die Galerie. */
.scroll-hint {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    pointer-events: none;
    opacity: 0;
    animation: scroll-hint-in 700ms ease 500ms forwards;
    transition: opacity 350ms ease, transform 350ms ease;
}

.scroll-hint.is-hidden {
    /* animation:none ist entscheidend: eine laufende Animation mit
       fill-forwards würde die Deckkraft sonst auf 1 festhalten und das
       Ausblenden verhindern. */
    animation: none;
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
}

/* Auf breiten Screens den Hinweis in die Mitte zwischen Content-Kante und
   Fensterrand setzen, damit er den Inhalt nicht überdeckt.
   Content-Breite = 720px (--measure), halbe Breite = 360px. */
@media (min-width: 900px) {
    .scroll-hint {
        left: calc(75% + 180px);
    }
}

.scroll-hint-chevron {
    width: 9px;
    height: 9px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    animation: scroll-hint-bounce 1.8s ease-in-out infinite;
}

@keyframes scroll-hint-in {
    to { opacity: 1; }
}

@keyframes scroll-hint-bounce {
    0%, 100% { transform: rotate(45deg) translate(0, 0); }
    50%      { transform: rotate(45deg) translate(2.5px, 2.5px); }
}

@media (prefers-reduced-motion: reduce) {
    .scroll-hint-chevron {
        animation: none;
    }
}

/* ---------- Footer ---------- */
.footer {
    margin-top: 0;
    padding-top: 32px;
    padding-bottom: 40px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}

.footer p {
    margin: 0;
}

/* ---------- Responsive ---------- */
@media screen and (max-width: 640px) {
    .container {
        padding: 56px 22px 56px;
    }

    .contact {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .entry {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .entry-date {
        padding-top: 0;
    }

    .interests {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .interests dd {
        margin-bottom: 16px;
    }

    .gallery {
        padding-top: 44px;
    }

    .gallery-inner {
        padding: 0 22px;
    }

    .gallery-grid {
        columns: 2 150px;
        column-gap: 12px;
    }

    .gallery-item {
        margin-bottom: 12px;
    }
}

/* ============================================================
   Print / PDF  (Drucken → Als PDF speichern)
   Eigene, kompaktere Ansicht – unabhängig von der Bildschirm-
   ansicht. Alle Regeln sind klassenbasiert/allgemein: neue
   Einträge, Skills oder Interessen übernehmen die kompakte
   Darstellung automatisch, ohne dass hier etwas geändert werden
   muss. Ziel: alles auf eine A4-Seite.
   ============================================================ */
@page {
    size: A4;
    margin: 11mm 14mm;
}

@media print {
    :root {
        --line: #d2d0c9;
    }

    /* Wurzel-Schriftgröße kleiner -> alle rem-basierten Größen
       (Überschriften, Texte) skalieren automatisch proportional mit. */
    html {
        font-size: 12.5px;
    }

    body {
        background: #fff;
        color: var(--ink);
        font-size: 9pt;
        line-height: 1.3;
        /* Akzentfarben/Skill-Punkte mitdrucken */
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .container {
        max-width: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* ---- Kopfbereich ---- */
    .header {
        margin-bottom: 14px;
        padding-bottom: 10px;
    }

    .name {
        margin-bottom: 8px;
    }

    .contact {
        gap: 3px 28px;
        font-size: 8pt;
    }

    /* ---- Abschnitte (allgemein) ---- */
    .section {
        margin-bottom: 12px;
        break-inside: avoid;
    }

    .section h2 {
        margin-bottom: 8px;
        padding-bottom: 5px;
    }

    /* ---- Einträge: Bildung / Erfahrung ---- */
    .entry {
        margin-bottom: 9px;
        gap: 14px;
        break-inside: avoid;
    }

    .institution {
        margin-bottom: 3px;
    }

    .tasks {
        margin-top: 3px;
    }

    .tasks li {
        margin-bottom: 1px;
    }

    /* ---- Qualifikationen: Skill-Gruppen platzsparend in zwei
       Spalten umbrechen. Greift für jeden Abschnitt, der Skill-
       Gruppen enthält – auch für künftig ergänzte. ---- */
    /* Eingeklappte Kapitel im Druck immer ausklappen */
    .section.is-collapsed h2 {
        margin-bottom: 8px;
    }

    .section.is-collapsed .section-body {
        display: block;
    }

    .section-body:has(.skills-group) {
        columns: 2;
        column-gap: 32px;
    }

    .skills-group {
        margin-bottom: 10px;
        break-inside: avoid;
    }

    .skills-group h4 {
        margin-bottom: 5px;
    }

    .skills li {
        padding: 2px 0;
    }

    /* ---- Interessen ---- */
    .interests {
        gap: 3px 28px;
    }

    .interests dd {
        margin-bottom: 5px;
    }

    /* ---- Links & Footer ---- */
    a {
        border-bottom: none;
        color: var(--ink);
    }

    .footer {
        margin-top: 14px;
        padding-top: 10px;
    }

    /* Galerie und Scroll-Hinweis gehören nicht in den gedruckten Lebenslauf. */
    .gallery,
    .scroll-hint {
        display: none !important;
    }

    /* Vollbild-Höhe für den Druck zurücknehmen, sonst entsteht eine
       fast leere erste Seite. */
    .container {
        min-height: 0;
    }
}