/* ============ LOADER ============ */
#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: #fafaf9; /* stone-50 */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.loader-bar {
    width: 160px;
    height: 2px;
    background: #e7e5e4; /* stone-200 */
    overflow: hidden;
    border-radius: 999px;
}
.loader-bar-fill {
    height: 100%;
    width: 0%;
    background: #1c1917; /* stone-900 */
    transition: width 0.25s ease;
}

/* ============ NAV ============ */
.cursor-blink {
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}
.lang-btn.active {
    background: #1c1917;
    color: #fafaf9;
}
.desktop-nav {
    display: none;
}
.mobile-nav-button {
    display: flex;
}
.mobile-nav-panel,
.mobile-nav-panel.hidden {
    display: none !important;
}
@media (min-width: 1024px) {
    .desktop-nav {
        display: flex !important;
    }
    .mobile-nav-button,
    #mobile-menu {
        display: none !important;
    }
}
@media (max-width: 1023px) {
    .desktop-nav {
        display: none !important;
    }
    .mobile-nav-panel:not(.hidden) {
        display: flex !important;
    }
}
@media (max-width: 767px) {
    nav {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background: rgba(250, 250, 249, 0.97) !important;
    }
    body.zb-mode nav {
        background: rgba(12, 10, 9, 0.97) !important;
    }
}

/* ============ HERO BACKGROUND ============ */
/* real grid of separate cells - they physically displace around
   the cursor (see main.js applyField) */
