/* ═══ scroll narrative layer (after portfolio.css) ═══ */
:root {
    --accent: #f2921d;
    --accent-d: #a85f06;
    --accent-w: rgba(242, 146, 29, .16);
    --night: #0c0d0f
}

html {
    scroll-behavior: auto
}

body {
    overflow-x: hidden
}

main {
    position: relative;
    z-index: 2
}

/* ── accent, used sparingly ───────────────────── */
.progress {
    background: var(--accent);
    opacity: .92;
    height: 2px
}

.hero-fig .blockmark {
    background: var(--slate);
    opacity: .5
}

.trap svg {
    stroke: var(--ink-2);
    opacity: .6
}

.wrow-head .idx {
    color: var(--ink-3)
}

.pcard {
    border-top-color: var(--ink)
}

a:hover {
    color: var(--slate)
}

/* ── acts (one screen each) ───────────────────── */
.act {
    position: relative;
    height: 100vh;
    overflow: hidden;
    background: var(--paper)
}

.act::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: linear-gradient(to right, var(--rule-2) 1px, transparent 1px), linear-gradient(to bottom, var(--rule-2) 1px, transparent 1px);
    background-size: 92px 92px;
    -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 20%, transparent 88%);
    mask-image: radial-gradient(120% 90% at 50% 30%, #000 20%, transparent 88%)
}

.act-in {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center
}

.act .sect {
    padding: clamp(40px, 6vh, 74px) 0 clamp(52px, 8vh, 80px)
}

.act .sect+.sect,
.sect+.sect {
    border-top: 0
}

.act .eyebrow {
    margin-bottom: clamp(18px, 3vh, 34px)
}

/* ── covers / transitions ─────────────────────── */
.cover {
    position: absolute;
    inset: 0;
    z-index: 24;
    background: var(--paper);
    overflow: hidden;
    pointer-events: none;
    --gx: 13%;
    --gy: 37%;
    --gh: 26%
}

.cover::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to right, var(--rule-2) 1px, transparent 1px), linear-gradient(to bottom, var(--rule-2) 1px, transparent 1px);
    background-size: 92px 92px
}

.shape {
    position: absolute;
    left: var(--gx);
    right: var(--gx);
    top: var(--gy);
    height: var(--gh);
    z-index: 2;
    --f: 0;
    clip-path: polygon(30% 0%, 100% 0%, 70% 100%, 0% 100%);
    background: linear-gradient(101deg, var(--accent) 0 calc(var(--f)*1%), rgba(242, 146, 29, .06) calc(var(--f)*1%) 100%)
}

.shape-line {
    position: absolute;
    left: var(--gx);
    top: var(--gy);
    width: calc(100% - 2*var(--gx));
    height: var(--gh);
    z-index: 3;
    max-width: none;
    overflow: visible
}

.shape-line path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.2;
    vector-effect: non-scaling-stroke
}

.cover-meta {
    position: absolute;
    z-index: 5;
    left: var(--pad);
    bottom: clamp(60px, 9vh, 96px);
    display: flex;
    flex-direction: column;
    gap: 5px
}

.cover-meta span {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.cover-meta b {
    font-family: var(--mono);
    font-weight: 500;
    font-size: clamp(13px, 1.6vw, 17px);
    letter-spacing: .14em;
    color: var(--accent-d);
    font-variant-numeric: tabular-nums
}

.cover-ttl {
    font-style: normal;
    position: absolute;
    z-index: 5;
    left: var(--pad);
    right: var(--pad);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    font-family: 'Major Mono Display', var(--mono);
    font-weight: 400;
    font-size: clamp(38px, 9vw, 148px);
    line-height: .94;
    letter-spacing: .02em;
    color: #fff;
    text-align: center
}

.cover-ttl b {
    font-weight: 400
}

.cover-ttl i {
    display: block;
    font-style: normal;
    font-weight: 400;
    font-size: clamp(9px, 1.1vw, 13px);
    letter-spacing: .4em;
    margin-bottom: .9em;
    color: rgba(255, 255, 255, .7)
}

/* ── act 02 · ledger ─────────────────────────── */
#built .act-in {
    justify-content: flex-start
}

