/* ===== Schriften ===== */
@font-face {
    font-family: "Bricolage Grotesque";
    src: url("fonts/bricolage-800.woff2") format("woff2");
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: "Figtree";
    src: url("fonts/figtree-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Figtree";
    src: url("fonts/figtree-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "IBM Plex Mono";
    src: url("fonts/ibm-plex-mono-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

/* ===== Design-Tokens ===== */
:root {
    /* Farben */
    --color-bg: #FAF9F6;
    --color-surface: #FFFFFF;
    --color-grid: #E6E2D8;
    --color-text: #003049;
    --color-text-muted: #5C5A4E;
    --color-accent: #F77F00;
    --color-sun: #FCBF49;
    --color-signal: #D62828;
    --color-select: #1F6E99;

    /* Schriften */
    --font-display: "Bricolage Grotesque", sans-serif;
    --font-body: "Figtree", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Raster: Inhalt links, schmale Spalte rechts (ab 900px) */
    --side-column: minmax(17rem, 22rem);
    --column-gap: clamp(2rem, 6vw, 6rem);
}

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

html {
    overflow-x: clip;
}

/* Sanft zu den Abschnitten scrollen, außer bei reduzierter Bewegung */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    overflow-x: clip;
}

h1,
h2 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.02em;
    margin: 0;
}

a {
    color: inherit;
}

a:focus-visible {
    outline: 2px solid var(--color-select);
    outline-offset: 3px;
}

/* ===== Layout ===== */
.site-header,
main,
.site-footer {
    margin-inline: clamp(1.25rem, 5vw, 4rem);
}

section {
    padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

h2 {
    font-size: clamp(2.25rem, 6.5vw, 5rem);
}

/* ===== Header ===== */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-block: 1.5rem;
}

.logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.5rem;
    text-decoration: none;
}

.logo-dot {
    color: var(--color-accent);
}

.site-header ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-header nav a {
    font-weight: 500;
    text-decoration: none;
}

.site-header nav a:hover {
    text-decoration: underline;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* ===== Hero ===== */
.hero h1 {
    font-size: clamp(3rem, 10vw, 7.5rem);
    line-height: 1.1;
    margin-block: 2.5rem 1.5rem;
}

.highlight {
    color: var(--color-signal);
}

.intro {
    max-width: 36rem;
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    line-height: 1.45;
}

/* ===== Auswahlrahmen (Figma-Look) ===== */
.selected {
    position: relative;
    display: inline-block;
    outline: 1.5px solid var(--color-select);
    outline-offset: 0.12em;
    line-height: 0.9;
    transform: translateX(var(--drag, 0px));
    will-change: transform;
    @supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .selected.scroll-drag {
            animation: drag-word linear both;
            animation-timeline: scroll(root);
            animation-range: 0px 400px;
        }
    }
}

@keyframes drag-word {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(var(--max-shift, 0px));
    }
}
}

/* Vier Eckpunkte */
.selected::before {
    content: "";
    position: absolute;
    inset: calc(-0.12em - 5px);
    pointer-events: none;
    --handle: linear-gradient(var(--color-surface), var(--color-surface));
    --handle-border: linear-gradient(var(--color-select), var(--color-select));
    background:
        var(--handle) 2px 2px / 6px 6px no-repeat,
        var(--handle) calc(100% - 2px) 2px / 6px 6px no-repeat,
        var(--handle) 2px calc(100% - 2px) / 6px 6px no-repeat,
        var(--handle) calc(100% - 2px) calc(100% - 2px) / 6px 6px no-repeat,
        var(--handle-border) top left / 10px 10px no-repeat,
        var(--handle-border) top right / 10px 10px no-repeat,
        var(--handle-border) bottom left / 10px 10px no-repeat,
        var(--handle-border) bottom right / 10px 10px no-repeat;
}

/* Größenangabe über dem Rahmen */
.selected::after {
    content: attr(data-size);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.45em;
    padding: 0.15rem 0.45rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: nowrap;
    color: #FFFFFF;
    background: var(--color-select);
    border-radius: 3px;
}