#hero-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, 28px);
    grid-auto-rows: 28px;
    overflow: hidden;
    pointer-events: none;
}
.grid-cell {
    border: 0.5px solid rgba(28, 25, 23, 0.055);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: auto;
}
body.zb-mode .grid-cell {
    border-color: rgba(250, 250, 249, 0.06);
}
.grid-click-cue {
    --cue-accent: #0f766e;
    --cue-bg: #fef3c7;
    position: absolute;
    left: min(58vw, calc(100% - 13.5rem));
    top: clamp(12.5rem, 35vh, 19rem);
    z-index: 9;
    width: 168px;
    height: 124px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    animation: grid-cue-enter 0.55s ease 2.45s forwards;
}
.grid-click-cue.is-hidden {
    opacity: 0 !important;
    transform: translateY(4px) scale(0.96);
    animation: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.grid-click-cue-cell {
    position: absolute;
    left: 22px;
    top: 38px;
    width: 56px;
    height: 56px;
    border: 1.5px solid color-mix(in srgb, var(--cue-accent) 48%, transparent);
    border-radius: 7px;
    background:
        linear-gradient(to right, rgba(15, 118, 110, 0.11) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15, 118, 110, 0.11) 1px, transparent 1px),
        rgba(255, 255, 255, 0.48);
    background-size: 14px 14px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.58) inset,
        0 16px 30px -22px rgba(15, 118, 110, 0.9);
    animation: grid-cue-cell 2.8s ease-in-out 2.45s infinite;
}
.grid-click-cue-cell::before {
    content: "";
    position: absolute;
    inset: -9px;
    border: 1px solid color-mix(in srgb, var(--cue-accent) 34%, transparent);
    border-radius: 12px;
    opacity: 0;
    transform: scale(0.72);
    animation: grid-cue-ripple 2.8s ease-in-out 2.45s infinite;
}
.grid-click-cue-note {
    position: absolute;
    left: 74px;
    top: 26px;
    width: 70px;
    height: 58px;
    padding: 15px 11px 9px;
    border: 1px solid color-mix(in srgb, var(--cue-accent) 18%, rgba(28, 25, 23, 0.1));
    border-radius: 7px;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--cue-accent) 10%, transparent), transparent 52%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.75), transparent 48%),
        var(--cue-bg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.82) inset,
        0 18px 28px -20px rgba(28, 25, 23, 0.55);
    opacity: 0;
    transform: translate(-22px, 18px) rotate(-4deg) scale(0.68);
    transform-origin: 16px 18px;
    animation: grid-cue-note 2.8s cubic-bezier(0.22, 1, 0.36, 1) 2.45s infinite;
}
.grid-click-cue-note::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -7px;
    width: 34px;
    height: 11px;
    transform: translateX(-50%) rotate(-3deg);
    border: 1px solid rgba(255, 255, 255, 0.44);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.45), transparent 34% 66%, rgba(255, 255, 255, 0.32)),
        rgba(245, 158, 11, 0.28);
}
.grid-click-cue-note span {
    display: block;
    height: 5px;
    margin-top: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cue-accent) 46%, transparent);
}
.grid-click-cue-note span:first-child {
    width: 72%;
    margin-top: 0;
}
.grid-click-cue-note span:last-child {
    width: 52%;
}
.grid-click-cue-cursor {
    position: absolute;
    left: 10px;
    top: 78px;
    z-index: 2;
    width: 25px;
    height: 32px;
    background: #1c1917;
    clip-path: polygon(0 0, 0 29px, 8px 22px, 13px 32px, 18px 30px, 13px 21px, 25px 21px);
    filter: drop-shadow(0 3px 5px rgba(28, 25, 23, 0.22));
    transform: translate(0, 0) rotate(-8deg);
    animation: grid-cue-cursor 2.8s ease-in-out 2.45s infinite;
}
body.zb-mode .grid-click-cue {
    --cue-accent: #fbbf24;
    --cue-bg: #fef3c7;
}
body.zb-mode .grid-click-cue-cell {
    background:
        linear-gradient(to right, rgba(251, 191, 36, 0.13) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(251, 191, 36, 0.13) 1px, transparent 1px),
        rgba(28, 25, 23, 0.34);
}
body.zb-mode .grid-click-cue-cursor {
    background: #fafaf9;
}
@keyframes grid-cue-enter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes grid-cue-cursor {
    0%, 12% {
        transform: translate(0, 0) rotate(-8deg);
    }
    34%, 48% {
        transform: translate(36px, -31px) rotate(-8deg);
    }
    42% {
        transform: translate(36px, -31px) rotate(-8deg) scale(0.88);
    }
    72%, 100% {
        transform: translate(92px, -52px) rotate(-8deg);
        opacity: 0;
    }
}
@keyframes grid-cue-cell {
    0%, 34%, 100% {
        transform: scale(1);
        border-color: color-mix(in srgb, var(--cue-accent) 48%, transparent);
    }
    42%, 52% {
        transform: scale(1.07);
        border-color: color-mix(in srgb, var(--cue-accent) 78%, transparent);
    }
}
@keyframes grid-cue-ripple {
    0%, 36% {
        opacity: 0;
        transform: scale(0.72);
    }
    44% {
        opacity: 0.72;
    }
    68%, 100% {
        opacity: 0;
        transform: scale(1.18);
    }
}
@keyframes grid-cue-note {
    0%, 38% {
        opacity: 0;
        transform: translate(-22px, 18px) rotate(-4deg) scale(0.68);
    }
    48%, 82% {
        opacity: 1;
        transform: translate(0, 0) rotate(-4deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(8px, -8px) rotate(-2deg) scale(0.96);
    }
}
/* mobile: no interactive cells, just a faint static grid */
@media (max-width: 767px) {
    #hero-grid {
        display: block;
        background-image:
            linear-gradient(to right, rgba(28, 25, 23, 0.05) 1px, transparent 1px),
            linear-gradient(to bottom, rgba(28, 25, 23, 0.05) 1px, transparent 1px);
        background-size: 28px 28px;
    }
    .grid-click-cue {
        left: auto;
        top: auto;
        right: 0.85rem;
        bottom: 2.35rem;
        width: 126px;
        height: 92px;
        transform-origin: right bottom;
        animation-name: grid-cue-enter-mobile;
    }
    .grid-click-cue-cell {
        left: 12px;
        top: 28px;
        width: 46px;
        height: 46px;
    }
    .grid-click-cue-note {
        left: 58px;
        top: 14px;
        width: 58px;
        height: 49px;
        padding: 13px 9px 8px;
    }
    .grid-click-cue-cursor {
        left: 4px;
        top: 64px;
    }
    @keyframes grid-cue-enter-mobile {
        to {
            opacity: 1;
            transform: scale(0.78);
        }
    }
}
@media (max-width: 767px) and (max-height: 840px) {
    .grid-click-cue {
        bottom: 1.75rem;
    }
}
@media (prefers-reduced-motion: reduce) {
    .grid-click-cue {
        animation: grid-cue-enter 0.01s ease 0.5s forwards;
    }
    .grid-click-cue-cell,
    .grid-click-cue-cell::before,
    .grid-click-cue-note,
    .grid-click-cue-cursor {
        animation: none;
    }
    .grid-click-cue-note {
        opacity: 1;
        transform: translate(0, 0) rotate(-4deg) scale(1);
    }
    .grid-click-cue-cursor {
        transform: translate(36px, -31px) rotate(-8deg);
    }
}