#built .sect {
    height: 100%;
    padding: clamp(28px, 4.4vh, 54px) 0 0;
    display: flex;
    flex-direction: column;
    min-height: 0
}

#built .wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0
}

.built-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(200px, 24vw, 340px);
    gap: clamp(20px, 3.4vw, 48px)
}

.built-view {
    position: relative;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 4%, #000 78%, transparent 97%);
    mask-image: linear-gradient(180deg, transparent 0, #000 4%, #000 78%, transparent 97%)
}

.built-col {
    position: relative;
    will-change: transform
}

.built-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: clamp(22px, 4.4vw, 66px);
    align-items: end;
    margin-bottom: clamp(18px, 3.2vh, 40px)
}

.built-head .h2 {
    font-size: clamp(28px, 3.9vw, 50px)
}

.built-head .lede {
    margin-top: 16px;
    max-width: 48ch
}

.built-head .fig {
    padding: 18px 58px 32px 30px;
    align-self: end
}

.built-head .fig figcaption {
    left: 30px
}

#built .spec-row {
    grid-template-columns: minmax(130px, 1fr) minmax(110px, .66fr) minmax(0, 1.75fr);
    gap: clamp(12px, 2.2vw, 30px);
    --p: 0
}

#built .spec-row .k {
    transition: color .45s var(--ease)
}

#built .spec-row.on .k {
    color: #000
}

#built .spec-row::before,
#built .spec-row:hover::before {
    background: linear-gradient(90deg, rgba(242, 146, 29, .13), rgba(242, 146, 29, .02));
    transform: scaleX(var(--p));
    transition: none
}

#built .spec-row::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 1.6px;
    width: calc(var(--p)*100%);
    background: var(--accent);
    z-index: 1
}

#built .spec-row:hover .v {
    transform: none
}

#built .grp {
    padding: clamp(18px, 3vh, 34px) 14px 12px
}

.built-side {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: clamp(14px, 2.6vh, 30px);
    min-height: 0;
    padding-bottom: clamp(64px, 10vh, 86px)
}

.built-side .ronin {
    position: static;
    margin-top: auto
}

.built-side .ronin img {
    max-height: clamp(230px, 48vh, 470px);
    width: auto;
    margin-left: auto
}

.built-side .ronin figcaption {
    align-items: flex-end;
    text-align: right
}

/* ── act 03 · technical developer ─────────────── */
.bigtype {
    position: absolute;
    z-index: 0;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-46%);
    text-align: center;
    font-family: var(--mono);
    font-weight: 800;
    font-size: clamp(88px, 23vw, 340px);
    line-height: .8;
    letter-spacing: -.06em;
    color: rgba(242, 146, 29, .13);
    white-space: nowrap;
    pointer-events: none;
    user-select: none
}

.bigtype span {
    -webkit-text-stroke: 1px rgba(242, 146, 29, .22);
    color: transparent
}

#work .wrap {
    position: relative;
    z-index: 2
}

.wdetail-pad .stack span {
    color: var(--ink-3)
}

/* ── act 04 · night / systems ─────────────────── */
.act.dark {
    background: var(--night);
    color: #f4f5f6;
    clip-path: inset(100% 0% 0% 0%)
}

.act.dark::before {
    background-image: linear-gradient(to right, rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .05) 1px, transparent 1px)
}

.act.dark .mono {
    color: rgba(244, 245, 246, .5)
}

.act.dark .eyebrow>.mono:first-child {
    color: rgba(244, 245, 246, .75)
}

.act.dark .eyebrow .dash {
    background: rgba(255, 255, 255, .16)
}

.act.dark .lede {
    color: rgba(244, 245, 246, .62)
}

.act.dark .h2 em {
    color: #fff
}

.lab-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center
}

.lab-stats {
    display: flex;
    gap: clamp(18px, 3vw, 44px);
    margin-top: clamp(20px, 3.4vh, 38px);
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, .14)
}

