/* ==========================================================================
   Maximilian Kenfenheuer — Software Development & Website Design
   Bespoke design system for www.mkenfenheuer.de + blog.mkenfenheuer.de.

   Dark-first, developer-flavoured, professional. Structure mirrors
   dachdecker.css (tokens → base → layout → nav → buttons → sections →
   footer → blog → motion) so the sites in this repo stay maintainable
   side by side. No Bootstrap, no jQuery, no CDN — self-hosted only.
   ========================================================================== */

:root {
    color-scheme: dark light;

    /* Brand accent — vibrant electric indigo → magenta, with cyan + pink pops */
    --accent:       #6D5EFF;
    --accent-2:     #C651FF;
    --accent-strong:#5B45F0;
    --accent-ink:   #0B0D13;   /* text on a solid accent fill */
    --mint:         #2DE9C0;   /* code / mono micro-accent (bright cyan-mint) */
    --pop:          #FF5CA8;   /* warm pop for small highlights */
    --cyan:         #22D3EE;

    /* Signature multi-stop gradient */
    --grad: linear-gradient(120deg, #6D5EFF 0%, #A64BFF 45%, #FF5CA8 100%);
    --grad-soft: linear-gradient(135deg, #6D5EFF, #C651FF);

    /* Dark surfaces (default theme) — faint blue tint for depth */
    --bg:        #0A0B12;
    --bg-2:      #0E1019;
    --surface:   #151827;
    --surface-2: #1D2135;
    --line:      rgba(255, 255, 255, 0.10);
    --line-2:    rgba(146, 130, 255, 0.28);

    --ink:   #ECEEF7;
    --ink-2: #A7AECC;
    --ink-3: #6E7699;

    /* Glow used behind the hero + accents — more vibrant/visible */
    --glow: radial-gradient(55% 55% at 78% 8%, rgba(109,94,255,.38) 0%, transparent 60%),
            radial-gradient(45% 45% at 12% 2%, rgba(198,81,255,.24) 0%, transparent 58%),
            radial-gradient(40% 40% at 60% 40%, rgba(34,211,238,.10) 0%, transparent 60%);

    /* Type — Inter for text, a mono for code & technical labels */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "SFMono-Regular", ui-monospace,
                 "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;

    /* Fluid type scale */
    --fs-display: clamp(2.6rem, 6vw, 4.9rem);
    --fs-h1:      clamp(2.1rem, 4.4vw, 3.4rem);
    --fs-h2:      clamp(1.75rem, 3.2vw, 2.6rem);
    --fs-h3:      clamp(1.2rem, 1.7vw, 1.45rem);
    --fs-lead:    clamp(1.05rem, 1.4vw, 1.28rem);

    /* Spacing / structure */
    --gutter:      clamp(20px, 5vw, 44px);
    --section-y:   clamp(64px, 8vw, 128px);
    --content-max: 1180px;
    --text-max:    68ch;

    --radius:    14px;
    --radius-sm: 9px;
    --radius-lg: 22px;

    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.32);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.45), 0 30px 70px rgba(0,0,0,.45);

    --ease: cubic-bezier(.16, 1, .3, 1);
}