/* the note-placing area invites with a crosshair */
#hero {
    cursor: crosshair;
}
#hero a,
#hero button {
    cursor: pointer;
}
body.covered-note-hotspot #hero,
body.covered-note-hotspot #avatar-canvas {
    cursor: grab !important;
}
body.close-hotspot #hero,
body.close-hotspot #avatar-canvas,
body.close-hotspot .postit,
body.close-hotspot .postit-note {
    cursor: pointer !important;
}
body.postit-dragging #hero,
body.postit-dragging #avatar-canvas,
body.postit-dragging .postit,
body.postit-dragging .postit-note {
    cursor: grabbing !important;
}

/* ============ WIRES BETWEEN STICKY NOTES ============ */
#hero-wires {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: visible;
}
.wire-path {
    fill: none;
    stroke: rgba(59, 130, 246, 0.32);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8 6;
    animation: wire-march 1.2s linear infinite;
}
@keyframes wire-march {
    to { stroke-dashoffset: -14; }
}
.wire-dot {
    fill: rgba(59, 130, 246, 0.55);
}
.wire {
    opacity: 0;
    transition: opacity 0.4s ease;
}
.wire.on {
    opacity: 1;
}
body.zb-mode .wire-path {
    stroke: rgba(96, 165, 250, 0.4);
    filter: drop-shadow(0 0 3px rgba(96, 165, 250, 0.45));
}
body.zb-mode .wire-dot {
    fill: rgba(96, 165, 250, 0.65);
}

/* ============ ABOUT 3D PORTRAIT ============ */
.about-model-frame {
    position: relative;
    width: min(100%, 44rem);
    aspect-ratio: 1.5;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #111;
    contain: layout paint;
    cursor: grab;
}
.about-model-frame::after {
    content: none;
}
#about-model-canvas {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    cursor: inherit;
    touch-action: none;
}
#about-model-canvas.is-dragging,
.about-model-frame:has(#about-model-canvas.is-dragging) {
    cursor: grabbing;
}
body.zb-mode .about-model-frame::after {
    content: none;
}

#hero-glow {
    position: absolute;
    top: -10%;
    right: -5%;
    width: 55vw;
    height: 55vw;
    max-width: 720px;
    max-height: 720px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.12) 0%, rgba(251, 191, 36, 0) 65%);
    pointer-events: none;
    filter: blur(8px);
}

#hero.hero-shell {
    min-height: min(820px, 100svh);
    padding-top: 5rem;
    padding-bottom: 2rem;
    align-items: center;
}
#hero > .hero-container {
    position: relative;
}
#hero .hero-content > :not(#signature-postit) {
    position: relative;
    z-index: 5;
}

@media (min-width: 768px) and (max-width: 1023px) {
    #hero.hero-shell {
        padding-top: calc(7.25rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(5.25rem + env(safe-area-inset-bottom, 0px));
    }
    #hero .hero-content > .hero-reveal:first-child {
        margin-top: 0 !important;
    }
    #hero .hero-reveal.flex {
        margin-bottom: clamp(2.5rem, 5vh, 4rem);
    }
}

@media (max-width: 767px) {
    #hero.hero-shell {
        height: auto;
        min-height: auto;
        padding-top: calc(6.9rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
        align-items: flex-start;
    }
    #hero > .hero-container {
        display: block;
        height: auto;
        min-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        box-sizing: border-box;
    }
    #hero .hero-content {
        gap: clamp(0.75rem, 1.9vh, 1.05rem);
        justify-content: flex-start;
        max-width: 100%;
        transform: none;
    }
    #hero .hero-content > .hero-reveal:first-child {
        margin-top: 0.65rem;
    }
    #hero-glow {
        filter: none;
        opacity: 0.6;
    }
}