/* ===== Namens-Cursor ===== */
.name-cursor {
    position: absolute;
    left: 100%;
    top: 40%;
    margin-left: 0.05em;
    display: flex;
    align-items: flex-start;
    pointer-events: none;
}

.name-cursor svg {
    fill: var(--color-accent);
    stroke: var(--color-text);
    stroke-width: 1.2;
    stroke-linejoin: round;
}

.name-cursor-label {
    margin-top: 20px;
    margin-left: -4px;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--color-text);
    background: var(--color-accent);
    border-radius: 4px;
}

/* ===== Footer ===== */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-block: 1.5rem 2rem;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    border-top: 1.5px solid var(--color-text);
}

.site-footer p {
    margin: 0;
}

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

/* ===== Status-Panel (wie ein Inspektor in Figma) ===== */
.status-panel {
    margin-top: 2.5rem;
    padding: 0.9rem 1.1rem 1.1rem;
    font-size: 1rem;
    background: var(--color-surface);
    border: 1.5px solid var(--color-text);
    border-radius: 10px;
}

.status-facts {
    margin: 0;
}

.status-facts div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.4rem;
    border-bottom: 1px solid var(--color-grid);
}

.status-facts dt {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.status-facts dd {
    margin: 0;
    font-weight: 500;
}

.status-now {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.8rem 0 1rem;
    line-height: 1.4;
}

.status-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Pillen im Status-Panel */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.3rem 0.85rem 0.3rem 0.4rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1.5px solid var(--color-text);
    border-radius: 999px;
}

/* Die wichtigste Info bekommt Gold */
.tag--ready {
    background: var(--color-sun);
}

.tag-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--color-surface);
    background: var(--color-text);
    border-radius: 50%;
}

.tag-icon svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.status-time {
    font-variant-numeric: tabular-nums;
}

.status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    color: inherit;
    background: none;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.status-icon:focus-visible {
    outline: 2px solid var(--color-select);
    outline-offset: 2px;
}

.status-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

/* --- Einfache Animationen --- */
.is-playing .a-zzz {
    animation: zzz 0.9s ease-out;
}

.is-playing .a-scroll {
    animation: bob 0.9s ease-in-out;
}

.is-playing .a-search {
    animation: search 0.9s ease-in-out;
}

.is-playing .a-tilt {
    animation: tilt 1.2s ease-in-out;
}

@keyframes zzz {
    0% {
        transform: translateY(8px);
        opacity: 0;
    }

    60% {
        transform: translateY(-4px);
        opacity: 1;
    }

    100% {
        transform: none;
    }
}

@keyframes bob {

    0%,
    100% {
        transform: none;
    }

    20% {
        transform: translateY(-5px);
    }

    40% {
        transform: translateY(3px);
    }

    60% {
        transform: translateY(-4px);
    }

    80% {
        transform: translateY(2px);
    }
}

@keyframes search {

    0%,
    100% {
        transform: none;
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(3px);
    }
}

@keyframes tilt {
    0% {
        transform: rotate(0);
    }

    30% {
        transform: rotate(9deg);
    }

    55% {
        transform: rotate(9deg);
    }

    75% {
        transform: rotate(-3deg);
    }

    100% {
        transform: rotate(0);
    }
}

/* --- Kaffeeautomat: Tropfen und Füllstand --- */
.drop {
    fill: currentColor;
    stroke: none;
    opacity: 0;
}

.is-playing .drop {
    animation: drip 0.8s ease-in 3;
}