/* Light theme — via system preference or an explicit [data-theme] override */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --accent:       #5B45F0;
        --accent-2:     #B22CF0;
        --accent-strong:#4A34E0;
        --accent-ink:   #FFFFFF;
        --mint:         #0E9F84;
        --pop:          #E8348A;
        --cyan:         #0891B2;

        --grad: linear-gradient(120deg, #5B45F0 0%, #9A2FE8 45%, #E8348A 100%);
        --grad-soft: linear-gradient(135deg, #5B45F0, #B22CF0);

        --bg:        #FFFFFF;
        --bg-2:      #F5F5FB;
        --surface:   #FFFFFF;
        --surface-2: #F3F1FC;
        --line:      #E6E4F0;
        --line-2:    #D6CFF2;

        --ink:   #14121F;
        --ink-2: #514B66;
        --ink-3: #857E9C;

        --glow: radial-gradient(55% 55% at 78% 6%, rgba(109,94,255,.16) 0%, transparent 60%),
                radial-gradient(45% 45% at 12% 2%, rgba(198,81,255,.12) 0%, transparent 58%);

        --shadow:    0 1px 2px rgba(16,20,30,.05), 0 12px 30px rgba(76,52,224,.10);
        --shadow-lg: 0 2px 6px rgba(16,20,30,.07), 0 30px 60px rgba(76,52,224,.16);
    }
}
:root[data-theme="light"] {
    --accent: #5B45F0; --accent-2: #B22CF0; --accent-strong: #4A34E0;
    --accent-ink: #FFFFFF; --mint: #0E9F84; --pop: #E8348A; --cyan: #0891B2;
    --grad: linear-gradient(120deg, #5B45F0 0%, #9A2FE8 45%, #E8348A 100%);
    --grad-soft: linear-gradient(135deg, #5B45F0, #B22CF0);
    --bg: #FFFFFF; --bg-2: #F5F5FB; --surface: #FFFFFF; --surface-2: #F3F1FC;
    --line: #E6E4F0; --line-2: #D6CFF2;
    --ink: #14121F; --ink-2: #514B66; --ink-3: #857E9C;
    --glow: radial-gradient(55% 55% at 78% 6%, rgba(109,94,255,.16) 0%, transparent 60%),
            radial-gradient(45% 45% at 12% 2%, rgba(198,81,255,.12) 0%, transparent 58%);
    --shadow: 0 1px 2px rgba(16,20,30,.05), 0 12px 30px rgba(76,52,224,.10);
    --shadow-lg: 0 2px 6px rgba(16,20,30,.07), 0 30px 60px rgba(76,52,224,.16);
    color-scheme: light;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    background:
        var(--glow),
        var(--bg);
    background-repeat: no-repeat;
    background-attachment: fixed, scroll;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

img, svg, video { max-width: 100%; display: block; }
img, video { height: auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    text-wrap: balance;
    overflow-wrap: break-word;   /* long words never force the layout wider than the viewport */
    color: var(--ink);
}

/* Grid/flex items default to min-width:auto, so a wide child (a <pre> code
   block, a long word, an image) can force its track wider than the viewport —
   which body{overflow-x:hidden} then silently clips. Letting the common layout
   children shrink to 0 lets their own overflow:auto / wrapping take over. */
.hero-grid > *,
.split > *,
.blog-layout > *,
.card-grid > *,
.work-grid > *,
.folder-grid > *,
.feature-secondary > *,
.card,
.work-card,
.post-card,
.side-card,
.code-card { min-width: 0; }
.code-card, .code-card pre, .prose pre { max-width: 100%; }
p { margin: 0; }

::selection { background: rgba(110, 139, 255, .32); color: var(--ink); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 12px 18px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 0 0 var(--radius-sm) 0;
    font-weight: 600;
}
.skip-link:focus { left: 0; color: var(--accent-ink); }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.wrap {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); position: relative; }
.section-tight { padding-block: clamp(44px, 6vw, 84px); }
.section-alt { background: var(--bg-2); }
.center { text-align: center; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-family: var(--font-mono);
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--accent);
    text-transform: uppercase;
}
.eyebrow::before {
    content: "";
    width: 22px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}
.center .eyebrow { justify-content: center; }

.section-head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 64px); }
.center .section-head { margin-inline: auto; }
.section-head h2 { font-size: var(--fs-h2); }
.lead {
    margin-top: 18px;
    max-width: var(--text-max);
    font-size: var(--fs-lead);
    color: var(--ink-2);
}
.muted { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Navigation — sticky, CSS-only mobile drawer
   -------------------------------------------------------------------------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(150%) blur(14px);
    -webkit-backdrop-filter: saturate(150%) blur(14px);
    border-bottom: 1px solid var(--line);
}
.nav > .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 68px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.brand:hover { color: var(--ink); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--grad-soft);
    color: #fff;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: .95rem;
    flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 1rem; }
.brand-sub {
    font-family: var(--font-mono);
    font-size: .68rem;
    font-weight: 400;
    letter-spacing: .04em;
    color: var(--ink-3);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.nav-links a {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: .95rem;
    font-weight: 500;
    transition: color .18s var(--ease), background-color .18s var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--surface); }