/* ============ 3D AVATAR ============ */
#avatar-3d-container {
    position: absolute;
    top: 5rem;
    bottom: 4rem;
    right: -4rem;
    width: min(52vw, 940px);
    height: auto;
    /* above the sticky-note layer (z 6): notes placed at the
       character render behind him, like pinning to a wall */
    z-index: 7;
    pointer-events: none;
}
@media (min-width: 1440px) {
    #avatar-3d-container {
        right: calc((100vw - 1440px) / 2 - 4rem);
    }
}
@media (min-width: 1360px) and (max-width: 1535px) {
    #avatar-3d-container {
        right: 1.5rem;
        width: min(56vw, 860px);
    }
}
@media (min-width: 1024px) and (max-width: 1439px) {
    #avatar-3d-container {
        right: -4rem;
        width: min(48vw, 720px);
    }
}
#avatar-canvas {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    /* cursor is set from JS: grab over the model, default elsewhere */
}
#avatar-debug-controls {
    position: fixed;
    right: max(1rem, calc((100vw - 1440px) / 2 + 1.5rem));
    bottom: clamp(11.5rem, 22vh, 14.5rem);
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    width: min(38rem, calc(100vw - 2rem));
    padding: 0.35rem;
    border: 1px solid rgba(28, 25, 23, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 30px rgba(28, 25, 23, 0.12);
    pointer-events: auto;
}
#avatar-debug-controls button {
    min-width: 3.25rem;
    padding: 0.45rem 0.65rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #1c1917;
    cursor: pointer;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}
#avatar-debug-controls button:hover,
#avatar-debug-controls button.is-active {
    background: #1c1917;
    color: #fff;
}
@media (min-width: 1024px) and (max-width: 1199px) {
    #avatar-3d-container {
        position: absolute;
        top: calc(7.25rem + env(safe-area-inset-top, 0px));
        bottom: calc(5.25rem + clamp(2.5rem, 5vh, 4rem) + env(safe-area-inset-bottom, 0px));
        left: auto;
        right: clamp(2rem, 4vw, 4rem);
        width: min(46vw, 460px);
        height: auto;
        opacity: 1;
        transform: none;
        z-index: 7;
        contain: layout paint size;
    }
    #avatar-canvas {
        pointer-events: auto;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    #avatar-3d-container {
        position: absolute;
        top: calc(7.25rem + env(safe-area-inset-top, 0px));
        bottom: calc(5.25rem + clamp(2.5rem, 5vh, 4rem) + env(safe-area-inset-bottom, 0px));
        left: auto;
        right: clamp(1.25rem, 3vw, 2rem);
        width: min(56vw, 460px);
        height: auto;
        opacity: 0.34;
        transform: none;
        z-index: 0;
        contain: layout paint size;
    }
    #avatar-canvas {
        pointer-events: none;
    }
    #avatar-debug-controls {
        display: none;
    }
}

@media (max-width: 767px) {
    #avatar-3d-container {
        position: absolute;
        top: calc(7.55rem + env(safe-area-inset-top, 0px));
        bottom: calc(7rem + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: auto;
        width: 100%;
        height: auto;
        opacity: 0.34;
        transform: none;
        z-index: 0;
        contain: layout paint size;
    }
    #avatar-canvas {
        pointer-events: none;
    }
    #avatar-debug-controls {
        display: none;
    }
    #hero-headline {
        font-size: clamp(1.78rem, 8.1vw, 2.25rem) !important;
        line-height: 1.16 !important;
    }
    #hero p.hero-reveal {
        font-size: clamp(0.9rem, 3.8vw, 1rem) !important;
        line-height: 1.42 !important;
        max-width: 22rem;
    }
    #signature-postit {
        display: block;
        width: max-content;
        max-width: calc(100vw - 1.5rem);
        padding: 0.55rem 0.7rem;
        margin-top: 0.7rem;
    }
    #signature-postit p {
        font-size: clamp(0.72rem, 3.1vw, 0.82rem);
        line-height: 1.35;
        max-width: 100%;
    }
    #signature-postit::before {
        top: -6px;
        width: 44px;
        height: 12px;
    }
    #hero .hero-reveal.flex {
        gap: 0.5rem;
        margin-top: 0.1rem;
        margin-bottom: 2.5rem;
        flex-wrap: nowrap;
    }
    #hero .hero-reveal.flex a {
        white-space: nowrap;
        font-size: 0.82rem;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }
    .scroll-hint {
        display: none;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    #avatar-3d-container {
        left: auto;
        right: -1.25rem;
        width: min(76vw, 420px);
        opacity: 0.34;
    }
}

