/* ===== BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

:root {
    --bg: #ffffff;
    --ink: #0a2540;
    --muted: #5b6b7f;
    --accent: #ff5722;
    --line: #e8ecf1;
    --deco: #cfd6de;
    --teal: #14b8c4;
    --deco-rest: 0;
    --deco-hover: 100px;
}

body {
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
    line-height: 1.7;
}

body.intro-lock {
    overflow: hidden;
    height: 100vh;
}

/* ===== PERSISTENT IDENTITY BAR (always solid white) ===== */
#id-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
    background: #ffffff;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

#id-bar.shown {
    opacity: 1;
}

#id-bar .id-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 2rem;
    text-align: center;
}

#id-bar .id-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-transform: none;
    margin: 0;
    line-height: 1.2;
}

#id-bar .id-role {
    font-size: 1.2rem;
    color: var(--muted);
    margin: 0;
}

#id-bar .id-typed {
    font-size: 1rem;
    color: var(--muted);
    min-height: 1.4em;
    margin: 0;
}

#id-bar .id-typed::after {
    content: "_";
    color: var(--accent);
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

/* ===== INTRO OVERLAY ===== */
#intro {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    overflow: hidden;
    transition: opacity 0.6s ease;
}

#intro.is-exiting {
    opacity: 0;
    pointer-events: none;
}

#intro-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#intro-words {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    z-index: 2;
    pointer-events: none;
}

.intro-word {
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--ink);
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.85);
    transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s ease;
}

.intro-word.sharp {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1.1);
}

.intro-word.blurred {
    opacity: 0.18;
    filter: blur(3px);
    transform: scale(0.9);
}

/* ===== HEX BULLET (orange hexagon before headings) ===== */
.hex::before {
    content: "";
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin-right: 0.45em;
    vertical-align: -0.06em;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><polygon points="6,2 18,2 23,12 18,22 6,22 1,12" fill="none" stroke="%23ff5722" stroke-width="2.4"/></svg>') no-repeat center / contain;
}

/* ===== DECO LINE (draws in on reveal, slides out on hover) ===== */
.deco-line {
    display: block;
    width: 0;
    height: 2px;
    background: var(--deco);
    margin-bottom: 1rem;
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s,
        background-color 0.4s ease;
}

.reveal-blur.shown .deco-line {
    width: var(--deco-rest);
}

.block:hover .deco-line {
    width: var(--deco-hover);
    background: var(--accent);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.4s ease;
}

/* ===== REVEAL (blur-in) ===== */
.reveal-blur {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(14px);
    transition: opacity 0.8s ease, filter 0.8s ease, transform 0.8s ease;
}

.reveal-blur.shown {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

/* ===== SCREEN 1 ===== */
#hero {
    position: relative;
    height: 100vh;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
}

/* full-bleed particle canvas, behind everything */
#hero-canvas-container {
    position: absolute;
    inset: 0;
    z-index: 0;
    transform-origin: center 35%;
    will-change: transform, opacity;
}

#cube-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.hero-grid {
    position: relative;
    z-index: 1;
    pointer-events: none;
    /* clicks fall through to the canvas (morph to face) */
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 3rem 3.5rem;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "credo    contact"
        "identity right";
    column-gap: 3.5rem;
    row-gap: 2rem;
    transform-origin: center 35%;
    will-change: transform, opacity, filter;
}

/* re-enable interaction/selection on the actual content */
#hero .block {
    pointer-events: auto;
}

.col-left {
    grid-area: identity;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    min-width: 0;
    padding-left: 3rem;
    max-width: 46rem;
}

/* ===== HERO CREDO (top-left brand line) ===== */
.hero-credo {
    grid-area: credo;
    align-self: start;
    margin: 0;
    font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    line-height: 2;
    color: var(--ink);
    pointer-events: auto;
}