@keyframes drip {
    0% {
        transform: translateY(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    85% {
        opacity: 1;
    }

    100% {
        transform: translateY(3.5px);
        opacity: 0;
    }
}

.fill {
    fill: currentColor;
    stroke: none;
    opacity: 0.45;
    transform-box: fill-box;
    transform-origin: bottom;
}

.is-playing .fill {
    animation: fillup 2.6s ease-out both;
}

@keyframes fillup {
    from {
        transform: scaleY(0);
    }

    to {
        transform: scaleY(1);
    }
}

/* --- Kaffeetasse: Dampf --- */
.steam path {
    stroke-dasharray: 8;
    stroke-dashoffset: 0;
}

.is-playing .steam path {
    animation: steam 1.1s ease-out both;
}

.is-playing .steam path:nth-child(2) {
    animation-delay: 0.25s;
}

.is-playing .steam path:nth-child(3) {
    animation-delay: 0.5s;
}

@keyframes steam {
    0% {
        stroke-dashoffset: 8;
        opacity: 0;
        transform: translateY(2px);
    }

    60% {
        opacity: 1;
    }

    100% {
        stroke-dashoffset: 0;
        opacity: 1;
        transform: none;
    }
}

/* --- Mond: Aufgang und Sterne --- */
.is-playing .moon-body {
    animation: rise 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rise {
    from {
        transform: translateY(15px);
    }

    to {
        transform: none;
    }
}

.star {
    transform-box: fill-box;
    transform-origin: center;
}

.is-playing .star {
    animation: twinkle 0.5s ease-out both;
}

.is-playing .star.s1 {
    animation-delay: 1.2s;
}

.is-playing .star.s2 {
    animation-delay: 1.45s;
}

@keyframes twinkle {
    0% {
        opacity: 0;
        transform: scale(0.2);
    }

    70% {
        transform: scale(1.3);
    }

    100% {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .status-icon * {
        animation: none !important;
    }
}

/* ===== Mobil ===== */
@media (max-width: 640px) {
    .site-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .site-header ul {
        gap: 1rem;
        font-size: 1rem;
    }

    .hero h1 {
        font-size: clamp(2.4rem, 12vw, 3rem);
    }

    .name-cursor {
        left: auto;
        right: 0;
        top: calc(100% - 0.3em);
    }
}

/* ===== Projektkarten ===== */
h3 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.01em;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
    gap: clamp(1.25rem, 3vw, 2rem);
    margin-top: 2.5rem;
}

.project-card a {
    display: block;
    height: 100%;
    text-decoration: none;
    background: var(--color-surface);
    border: 1.5px solid var(--color-text);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card a:hover,
.project-card a:focus-visible {
    transform: translate(-4px, -4px);
    box-shadow: 6px 6px 0 var(--color-text);
}

.project-card a:focus-visible {
    outline: 2px solid var(--color-select);
    outline-offset: 4px;
}

.project-media {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--color-text);
    border-bottom: 1.5px solid var(--color-text);
    overflow: hidden;
}

.project-media img,
.project-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-media video {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-media video.is-visible {
    opacity: 1;
}

.project-media video.zoom {
    transform-origin: 68% 50%;
    transition: opacity 0.4s ease, transform 1.6s ease;
}

.project-media video.zoom.is-visible {
    transform: scale(1.35);
}

.project-info {
    padding: 1.25rem 1.4rem 1.5rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.9rem;
    padding: 0;
    list-style: none;
}

.project-tags li {
    padding: 0.15rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.2px solid var(--color-text);
    border-radius: 999px;
}

.project-info h3 {
    margin: 0 0 0.4rem;
    font-size: 1.6rem;
    line-height: 1;
}

.project-info p {
    margin: 0;
    color: var(--color-text-muted);
}

@media (prefers-reduced-motion: reduce) {

    .project-card a,
    .project-media video {
        transition: none;
    }

    .project-card a:hover,
    .project-card a:focus-visible {
        transform: none;
    }
}

/* ===== Abschnitts-Label (wie Frame-Namen in Figma) ===== */
.kicker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Linie vom Label bis zum rechten Rand */
.kicker::after {
    content: "";
    flex: 1;
    border-top: 1.5px solid var(--color-text);
}

/* ===== Über mich ===== */
.about-statement {
    max-width: 20ch;
    line-height: 1.2;
}

/* Ausgewähltes Wort: Auswahlrahmen mit Eckpunkten, ohne Label */
.word-select {
    position: relative;
    display: inline-block;
    margin-inline: 0.1em;
    outline: 1.5px solid var(--color-select);
    outline-offset: 0.08em;
    cursor: text;
}

.word-select::before {
    content: "";
    position: absolute;
    inset: calc(-0.08em - 4px);
    pointer-events: none;
    --dot: linear-gradient(var(--color-surface), var(--color-surface));
    --dot-border: linear-gradient(var(--color-select), var(--color-select));
    background:
        var(--dot) 2px 2px / 5px 5px no-repeat,
        var(--dot) calc(100% - 2px) 2px / 5px 5px no-repeat,
        var(--dot) 2px calc(100% - 2px) / 5px 5px no-repeat,
        var(--dot) calc(100% - 2px) calc(100% - 2px) / 5px 5px no-repeat,
        var(--dot-border) top left / 9px 9px no-repeat,
        var(--dot-border) top right / 9px 9px no-repeat,
        var(--dot-border) bottom left / 9px 9px no-repeat,
        var(--dot-border) bottom right / 9px 9px no-repeat;
}

.about-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
    gap: 2rem;
    margin: clamp(2.5rem, 6vw, 4rem) 0 0;
}

.about-facts div {
    padding-top: 0.75rem;
    border-top: 1.5px solid var(--color-text);
}

.about-facts dt {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.about-facts dd {
    margin: 0.4rem 0 0;
}

/* ===== Kontakt ===== */
.contact-text {
    max-width: 32rem;
    margin: 1.25rem 0 0;
}

.mail-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

.mail-link {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.6rem, 4.5vw, 3rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 3px;
    text-underline-offset: 0.15em;
}

.mail-link:hover {
    text-decoration-color: var(--color-signal);
    text-decoration-thickness: 5px;
}

.copy-mail {
    padding: 0.45rem 1rem;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-text);
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.copy-mail:hover {
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--color-text);
}

.copy-mail:active {
    transform: none;
    box-shadow: none;
}

.copy-mail:focus-visible {
    outline: 2px solid var(--color-select);
    outline-offset: 3px;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    font-weight: 500;
}

.contact-links a {
    text-decoration-color: var(--color-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .copy-mail {
        transition: none;
    }

    .copy-mail:hover {
        transform: none;
    }
}

/* ===== Raster ab 900px: Inhalt links, schmale Spalte rechts ===== */
@media (min-width: 900px) {

    .hero,
    .about-layout,
    .contact-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) var(--side-column);
        column-gap: var(--column-gap);
    }

    /* Hero: Überschrift über die ganze Breite, darunter Intro und Status */
    .hero {
        align-items: start;
    }

    .hero h1 {
        grid-column: 1 / -1;
    }

    .status-panel {
        margin-top: 0;
    }

    /* Über mich: Fakten als Liste in der rechten Spalte */
    .about-layout {
        align-items: start;
    }

    .about-facts {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-top: 0.4rem;
    }

    /* Oben sitzt schon die Linie vom Label, also hier keine zweite */
    .about-facts div:first-child {
        padding-top: 0;
        border-top: 0;
    }

    /* Kontakt: Mail und Links rechts, bündig mit dem Status-Panel */
    .contact-layout {
        align-items: end;
    }

    .mail-row {
        margin-top: 0;
    }

    .mail-link {
        font-size: clamp(1.25rem, 2vw, 1.85rem);
    }
}

/* ===== Nur für Screenreader sichtbar ===== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Hexenwerk → Handwerk ===== */
/* Markierter Text, wie beim Bearbeiten einer Textebene */
.is-highlighted {
    background: rgba(31, 110, 153, 0.28);
}

/* Blinkende Schreibmarke, gibt es nur während der Bearbeitung */
.caret {
    display: inline-block;
    width: 0.06em;
    height: 0.85em;
    margin-inline: -0.03em;
    /* gleicht die Breite aus, damit nichts verrutscht */
    vertical-align: -0.05em;
    background: var(--color-select);
    animation: caret-blink 0.9s steps(1) infinite;
}

@keyframes caret-blink {
    50% {
        opacity: 0;
    }
}