@media (max-width: 767px) and (max-height: 840px) {
    #hero.hero-shell {
        padding-top: calc(6.25rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    }
    #hero > .hero-container {
        padding-top: 0;
        padding-bottom: 0;
    }
    #hero .hero-content {
        gap: 0.5rem;
        transform: none;
    }
    #hero .hero-content > .hero-reveal:first-child {
        margin-top: 0.45rem;
    }
    #avatar-3d-container {
        top: calc(6.7rem + env(safe-area-inset-top, 0px));
        bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
        width: 100%;
    }
    #hero-headline {
        font-size: clamp(1.5rem, 7vw, 1.85rem) !important;
        line-height: 1.1 !important;
    }
    #hero p.hero-reveal {
        font-size: 0.82rem !important;
        line-height: 1.28 !important;
    }
    #signature-postit {
        width: max-content;
        max-width: calc(100vw - 1.5rem);
        padding: 0.45rem 0.6rem;
        margin-top: 0.85rem;
    }
    #signature-postit p {
        font-size: clamp(0.7rem, 3vw, 0.78rem);
        line-height: 1.32;
    }
    #hero .hero-reveal.flex {
        margin-top: 0;
        margin-bottom: 2rem;
    }
    #hero .hero-reveal.flex a {
        font-size: 0.76rem;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
        padding-top: 0.55rem;
        padding-bottom: 0.55rem;
    }
}

@media (min-width: 480px) and (max-width: 767px) and (max-height: 840px) {
    #avatar-3d-container {
        left: auto;
        right: -1.25rem;
        width: min(76vw, 420px);
        opacity: 0.34;
    }
}

@media (max-width: 370px) and (max-height: 700px) {
    #avatar-3d-container {
        top: calc(7.7rem + env(safe-area-inset-top, 0px));
        bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 370px) and (min-height: 701px) and (max-height: 840px) {
    #avatar-3d-container {
        top: calc(7.25rem + env(safe-area-inset-top, 0px));
    }
}

@media (max-width: 380px) {
    #hero .hero-reveal.flex {
        flex-wrap: wrap;
    }
}

code {
    overflow-wrap: anywhere;
    word-break: break-word;
}
li.flex > span:last-child {
    min-width: 0;
}

@media (max-width: 767px) {
    .section-heading-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }
    .section-heading-eyebrow {
        display: block;
        max-width: 100%;
        line-height: 1.5;
    }
    .featured-metrics {
        grid-template-columns: 1fr;
    }
    .featured-metric {
        border-right-width: 0 !important;
        border-bottom-width: 1px;
        padding: 1.5rem;
    }
    .featured-metric:last-child {
        border-bottom-width: 0;
    }
    .featured-metric-value {
        font-size: clamp(2rem, 10vw, 2.5rem);
        line-height: 1.05;
        white-space: nowrap;
    }
}

/* ============ TRUSTED-BY MARQUEE ============ */
.marquee {
    overflow: hidden;
    width: 100%;
}
.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee-scroll 35s linear infinite;
}
.marquee-track span {
    margin-right: 4.5rem;
    white-space: nowrap;
    font-size: 1.125rem;
    font-weight: 500;
    color: #a8a29e; /* stone-400 */
}
@keyframes marquee-scroll {
    to {
        transform: translateX(-50%);
    }
}