/* ===== HERO CONTACT (top-right — mono, mirrors the credo) ===== */
.hero-contact {
    grid-area: contact;
    align-self: start;
    justify-self: end;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.6rem;
    margin-right: 1.5rem;
    /* reserve space for the right rail */
    pointer-events: auto;
}

.contact-links {
    display: flex;
    gap: 1.75rem;
}

.hero-contact a {
    position: relative;
    font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink);
    border-bottom: none;
    padding-bottom: 0;
}

/* thin line that draws in just above the hovered word */
.hero-contact a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -0.7em;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-contact a:hover {
    color: var(--accent);
    border-color: transparent;
}

.hero-contact a:hover::after {
    transform: scaleX(1);
}

/* ===== RIGHT-EDGE CONTACT RAIL (vertical caption) ===== */
.contact-rail {
    position: absolute;
    top: 0;
    right: 1.4rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    pointer-events: none;
    z-index: 6;
}

.rail-line {
    width: 1px;
    height: 0;
    background: var(--accent);
    transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.contact-rail.show .rail-line {
    height: 110px;
}

.rail-text {
    writing-mode: vertical-rl;
    font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, monospace;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    opacity: 0;
    transform: rotate(180deg) translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.contact-rail.show .rail-text {
    opacity: 1;
    transform: rotate(180deg) translateY(0);
}

/* ===== "CURRENTLY WORKING WITH" — scannable list (hex markers tie to the motif) ===== */
.now-list {
    list-style: none;
    margin-top: 0.5rem;
}

.now-list li {
    position: relative;
    padding-left: 1.3rem;
    margin-bottom: 0.35rem;
    color: var(--muted);
    line-height: 1.55;
}

.now-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background: var(--teal);
    transition: background-color 0.25s ease;
}

.now-list li:hover::before {
    background: var(--accent);
}

/* ===== TYPOGRAPHY ===== */
h1 {
    font-size: 2.3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.role {
    font-size: 1.25rem;
    color: var(--muted);
    font-weight: 400;
}

#typed {
    font-size: 1rem;
    color: var(--muted);
    min-height: 1.7em;
    margin-top: 0.4rem;
}

#typed::after {
    content: "_";
    color: var(--accent);
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

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

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
    margin-bottom: 1rem;
}

h3 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 0.8rem;
}

.block p {
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.block p:last-child {
    margin-bottom: 0;
}

.exp-list {
    list-style: none;
    margin: 0.2rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.exp-list li {
    position: relative;
    padding-left: 1.4rem;
    color: var(--muted);
    line-height: 1.55;
}

.exp-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background: var(--teal);
    transition: background-color 0.25s ease;
}

.exp-list li:hover::before {
    background: var(--accent);
}

/* ===== SCROLL ARROW ===== */
.scroll-arrow {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    width: 20px;
    height: 20px;
    border-left: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: translateX(-50%) rotate(-45deg);
    opacity: 0.7;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

/* ===== SCREEN 2 (scroll) ===== */
#lower {
    padding-top: 4.5rem;
    padding-bottom: 2.5rem;
    padding-left: 2rem;
    padding-right: 2rem;
    background-color: var(--bg);
    transition: background-color 0.9s ease;
}

#lower h2,
#lower p,
#lower .proc-label,
#lower .proc-tree-title,
#lower .domain-tags span,
#lower a {
    transition: color 0.9s ease, background-color 0.9s ease, border-color 0.9s ease;
}

#lower .deco-line {
    transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s,
        background-color 0.9s ease;
}

#lower .block:hover .deco-line {
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.4s ease;
}

/* ===== PROCESS STRIP (How I work pipeline) ===== */
.proc-hint {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0;
}

.process-strip {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-top: 1.5rem;
}

.process-strip::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--teal);
    opacity: 0.5;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.reveal-blur.shown .process-strip::before {
    transform: scaleX(1);
}

.process-strip::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(var(--fill, 0));
    transform-origin: left center;
    transition: transform var(--run-dur, 0.5s) ease;
}

.proc-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    outline: none;
}