.lab-stats div {
    display: flex;
    flex-direction: column;
    gap: 3px
}

.lab-stats b {
    font-family: var(--mono);
    font-weight: 500;
    font-size: clamp(16px, 2vw, 24px);
    letter-spacing: -.02em;
    color: #fff;
    font-variant-numeric: tabular-nums
}

.lab-stats span {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(244, 245, 246, .45)
}

.term {
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .03);
    border-radius: 4px;
    overflow: hidden
}

.term-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, .11);
    background: rgba(255, 255, 255, .03)
}

.term-bar s {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2)
}

.term-bar s:first-child {
    background: rgba(242, 146, 29, .8)
}

.term-bar i {
    margin-left: 8px;
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(244, 245, 246, .4);
    font-style: normal
}

.term-body {
    margin: 0;
    padding: 14px 14px 16px;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.95;
    color: rgba(244, 245, 246, .8);
    min-height: clamp(150px, 26vh, 224px);
    white-space: pre-wrap
}

.term-body .p {
    color: var(--accent)
}

.term-body .d {
    color: rgba(244, 245, 246, .4)
}

.term-body .g {
    color: #7fd1a3
}

.caret {
    display: inline-block;
    width: 7px;
    height: 13px;
    vertical-align: -2px;
    background: var(--accent);
    animation: blink 1.1s steps(1) infinite
}

@keyframes blink {

    0%,
    50% {
        opacity: 1
    }

    51%,
    100% {
        opacity: 0
    }
}

.diag {
    width: 100%;
    height: auto;
    margin-top: clamp(14px, 2.4vh, 26px)
}

.diag rect {
    fill: none;
    stroke: rgba(255, 255, 255, .22)
}

.diag text {
    font-family: var(--mono);
    font-size: 8.5px;
    letter-spacing: .14em;
    fill: rgba(244, 245, 246, .62)
}

.diag .lnk {
    fill: none;
    stroke: rgba(242, 146, 29, .75);
    stroke-width: 1.1;
    stroke-dasharray: 5 7;
    animation: flow 1.6s linear infinite
}

.diag .node {
    fill: #fff;
    opacity: .75;
    animation: pulse 2.6s var(--ease) infinite
}

@keyframes flow {
    to {
        stroke-dashoffset: -24
    }
}

@keyframes pulse {

    0%,
    100% {
        r: 2.6;
        opacity: .55
    }

    50% {
        r: 4.4;
        opacity: 1
    }
}

.paused .diag .lnk,
.paused .diag .node,
.paused .caret {
    animation-play-state: paused
}

/* ── act 05 · words + say hi ─────────────────── */
#words .sect {
    padding-bottom: clamp(120px, 19vh, 168px)
}

#words .postcards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(16px, 2.6vw, 34px)
}

#words .pcard {
    padding: 12px 2px 14px;
    gap: 10px
}

#words .pcard-ttl {
    font-size: clamp(16px, 1.75vw, 23px)
}

#words .pcard p {
    font-size: 12px;
    line-height: 1.72;
    max-width: 30ch
}

.pcard.ghost {
    border-top-style: dashed;
    border-top-color: var(--ink-3);
    opacity: .7
}

.pcard.ghost .mono-note {
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.95;
    color: var(--ink-3)
}

.hi-block {
    margin-top: clamp(22px, 3.6vh, 44px);
    padding-top: clamp(16px, 2.8vh, 32px);
    border-top: 1px solid var(--rule)
}

#words .hi-grid {
    align-items: end;
    gap: clamp(26px, 5vw, 64px)
}

#words .mail {
    font-size: clamp(27px, 4.4vw, 56px)
}

#words .lede {
    margin-top: 12px;
    font-size: 13.6px;
    max-width: 44ch
}

#words .socials a {
    padding: 8px 2px;
    font-size: 11.5px
}

.words-cut {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: clamp(16px, 2.6vh, 30px)
}