/* ============ HERO REVEAL ANIMATIONS ============ */
.hero-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.hero-reveal.shown {
    opacity: 1;
    transform: translateY(0);
}
.reveal-line {
    overflow: visible;
    /* room for descenders (g, y, p) */
    padding-bottom: 0.12em;
    margin-bottom: -0.12em;
}
.reveal-line .char {
    display: inline-block;
    padding-right: 0.08em;
    margin-right: -0.08em;
    opacity: 0;
    transform: translateY(0.6em) rotate(4deg);
    animation: char-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.reveal-line.line-reveal {
    opacity: 0;
    transform: translateY(0.45em) rotate(1.5deg);
    animation: line-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes char-in {
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}
@keyframes line-in {
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

/* ============ POST-IT ============ */
.postit {
    --note-accent: #b45309;
    --note-bg: #fef3c7;
    --note-tape: rgba(245, 158, 11, 0.25);
    border: 1px solid color-mix(in srgb, var(--note-accent) 18%, rgba(28, 25, 23, 0.1));
    border-radius: 7px;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--note-accent) 11%, transparent), transparent 48%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 48%),
        var(--note-bg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.85) inset,
        0 2px 5px rgba(28, 25, 23, 0.12),
        0 18px 26px -20px rgba(28, 25, 23, 0.45);
    padding: 1.05rem 1rem 0.9rem;
    width: fit-content;
    max-width: 280px;
    box-sizing: border-box;
    position: relative;
    color: #292524;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0;
    line-height: 1.45;
    text-transform: none;
}
.postit--signature {
    transform: rotate(-2.5deg);
    max-width: 360px;
    align-self: flex-start;
    z-index: 8;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.postit--signature p {
    max-width: none;
    margin-top: 0.45rem;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    line-height: 1.45;
    white-space: nowrap;
}
@media (min-width: 1024px) {
    #signature-postit {
        position: absolute;
        left: min(66%, calc(100vw - 24rem));
        top: 23.25rem;
    }
}
@media (min-width: 1024px) and (max-width: 1199px) {
    #signature-postit {
        left: min(64%, calc(100vw - 22.75rem));
        width: 340px;
        max-width: 340px;
        padding: 0.75rem 0.9rem;
    }
    #signature-postit p {
        font-size: 0.92rem;
        line-height: 1.28;
        max-width: none;
    }
}
.postit--signature.hero-reveal.shown,
.postit--signature.is-placed {
    transform: rotate(-2.5deg);
}
.postit--signature:hover {
    transform: rotate(-1deg) scale(1.025);
    filter: saturate(1.06);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 4px 10px rgba(28, 25, 23, 0.14),
        0 24px 34px -22px rgba(28, 25, 23, 0.48);
    transition: transform 0.3s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.postit--signature.is-dragging {
    cursor: grabbing;
    z-index: 12;
    transform: rotate(-2.5deg);
    filter: saturate(1.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 22px rgba(28, 25, 23, 0.16),
        0 34px 42px -26px rgba(28, 25, 23, 0.58);
    transition: none;
}
.postit--signature.leaving {
    opacity: 0;
    transform: rotate(-2.5deg) scale(0.92);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.postit::before {
    /* tape */
    content: none;
}

/* ============ SCROLL HINT ============ */
.scroll-hint {
    animation: hint-bob 2.2s ease-in-out infinite;
}
@keyframes hint-bob {
    0%, 100% { transform: translate(-50%, 0); opacity: 0.6; }
    50% { transform: translate(-50%, 6px); opacity: 1; }
}

/* ============ SCROLL REVEALS ============ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-on-scroll.shown {
    opacity: 1;
    transform: translateY(0);
}

/* ============ TIMELINE ============ */
.timeline {
    position: relative;
    gap: 3.5rem;
}
.timeline::before {
    content: "";
    position: absolute;
    left: -2rem;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: #e7e5e4; /* stone-200 */
}
.timeline-item {
    position: relative;
}
.timeline-item::before {
    content: "";
    position: absolute;
    left: calc(-2rem - 3.5px);
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #1c1917;
}
@media (max-width: 640px) {
    .timeline::before,
    .timeline-item::before {
        display: none;
    }
}

/* ============ CONVICTION CARDS ============ */
.conviction-card {
    transition: background 0.3s ease;
}
.conviction-card:hover {
    background: #292524; /* stone-800 */
}

/* ============ EASTER EGG ============ */
.easter-egg-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(12, 10, 9, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 1;
    transition: opacity 0.4s ease;
}
.easter-egg-overlay.hidden {
    display: none;
}
.easter-content {
    text-align: center;
    color: #fafaf9;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    max-width: 520px;
}
.easter-content h2 {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    line-height: 1;
}
.easter-content p {
    font-size: 1.125rem;
    font-weight: 300;
    color: #d6d3d1;
}
.easter-subtext {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #a8a29e !important;
}
.easter-cta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    text-decoration: underline;
    text-underline-offset: 8px;
    text-decoration-color: #57534e;
    transition: text-decoration-color 0.3s ease;
}
.easter-cta:hover {
    text-decoration-color: #fafaf9;
}
.easter-close {
    margin-top: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #78716c;
    border: 1px solid #44403c;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    transition: color 0.3s, border-color 0.3s;
}
.easter-close:hover {
    color: #fafaf9;
    border-color: #fafaf9;
}

/* ============ CLICK-TO-PLACE STICKY NOTES ============ */
#hero-postits {
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}
.postit-note {
    --note-accent: #b45309;
    --note-bg: #fef3c7;
    --note-tape: rgba(245, 158, 11, 0.25);
    position: absolute;
    width: min(218px, calc(100vw - 2rem));
    border: 1px solid color-mix(in srgb, var(--note-accent) 18%, rgba(28, 25, 23, 0.1));
    border-radius: 7px;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--note-accent) 11%, transparent), transparent 48%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 48%),
        var(--note-bg);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.85) inset,
        0 2px 5px rgba(28, 25, 23, 0.12),
        0 18px 26px -20px rgba(28, 25, 23, 0.45);
    padding: 1.05rem 0.85rem 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.69rem;
    line-height: 1.45;
    color: #292524;
    cursor: grab;
    letter-spacing: 0;
    text-transform: none;
    touch-action: none;
    user-select: none;
    white-space: pre-line;
    transform: rotate(var(--rot, -2deg));
    animation: postit-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    transition:
        box-shadow 0.18s ease,
        filter 0.18s ease;
    will-change: left, top, transform;
}
.postit-note:hover,
.postit-note:focus-visible {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 4px 10px rgba(28, 25, 23, 0.14),
        0 24px 34px -22px rgba(28, 25, 23, 0.48);
    filter: saturate(1.06);
    outline: none;
}
.postit-note:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--note-accent) 55%, white);
    outline-offset: 3px;
}
.postit-note.is-dragging {
    cursor: grabbing;
    z-index: 8;
    filter: saturate(1.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9) inset,
        0 10px 22px rgba(28, 25, 23, 0.16),
        0 34px 42px -26px rgba(28, 25, 23, 0.58);
}
.postit-note-tape {
    position: absolute;
    left: 50%;
    top: -0.55rem;
    width: 4.1rem;
    height: 1rem;
    transform: translateX(-50%) rotate(-2deg);
    border: 1px solid rgba(255, 255, 255, 0.42);
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.45), transparent 34% 66%, rgba(255, 255, 255, 0.35)),
        var(--note-tape);
    box-shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
    pointer-events: none;
}
.postit-note-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    color: var(--note-accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.56rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
}
.postit-note-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    color: color-mix(in srgb, var(--note-accent) 70%, #44403c);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    line-height: 1;
    opacity: 0.58;
    pointer-events: auto;
    text-transform: none;
    transition:
        background 0.16s ease,
        opacity 0.16s ease;
}
.postit-note-close:hover,
.postit-note-close:focus-visible,
.postit-note-close.is-hotspot-hover {
    background: rgba(255, 255, 255, 0.55);
    opacity: 1;
    outline: none;
}
.postit-note-text {
    display: block;
    margin-top: 0.45rem;
}
.postit-note-grip {
    display: inline-flex;
    margin-top: 0.75rem;
    border-top: 1px dashed color-mix(in srgb, var(--note-accent) 24%, transparent);
    padding-top: 0.45rem;
    color: color-mix(in srgb, var(--note-accent) 64%, #78716c);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}
@keyframes postit-pop {
    from {
        transform: rotate(var(--rot, -2deg)) scale(0.4);
        opacity: 0;
    }
}
.postit-note.leaving {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: rotate(var(--rot, -2deg)) scale(0.75);
}

/* ============ NO-FILTER MODE TOGGLE (gauge) ============ */
.zb-toggle {
    background-image: linear-gradient(
        to right,
        #fde68a var(--zb-fill, 0%),
        transparent var(--zb-fill, 0%)
    );
    transition: background-image 0.2s ease, border-color 0.2s ease;
}
body.zb-mode .zb-toggle {
    background: #fbbf24;
    color: #1c1917;
    border-color: #fbbf24;
}

/* ============ MODE CURTAIN ============ */
#mode-curtain {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-102%);
    pointer-events: none;
}
#mode-curtain.cover {
    transform: translateY(0);
    transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}