.nav-links a.active { color: var(--ink); }
.nav-cta {
    margin-left: 8px;
    background: var(--grad-soft);
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 6px 18px rgba(109,94,255,.35);
}
.nav-cta:hover { filter: brightness(1.08) saturate(1.1); background: var(--grad-soft); }

.nav-toggle { display: none; }
.nav-burger { display: none; }

@media (max-width: 820px) {
    .nav-burger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px; height: 44px;
        padding: 10px;
        border: 1px solid var(--line-2);
        border-radius: var(--radius-sm);
        background: var(--surface);
        cursor: pointer;
    }
    .nav-burger span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--ink);
        border-radius: 2px;
        transition: transform .25s var(--ease), opacity .2s var(--ease);
    }
    .nav-links {
        position: fixed;
        inset: 68px 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 16px var(--gutter) 24px;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-lg);
        transform: translateY(-12px);
        opacity: 0;
        pointer-events: none;
        transition: transform .28s var(--ease), opacity .22s var(--ease);
    }
    .nav-links a { padding: 13px 12px; font-size: 1.05rem; }
    .nav-cta { margin-left: 0; margin-top: 8px; justify-content: center; }
    .nav-toggle:checked ~ .nav-links {
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }
    .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
    .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .98rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: transform .2s var(--ease), background-color .2s var(--ease),
                border-color .2s var(--ease), color .2s var(--ease), filter .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn i, .btn svg { width: 18px; height: 18px; flex: none; }

.btn-accent {
    background: var(--grad);
    background-size: 140% 140%;
    color: #fff;
    box-shadow: 0 8px 24px rgba(109,94,255,.38);
}
.btn-accent:hover { color: #fff; filter: brightness(1.08) saturate(1.12); box-shadow: 0 10px 30px rgba(198,81,255,.42); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--line-2);
    color: var(--ink);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); background: var(--surface-2); }

.btn-lg { padding: 16px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    color: var(--accent);
}
.text-link i, .text-link svg { width: 17px; height: 17px; transition: transform .2s var(--ease); }
.text-link:hover i, .text-link:hover svg { transform: translateX(3px); }

/* Mono chip / tag */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--ink-2);
}
.chip i, .chip svg { width: 14px; height: 14px; color: var(--accent); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    padding-block: clamp(64px, 9vw, 128px) clamp(56px, 8vw, 104px);
    overflow: hidden;
    isolation: isolate;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    gap: clamp(36px, 5vw, 72px);
    align-items: center;
}
@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; gap: 44px; }
}
.hero h1 {
    font-size: var(--fs-display);
    letter-spacing: -0.04em;
}
.hero h1 .accent {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero .lead { margin-top: 24px; }
.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}
@media (max-width: 460px) {
    .hero-cta { flex-direction: column; align-items: stretch; }
    .hero-cta .btn { width: 100%; }
}
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
    list-style: none;
    padding-left: 0;
}
.hero-meta li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    color: var(--ink-2);
}
.hero-meta i, .hero-meta svg { width: 17px; height: 17px; color: var(--accent); flex: none; }

/* Hero portrait — framed photo with a vibrant gradient glow + floating badge */
.hero-portrait {
    position: relative;
    justify-self: center;
    width: min(100%, 420px);
    isolation: isolate;
}
.hero-portrait::before {
    content: "";
    position: absolute;
    inset: -14% -12% -10% -12%;
    z-index: -1;
    border-radius: 40% 42% 44% 40%;
    background: var(--grad);
    filter: blur(46px);
    opacity: .55;
}
.hero-portrait-frame {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 6px;
    background: var(--grad);
    box-shadow: var(--shadow-lg);
}
.hero-portrait-frame img {
    width: 100%;
    border-radius: calc(var(--radius-lg) - 6px);
    aspect-ratio: 4 / 5;
    object-fit: cover;
    display: block;
}
/* Graceful placeholder when no photo is set yet */
.hero-portrait-frame .portrait-empty {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    border-radius: calc(var(--radius-lg) - 6px);
    background: var(--surface);
    color: var(--ink-3);
    font-family: var(--font-mono);
    font-size: .85rem;
    text-align: center;
    padding: 20px;
}
.hero-badge {
    position: absolute;
    left: -18px;
    bottom: 26px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 16px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow);
    font-size: .86rem;
    font-weight: 600;
    color: var(--ink);
}
.hero-badge .dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #29E36A;
    box-shadow: 0 0 0 4px rgba(41,227,106,.22);
    flex: none;
}
@media (max-width: 460px) { .hero-badge { left: 8px; } }