.words-cut i {
    flex: 1;
    height: 1px;
    background: var(--rule)
}

.words-cut b {
    font-family: var(--mono);
    font-weight: 500;
    font-size: 10px;
    letter-spacing: .26em;
    text-transform: uppercase;
    color: var(--ink-3)
}

.foot-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px var(--pad) 78px;
    border-top: 1px solid var(--rule)
}

.foot-bar .mono.b {
    color: var(--ink-2);
    letter-spacing: .2em
}

/* ── liquid portrait (grey → colour under cursor) */
.hero-fig .slot {
    position: relative;
    aspect-ratio: 4/5;
    overflow: visible;
    --dis: radial-gradient(ellipse 66% 62% at 52% 46%, #000 42%, rgba(0, 0, 0, .55) 68%, transparent 88%);
    --bx: 52%;
    --by: 46%;
    --rx: 0%;
    --ry: 0%
}

.hero-fig .portrait {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 52% 46%;
    transform: scale(1.3);
    transform-origin: 52% 46%;
    mix-blend-mode: multiply;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-composite: source-in;
    mask-composite: intersect
}

.hero-fig .portrait.gray {
    filter: grayscale(1) contrast(1.05);
    -webkit-mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--bx) var(--by), transparent 36%, rgba(0, 0, 0, .45) 62%, #000 88%), var(--dis);
    mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--bx) var(--by), transparent 36%, rgba(0, 0, 0, .45) 62%, #000 88%), var(--dis)
}

.hero-fig .portrait.color {
    -webkit-mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--bx) var(--by), #000 36%, rgba(0, 0, 0, .55) 62%, transparent 88%), var(--dis);
    mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--bx) var(--by), #000 36%, rgba(0, 0, 0, .55) 62%, transparent 88%), var(--dis)
}

@media (hover:none) {
    .hero-fig .portrait.gray {
        display: none
    }

    .hero-fig .portrait.color {
        -webkit-mask-image: var(--dis);
        mask-image: var(--dis);
        -webkit-mask-composite: source-over;
        mask-composite: add
    }
}

/* ── scroll cue ───────────────────────────────── */
.cue {
    position: fixed;
    right: var(--pad);
    bottom: 30px;
    z-index: 52;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--ink-3);
    transition: opacity .7s var(--ease)
}

.cue i {
    display: block;
    width: 1px;
    height: 22px;
    background: linear-gradient(var(--accent), transparent);
    animation: drip 2.4s var(--ease) infinite
}

@keyframes drip {

    0%,
    100% {
        transform: scaleY(.4);
        transform-origin: 50% 0;
        opacity: .4
    }

    45% {
        transform: scaleY(1);
        opacity: 1
    }
}

@media (max-width:900px) {
    .cue {
        display: none
    }
}

@media (max-height:700px) {
    .built-head {
        grid-template-columns: 1fr
    }

    .built-head .fig {
        display: none
    }

    .lab-stats {
        margin-top: 16px
    }
}

@media (max-width:900px) {
    .act {
        height: auto;
        min-height: 100vh;
        overflow: visible
    }

    .act-in {
        position: static
    }

    .built-body,
    .lab-grid {
        grid-template-columns: 1fr
    }

    .built-head {
        grid-template-columns: 1fr
    }

    .built-side {
        display: none
    }

    .built-view {
        overflow: visible;
        -webkit-mask-image: none;
        mask-image: none
    }

    #words .postcards {
        grid-template-columns: 1fr
    }

    .foot-bar {
        position: static;
        padding: 14px 0 26px;
        flex-wrap: wrap
    }

    .bigtype {
        font-size: clamp(64px, 26vw, 150px)
    }

    .caps-cover li u {
        display: none
    }
}

.flat .act.dark {
    clip-path: none
}

.flat #built .spec-row {
    opacity: 1;
    --p: 1
}

@media (prefers-reduced-motion:reduce) {
    #built .spec-row {
        opacity: 1;
        --p: 1
    }

    .act.dark {
        clip-path: none
    }
}