.proc-step:focus-visible .proc-node {
    box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.35);
}

.proc-node {
    width: 14px;
    height: 14px;
    background: var(--teal);
    border-radius: 50%;
    position: relative;
    z-index: 1;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        background-color 0.25s ease;
}

.reveal-blur.shown .proc-node {
    opacity: 1;
    transform: scale(1);
}

.reveal-blur.shown .proc-step:nth-child(1) .proc-node {
    transition-delay: 0.20s;
}

.reveal-blur.shown .proc-step:nth-child(2) .proc-node {
    transition-delay: 0.32s;
}

.reveal-blur.shown .proc-step:nth-child(3) .proc-node {
    transition-delay: 0.44s;
}

.reveal-blur.shown .proc-step:nth-child(4) .proc-node {
    transition-delay: 0.56s;
}

.reveal-blur.shown .proc-step:nth-child(5) .proc-node {
    transition-delay: 0.68s;
}

.proc-label {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    color: var(--muted);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.proc-step.filled .proc-node {
    background: var(--accent);
}

.proc-step.active .proc-node {
    background: var(--accent);
    transform: scale(1.25);
    box-shadow: 0 0 0 4px rgba(255, 87, 34, 0.12);
}

.proc-step.active .proc-label {
    color: var(--accent);
}

@media (hover: hover) {
    .proc-step:hover .proc-node {
        transform: scale(1.3);
        background: var(--accent);
    }

    .proc-step:hover .proc-label {
        color: var(--accent);
    }
}

/* ===== PROCESS DETAIL TREE (compact + space reserved so the section never jumps) ===== */
.proc-detail {
    margin-top: 1.4rem;
    min-height: 7.5rem;
}

.proc-tree {
    display: inline-block;
}

.proc-tree-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.25rem;
    opacity: 0;
    transition: opacity 0.4s ease, color 0.6s ease;
}

.proc-tree.show .proc-tree-title {
    opacity: 1;
}

.proc-branches {
    list-style: none;
    position: relative;
    padding-left: 0;
    margin-top: 0.3rem;
}

.proc-branches::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 0.1rem;
    bottom: 0.7rem;
    width: 1px;
    background: var(--teal);
    opacity: 0.5;
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s;
}

.proc-tree.show .proc-branches::before {
    transform: scaleY(1);
}

.proc-branches li {
    position: relative;
    padding-left: 1.15rem;
    margin: 0.2rem 0;
    line-height: 1.3;
    font-size: 0.88rem;
    color: var(--muted);
    white-space: nowrap;
    opacity: 0;
    filter: blur(8px);
    transform: translateX(-6px);
    transition: opacity 0.45s ease, filter 0.45s ease, transform 0.45s ease, color 0.6s ease;
    transition-delay: calc(var(--i) * 0.13s + 0.12s);
}

.proc-branches li::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 0.72em;
    width: 0.72rem;
    height: 1px;
    background: var(--teal);
    opacity: 0.5;
}

.proc-tree.show .proc-branches li {
    opacity: 1;
    filter: blur(0);
    transform: none;
}

/* ===== INVERSION: dark while the section is in focus ===== */
#lower.dark {
    background-color: var(--ink);
}

#lower.dark h2 {
    color: #ffffff;
}

#lower.dark p {
    color: rgba(255, 255, 255, 0.72);
}

#lower.dark .exp-list li {
    color: rgba(255, 255, 255, 0.72);
}

.site-footer {
    margin-top: 0;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
}

.site-footer .footer-name {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    letter-spacing: 0.01em;
    margin: 0 0 0.3rem;
}

.site-footer .footer-rights {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.02em;
    margin: 0;
}

#lower.dark .proc-label {
    color: rgba(255, 255, 255, 0.7);
}

#lower.dark .proc-branches li {
    color: rgba(255, 255, 255, 0.72);
}

#lower.dark .deco-line {
    background: rgba(255, 255, 255, 0.35);
}