/* Terminal-style code card in the hero */
.code-card {
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.code-card-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.code-card-bar .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--line-2); }
.code-card-bar .dot:nth-child(1) { background: #FF5F57; }
.code-card-bar .dot:nth-child(2) { background: #FEBC2E; }
.code-card-bar .dot:nth-child(3) { background: #28C840; }
.code-card-bar .file {
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--ink-3);
}
.code-card pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: .86rem;
    line-height: 1.7;
    color: var(--ink);
}
.code-card .tok-key { color: var(--accent); }
.code-card .tok-str { color: var(--mint); }
.code-card .tok-fn  { color: var(--accent-2); }
.code-card .tok-com { color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Cards / services / features grid
   -------------------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: clamp(16px, 2vw, 24px);
}
.card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: clamp(24px, 3vw, 32px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.card-icon {
    display: grid;
    place-items: center;
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--grad-soft);
    color: #fff;
    margin-bottom: 4px;
    box-shadow: 0 6px 18px rgba(109,94,255,.30);
}
.card-icon i, .card-icon svg { width: 24px; height: 24px; }
.card h3 { font-size: var(--fs-h3); }
.card p { color: var(--ink-2); font-size: .97rem; }
.card-list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 9px;
}
.card-list li {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: .93rem;
    color: var(--ink-2);
}
.card-list i, .card-list svg { width: 17px; height: 17px; color: var(--accent); flex: none; margin-top: 3px; }

/* --------------------------------------------------------------------------
   Work / selected projects
   -------------------------------------------------------------------------- */