#mode-curtain.leave {
    transform: translateY(102%);
    transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}
#mode-curtain span {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(2rem, 6vw, 4rem);
    color: #1c1917;
    transform: rotate(-3deg);
}

/* ============ AUDIO PLAYER ============ */
#audio-player {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 60;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    background: #1c1917;
    border: 1px solid #44403c;
    color: #fafaf9;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.5);
}
#audio-player.show {
    display: flex;
}
#play-pause-btn {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: #fbbf24;
    color: #1c1917;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
#play-pause-btn:hover {
    transform: scale(1.1);
}
.eq {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 14px;
}
.eq span {
    width: 3px;
    background: #fbbf24;
    border-radius: 1px;
    animation: eq-bounce 0.7s ease-in-out infinite;
}
.eq span:nth-child(2) { animation-delay: 0.15s; }
.eq span:nth-child(3) { animation-delay: 0.3s; }
.eq span:nth-child(4) { animation-delay: 0.45s; }
@keyframes eq-bounce {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}
#audio-player.paused .eq span {
    animation: none;
    height: 4px;
}
.player-label {
    color: #a8a29e;
}

/* ============ NO-FILTER MODE - DARK THEME ============ */
body.zb-mode {
    background: #0c0a09;
    color: #fafaf9;
}
body.zb-mode .bg-stone-50 { background-color: #0c0a09 !important; }
body.zb-mode .bg-white { background-color: #0c0a09 !important; }
body.zb-mode nav { background: rgba(12, 10, 9, 0.85) !important; }
body.zb-mode .text-stone-900 { color: #fafaf9 !important; }
body.zb-mode .text-stone-600,
body.zb-mode .text-stone-500 { color: #a8a29e !important; }
body.zb-mode .border-stone-200 { border-color: #292524 !important; }
body.zb-mode .border-stone-300 { border-color: #57534e !important; }
body.zb-mode a.bg-stone-900 {
    background-color: #fafaf9 !important;
    color: #1c1917 !important;
}
body.zb-mode a.bg-stone-900:hover { background-color: #d6d3d1 !important; }
body.zb-mode #mobile-menu-btn span { background: #fafaf9; }
body.zb-mode .bg-emerald-50 {
    background-color: #022c22 !important;
    border-color: #065f46 !important;
}
body.zb-mode #hero-grid {
    background-image:
        linear-gradient(to right, rgba(250, 250, 249, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(250, 250, 249, 0.05) 1px, transparent 1px);
}
body.zb-mode #hero-glow {
    background: radial-gradient(circle, rgba(251, 191, 36, 0.1) 0%, rgba(251, 191, 36, 0) 65%);
}
@media (max-width: 1023px) {
    body.zb-mode #avatar-3d-container {
        opacity: 0.34;
    }
}
body.zb-mode .timeline::before { background: #292524; }
body.zb-mode .timeline-item::before { background: #fafaf9; }
body.zb-mode .nav-link { color: #a8a29e; }
body.zb-mode .nav-link:hover { color: #fafaf9; }
body.zb-mode ::selection { background: #b45309; color: #fafaf9; }

/* ============ MISC ============ */
::selection {
    background: #fde68a; /* amber-200 */
    color: #1c1917;
}