#lower.dark .block:hover .deco-line {
    background: var(--accent);
}

#lower.dark .proc-step.active .proc-label {
    color: var(--accent);
}

@media (hover: hover) {
    #lower.dark .proc-step:hover .proc-label {
        color: var(--accent);
    }
}

#lower.dark .domain-tags span {
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.75);
}

#lower.dark a {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

#lower.dark a:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.lower-grid {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.domain-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.4rem;
}

.domain-tags span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.9rem;
    color: var(--muted);
}

.domain-tags span:hover {
    color: var(--accent);
    border-color: var(--accent);
    cursor: pointer;
}

#lower.dark .domain-tags span:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ===== LINKS ===== */
a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {

    /* ---- TUNABLE: portrait band on mobile ---- */
    /* --band-top: where the portrait band starts (raise/lower the whole portrait) */
    /* --band-h:   portrait band height (smaller = less empty space, lifts About/Currently) */
    :root {
        --band-top: 9rem;
        --band-h: 45vh;
    }

    #hero {
        height: auto;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "credo"
            "contact"
            "portrait"
            "identity";
        grid-template-rows: 3.2rem 1.6rem var(--band-h) auto;
        column-gap: 0;
        row-gap: 1.1rem;
        padding: 1.75rem 1.5rem 1.5rem;
        align-content: start;
    }

    /* confine the 3D portrait to a centered band; text flows above and below it */
    #hero-canvas-container {
        top: var(--band-top);
        height: var(--band-h);
        bottom: auto;
    }

    /* center the top cluster (credo + contacts) on mobile */
    .hero-credo {
        text-align: center;
    }

    .hero-contact {
        justify-self: center;
        align-items: center;
        margin-right: 0;
    }

    .col-left {
        grid-area: identity;
        justify-content: flex-start;
        padding-left: 0;
        max-width: none;
        gap: 1.5rem;
    }

    h1 {
        font-size: 2.4rem;
    }

    /* right-edge hover rail is a desktop-only affordance */
    .contact-rail {
        display: none;
    }

    #lower {
        padding-top: 3rem;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 600px) {
    .hero-grid {
        padding: 3rem 1.25rem;
    }

    h1 {
        font-size: 2rem;
    }

    .role {
        font-size: 1.1rem;
    }

    .contact-links {
        gap: 1.25rem;
    }

    #lower {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .domain-tags {
        gap: 0.45rem;
    }

    .domain-tags span {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }

    /* keep the pipeline horizontal but let long labels wrap instead of overflowing */
    .process-strip {
        gap: 0.4rem;
    }

    .proc-label {
        margin-top: 0.5rem;
        font-size: 0.62rem;
        line-height: 1.2;
        letter-spacing: 0;
        white-space: normal;
        text-align: center;
    }

    .proc-detail {
        margin-top: 1.1rem;
        min-height: 7.5rem;
    }

    .proc-tree-title {
        font-size: 0.72rem;
    }

    #id-bar .id-inner {
        padding: 0.8rem 1.25rem;
    }

    #id-bar .id-name {
        font-size: 1.25rem;
    }

    #id-bar .id-role {
        font-size: 1rem;
    }
}

@media (max-width: 380px) {
    .process-strip {
        gap: 0.25rem;
    }

    .proc-label {
        font-size: 0.56rem;
    }

    .hero-credo {
        font-size: 0.72rem;
        letter-spacing: 0.16em;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    #typed::after {
        animation: none;
    }

    .reveal-blur {
        opacity: 1;
        filter: none;
        transform: none;
    }

    .deco-line {
        transition: none;
    }

    .proc-node {
        opacity: 1;
        transform: none;
    }

    .process-strip::before {
        transform: scaleX(1);
    }

    .process-strip::after {
        transition: none;
    }

    .proc-branches li {
        opacity: 1;
        filter: none;
        transform: none;
    }

    .proc-branches::before {
        transform: scaleY(1);
    }
}