.work-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: clamp(18px, 2.2vw, 28px);
}
.work-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.work-card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.work-media {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    position: relative;
    overflow: hidden;
}
.work-media img { width: 100%; height: 100%; object-fit: cover; }
.work-body { padding: 22px 24px 26px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.work-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.work-body h3 { font-size: 1.2rem; }
.work-body p { color: var(--ink-2); font-size: .95rem; flex: 1; }

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.stat {
    background: var(--surface);
    padding: clamp(24px, 3vw, 34px);
    text-align: center;
}
.stat-value {
    font-size: clamp(2.1rem, 3.5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.stat-label { margin-top: 6px; font-size: .9rem; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Split / about
   -------------------------------------------------------------------------- */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 40px; } }
.split-figure {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
    aspect-ratio: 4 / 5;
}
.split-figure img { width: 100%; height: 100%; object-fit: cover; }
.prose-inline p + p { margin-top: 16px; }
.prose-inline p { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   CTA band
   -------------------------------------------------------------------------- */
.cta {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: clamp(40px, 6vw, 76px);
    background:
        radial-gradient(70% 130% at 82% -10%, rgba(255,92,168,.55), transparent 55%),
        radial-gradient(60% 120% at 12% 110%, rgba(34,211,238,.35), transparent 55%),
        var(--grad);
    color: #fff;
    text-align: center;
    isolation: isolate;
}
.cta h2 { color: #fff; font-size: var(--fs-h2); }
.cta p { color: rgba(255,255,255,.88); max-width: 56ch; margin: 16px auto 0; }
.cta .hero-cta { justify-content: center; margin-top: 30px; }
.cta .btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.32); color: #fff; }
.cta .btn-ghost:hover { background: rgba(255,255,255,.2); color: #fff; border-color: #fff; }
.cta .btn-accent { background: #fff; color: var(--accent-strong); box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.cta .btn-accent:hover { color: var(--accent-strong); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-2);
    padding-block: clamp(48px, 6vw, 76px) 32px;
    color: var(--ink-2);
    font-size: .95rem;
}
.footer-top {
    display: grid;
    grid-template-columns: minmax(min(100%, 260px), 1.4fr) repeat(auto-fit, minmax(min(100%, 160px), 1fr));
    gap: clamp(30px, 4vw, 54px);
    padding-bottom: 40px;
    border-bottom: 1px solid var(--line);
}
@media (max-width: 700px) { .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 430px) { .footer-top { grid-template-columns: 1fr; } }
.footer-about { margin-top: 18px; max-width: 42ch; line-height: 1.65; }
.site-footer h4 {
    margin-bottom: 16px;
    font-family: var(--font-mono);
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--ink); }
.site-footer a, .footer-about, .footer-contact span { overflow-wrap: anywhere; }
.footer-contact { display: flex; gap: 9px; align-items: flex-start; }
.footer-contact a, .footer-contact span { min-width: 0; }
.footer-contact i, .footer-contact svg { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 4px; }
.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    font-size: .87rem;
    color: var(--ink-3);
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* --------------------------------------------------------------------------
   Page header (generic content + article hero)
   -------------------------------------------------------------------------- */
.page-hero {
    position: relative;
    padding-block: clamp(52px, 7vw, 96px) clamp(32px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    isolation: isolate;
}
.page-hero.has-bg { color: #fff; }
.page-hero.has-bg::before {
    content: "";
    position: absolute; inset: 0; z-index: -2;
    background-size: cover; background-position: center;
    background-image: var(--hero-bg);
}
.page-hero.has-bg::after {
    content: "";
    position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(180deg, rgba(11,13,19,.55), rgba(11,13,19,.85));
}
.page-hero.has-bg h1, .page-hero.has-bg .page-hero-sub { color: #fff; }
.page-hero h1 { font-size: var(--fs-h1); }
.page-hero-sub { margin-top: 14px; font-size: var(--fs-lead); color: var(--ink-2); max-width: var(--text-max); }

/* --------------------------------------------------------------------------
   Blog hero — a single band echoing the website hero (vibrant, not identical)
   -------------------------------------------------------------------------- */
.blog-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    isolation: isolate;
    min-height: clamp(320px, 40vw, 460px);
    padding-block: clamp(72px, 10vw, 128px);
    border-bottom: 1px solid var(--line);
}
/* Localised vibrant glow so the band feels alive like the homepage hero. */
.blog-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(50% 80% at 82% 0%, rgba(198,81,255,.30) 0%, transparent 60%),
        radial-gradient(46% 80% at 10% 4%, rgba(109,94,255,.30) 0%, transparent 60%),
        radial-gradient(40% 70% at 55% 120%, rgba(34,211,238,.12) 0%, transparent 60%);
}
/* Thin gradient hairline along the bottom edge. */
.blog-hero::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--grad);
    opacity: .9;
}
.blog-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    letter-spacing: -0.035em;
}
.blog-hero .accent {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.blog-hero .page-hero-sub { margin-top: 16px; max-width: 52ch; }

/* --------------------------------------------------------------------------
   Blog — layout, article list, article, sidebar
   -------------------------------------------------------------------------- */
.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(260px, 26%, 320px);
    gap: clamp(28px, 4vw, 56px);
    align-items: start;
    padding-block: clamp(40px, 5vw, 72px);
}
@media (max-width: 900px) { .blog-layout { grid-template-columns: 1fr; } }

.article-list { display: grid; gap: 22px; }
.list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.list-head h2 { font-size: 1.4rem; }

.post-card {
    display: block;
    padding: clamp(20px, 2.4vw, 28px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .22s var(--ease), transform .22s var(--ease), box-shadow .22s var(--ease);
}
.post-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.post-card h3 { font-size: 1.3rem; margin-bottom: 8px; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); }
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-family: var(--font-mono);
    font-size: .78rem;
    color: var(--ink-3);
}
.post-summary { margin-top: 12px; color: var(--ink-2); }

/* Featured (hero post) */
.post-feature {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 4vw, 44px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line-2);
    background:
        radial-gradient(70% 120% at 85% 0%, rgba(165,107,255,.18), transparent 60%),
        var(--surface);
    margin-bottom: 26px;
}
.post-feature .tagrow { margin: 14px 0; }
.post-feature h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.post-feature p { color: var(--ink-2); margin-top: 12px; max-width: 60ch; }
.feature-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

/* Tags */
.tagrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: .74rem;
    font-weight: 500;
}
.tag:hover { color: var(--accent-ink); background: var(--accent); }

/* Pagination */
.pagination {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}
.pagination .btn.is-disabled { opacity: .4; pointer-events: none; }

/* Sidebar */
.blog-side { position: sticky; top: 92px; display: grid; gap: 22px; }
.side-card {
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.side-card h4 {
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: .76rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.side-card ul, .side-card ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.side-card p { color: var(--ink-2); font-size: .95rem; }
.side-card a { color: var(--ink-2); }
.side-card a:hover { color: var(--accent); }

/* Article */
.article { max-width: 760px; margin-inline: auto; padding-block: clamp(32px, 4vw, 56px); }
.article-header { margin-bottom: 32px; }
.article-header h1 { font-size: var(--fs-h1); }
.article-header .post-meta { margin-top: 16px; font-size: .82rem; }
.article-header .tagrow { margin-top: 16px; }
.article-summary {
    margin-top: 20px;
    padding-left: 18px;
    border-left: 3px solid var(--accent);
    font-size: var(--fs-lead);
    color: var(--ink-2);
}

/* Long-form prose (block-grid rich text output + markdown) */
.prose { color: var(--ink); font-size: 1.06rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.7rem; margin-top: 2em; }
.prose h3 { font-size: 1.32rem; margin-top: 1.6em; }
.prose p { color: var(--ink); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; display: grid; gap: .5em; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin-block: 1.4em; }
.prose blockquote {
    margin: 1.6em 0;
    padding: 6px 0 6px 20px;
    border-left: 3px solid var(--accent);
    color: var(--ink-2);
    font-style: italic;
}
.prose code {
    font-family: var(--font-mono);
    font-size: .88em;
    padding: .16em .4em;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.prose pre {
    margin-block: 1.5em;
    padding: 18px 20px;
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--line-2);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: .88rem;
    line-height: 1.7;
}
.prose pre code { padding: 0; background: none; border: none; }

/* Content-folder cards */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}
.card-eyebrow {
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   Project page (Steckbrief)
   -------------------------------------------------------------------------- */
.project-hero {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding-block: clamp(48px, 7vw, 96px) clamp(32px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
}
.project-hero::before {
    content: "";
    position: absolute; inset: 0; z-index: -2;
    background:
        radial-gradient(45% 80% at 85% 0%, rgba(198,81,255,.22) 0%, transparent 60%),
        radial-gradient(42% 80% at 8% 4%, rgba(109,94,255,.24) 0%, transparent 60%);
}
.project-hero h1 { font-size: var(--fs-h1); margin-top: 6px; }
.project-hero .lead { margin-top: 14px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
@media (max-width: 460px) { .project-actions { flex-direction: column; align-items: stretch; } .project-actions .btn { width: 100%; } }
.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin: 30px 0 0;
    padding: 22px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
}
.project-meta li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.project-meta .k { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.project-meta .v { font-size: .95rem; color: var(--ink); overflow-wrap: anywhere; }

.project-figure {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line-2);
    box-shadow: var(--shadow-lg);
}
.project-figure img { width: 100%; display: block; }

.project-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(240px, 30%, 320px);
    gap: clamp(28px, 4vw, 52px);
    align-items: start;
}
@media (max-width: 860px) { .project-grid { grid-template-columns: 1fr; } }
.project-aside { display: grid; gap: 20px; position: sticky; top: 92px; }
@media (max-width: 860px) { .project-aside { position: static; } }
.project-body > .prose { max-width: none; }

/* --------------------------------------------------------------------------
   Reveal-on-scroll + motion
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
    will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .07s; }
.reveal.d2 { transition-delay: .14s; }
.reveal.d3 { transition-delay: .21s; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
