/* 1. Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    padding: 0 36px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--cobalt);
    pointer-events: none;
    z-index: 30;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.burger-btn {
    width: 26px;
    height: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: none;
    border: none;
    padding: 0;
    pointer-events: auto;
}

.burger-btn span {
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: var(--cobalt);
}

/* 2. Halftone Wordmark */
.kanji {
    position: fixed;
    z-index: 1;
    overflow: hidden;
    padding-bottom: 0.04em;
    font-family: var(--font-sans);
    font-weight: 900;
    font-size: clamp(28px, min(5.2vw, 7.2vh), 76px);
    line-height: 1;
    letter-spacing: 0.04em;
    white-space: nowrap;
    pointer-events: none;
}

.kanji>span {
    display: inline-block;
    color: transparent;
    background-image:
        radial-gradient(circle at 50% 50%,
            rgba(64, 82, 138, 0.55) 0 36%,
            transparent 40%),
        linear-gradient(rgba(110, 122, 160, 0.26), rgba(110, 122, 160, 0.26));
    background-size: 3px 3px, 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    will-change: transform;
    animation: kanjiMaskRise 0.85s var(--ease) calc(0.06s + var(--i, 0) * 0.065s) both;
}

@keyframes kanjiMaskRise {
    from {
        transform: translateY(110%);
    }

    to {
        transform: translateY(0%);
    }
}

body.is-detail-open .kanji>span,
body.is-terms-open .kanji>span,
body.is-dev-open .kanji>span {
    animation: none;
    transform: translateY(110%);
}

@media (prefers-reduced-motion: reduce) {
    .kanji>span {
        animation: none;
        transform: none;
    }
}

.kanji-left {
    left: 36px;
    top: clamp(20px, 2.8vh, 28px);
}

/* 3. Floor Shadow */
.floor-shadow {
    position: fixed;
    left: 50%;
    top: calc(var(--cy) + (var(--H) - 1cm) * 0.47);
    width: min(96vw, calc(var(--H) * 3.6));
    height: calc(var(--H) * 0.26);
    transform: translate(-50%, -50%);
    background: radial-gradient(50% 50% at 50% 40%,
            rgba(40, 32, 20, 0.3),
            rgba(40, 32, 20, 0.1) 55%,
            transparent 72%);
    pointer-events: none;
    z-index: 2;
}

/* 4. Shelf & 3D Tapes */
.shelf {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--cy) - var(--H) / 2 - 50px);
    height: calc(var(--H) + 100px);
    perspective: 1400px;
    perspective-origin: 50% 50%;
    z-index: 10;
    touch-action: pan-y;
}

.stage {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
}

.tape {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    transform-style: preserve-3d;
    will-change: transform;
}

.face {
    position: absolute;
    top: calc(var(--H) * -0.5 + 0.5cm);
    height: calc(var(--H) - 1cm);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 2px;
    background-repeat: no-repeat;
    overflow: hidden;
    --shade: 0;
}

.face::after {
    content: "";
    position: absolute;
    inset: 0;
    background-color: #000;
    opacity: var(--shade, 0);
    pointer-events: none;
}

.face.cv {
    box-shadow: 0 34px 60px -30px rgba(20, 16, 10, 0.6);
}

/* 5. Play Ring */
.play-ring {
    position: fixed;
    width: 52px;
    height: 52px;
    margin-left: -26px;
    margin-top: -26px;
    border-radius: 50%;
    border: 2px solid #FAF7F0;
    background-color: var(--cobalt);
    color: #FFFFFF;
    box-shadow:
        0 8px 20px rgba(31, 63, 176, 0.4),
        0 0 0 4px rgba(31, 63, 176, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    transform: scale(0);
    will-change: transform, left, top;
    transition:
        background-color 0.25s var(--ease),
        box-shadow 0.25s var(--ease);
}

.play-ring::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--cobalt);
    opacity: 0;
    pointer-events: none;
    animation: play-ring-pulse 2.2s var(--ease) infinite;
}

.play-ring:hover,
.play-ring:focus-visible {
    background-color: #2A52DF;
    box-shadow:
        0 10px 26px rgba(31, 63, 176, 0.55),
        0 0 0 6px rgba(31, 63, 176, 0.24);
    outline: none;
}

.play-ring svg {
    transform: translateX(1.5px);
}

@keyframes play-ring-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    70%,
    100% {
        transform: scale(1.48);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .play-ring::after {
        animation: none;
    }
}

/* 6. Caption */
.caption {
    position: fixed;
    left: 50%;
    top: calc(var(--cy) + var(--H) / 2 + 4.2vh);
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: 10px;
    z-index: 20;
    pointer-events: none;
}

.caption-mask {
    position: relative;
    width: min(80vw, 640px);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.caption-mask>span {
    grid-area: 1 / 1;
    display: block;
    text-align: center;
    white-space: nowrap;
    will-change: transform;
}

.mask-title {
    min-height: clamp(32px, 3.9vw, 52px);
}

.mask-title>span {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(28px, 3.4vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--cobalt);
}

.mask-sub {
    min-height: 16px;
}

.mask-sub>span {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 11.5px;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cobalt);
}

/* 7. Navigation Arrows */
.nav-arrow {
    position: fixed;
    top: calc(var(--cy) + var(--H) / 2 + 4.2vh + clamp(14px, 1.7vw, 23px) - 22px);
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--cobalt);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

.arrow-prev {
    left: calc(50% - min(19vw, 250px) - 22px);
}

.arrow-next {
    left: calc(50% + min(19vw, 250px) - 22px);
}

/* ── Ambient Showcase Overlays (Swiss Grid, Category Bar, Left Index, Right Telemetry) ── */
.top-category-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(20, 20, 20, 0.65);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    padding: 6px 16px;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

/* 1. Subtle Swiss Grid & Crosshair Overlay (Background Layer below 3D spines) */
.swiss-grid-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.swiss-line {
    position: absolute;
    pointer-events: none;
}

.swiss-line-v {
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed rgba(0, 0, 0, 0.06);
}

.swiss-v-left {
    left: 20vw;
}

.swiss-v-right {
    left: 80vw;
}

.swiss-line-h {
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed rgba(0, 0, 0, 0.06);
}

.swiss-h-top {
    top: 16vh;
}

.swiss-h-bottom {
    top: 68vh;
}

.swiss-crosshair {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 400;
    line-height: 1;
    color: var(--ink);
    opacity: 0.35;
    pointer-events: none;
}

.swiss-ch-tl {
    left: 20vw;
    top: 16vh;
}

.swiss-ch-tr {
    left: 80vw;
    top: 16vh;
}

.swiss-ch-bl {
    left: 20vw;
    top: 68vh;
}

.swiss-ch-br {
    left: 80vw;
    top: 68vh;
}

/* 3. Left Margin — Vertical Brand Index */
.ambient-left-index {
    position: fixed;
    left: 3.5rem;
    top: 44%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.brand-index-coord-top {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--ink);
    opacity: 0.4;
    margin-bottom: 1.5rem;
    pointer-events: none;
}

.brand-index-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    pointer-events: none;
}

.brand-index-item {
    appearance: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    line-height: 1.85;
    text-transform: uppercase;
    color: var(--ink);
    opacity: 0.42;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: auto;
    transition:
        opacity 0.25s var(--ease),
        color 0.25s var(--ease),
        transform 0.25s var(--ease);
}

.brand-index-item:hover {
    opacity: 0.78;
}

.brand-index-item.is-active {
    opacity: 1;
    font-weight: 600;
}

.brand-index-dot {
    font-size: 0.75rem;
    line-height: 1;
    color: var(--cobalt);
    opacity: 0;
    transform: scale(0.4);
    transition:
        opacity 0.25s var(--ease),
        transform 0.25s var(--ease);
}

.brand-index-item.is-active .brand-index-dot {
    opacity: 1;
    transform: scale(1);
}

.brand-index-coord-bottom {
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--ink);
    opacity: 0.4;
    margin-top: 1.25rem;
    pointer-events: none;
}

/* 4. Right Margin — Vertical System Telemetry & Stamp */
.ambient-right-telemetry {
    position: fixed;
    right: 3.5rem;
    top: 15vh;
    z-index: 20;
    writing-mode: vertical-rl;
    font-family: var(--font-sans);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    line-height: 1.6;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.45);
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.ambient-left-incoming {
    position: fixed;
    left: 2.2rem;
    bottom: 82px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.ambient-left-incoming .ambient-incoming-text {
    font-size: clamp(9.5px, 0.66vw, 11.5px);
    letter-spacing: 0.11em;
}

.ambient-incoming-subline {
    padding-left: 15px;
}

.ambient-right-incoming {
    position: fixed;
    right: clamp(3.5rem, 11vw, 16vw);
    top: calc(68.5vh - 0.6cm);
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.ambient-incoming-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
}

.ambient-incoming-dot {
    position: relative;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--cobalt);
    flex-shrink: 0;
}

.ambient-incoming-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid var(--cobalt);
    opacity: 0;
    animation: incomingDotPulse 2.2s var(--ease) infinite;
}

.ambient-incoming-text {
    display: inline-flex;
    align-items: baseline;
    gap: 0.42em;
    overflow: hidden;
    padding: 2px 0;
    font-family: var(--font-sans);
    font-size: clamp(10.5px, 0.76vw, 12.5px);
    font-weight: 700;
    letter-spacing: 0.16em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--ink);
    white-space: nowrap;
}

.ambient-incoming-word {
    display: inline-block;
    will-change: transform, opacity;
    animation:
        incomingWordRise 0.75s var(--ease) calc(0.15s + var(--w, 0) * 0.08s) both,
        incomingWordBreathe 4.2s ease-in-out calc(1.2s + var(--w, 0) * 0.18s) infinite;
}

.ambient-incoming-sep {
    color: var(--cobalt);
    font-weight: 800;
}

.ambient-incoming-bar {
    position: relative;
    width: 100%;
    height: 1.5px;
    background-color: rgba(20, 20, 20, 0.12);
    overflow: hidden;
}

.ambient-incoming-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--cobalt), transparent);
    animation: incomingBarScan 2.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes incomingWordRise {
    from {
        transform: translateY(115%);
        opacity: 0;
    }

    to {
        transform: translateY(0%);
        opacity: 1;
    }
}

@keyframes incomingWordBreathe {

    0%,
    100% {
        opacity: 0.92;
    }

    50% {
        opacity: 0.55;
    }
}

@keyframes incomingDotPulse {
    0% {
        transform: scale(0.8);
        opacity: 0.75;
    }

    75%,
    100% {
        transform: scale(2.1);
        opacity: 0;
    }
}

@keyframes incomingBarScan {
    0% {
        left: -40%;
    }

    100% {
        left: 100%;
    }
}

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

    .ambient-incoming-word,
    .ambient-incoming-dot::after,
    .ambient-incoming-bar::after {
        animation: none;
    }
}

.ambient-right-stamp {
    position: fixed;
    right: 3.5rem;
    bottom: 76px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.ambient-access-label {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    line-height: 1.55;
    text-transform: uppercase;
    text-align: right;
    color: var(--ink);
    opacity: 0.55;
    pointer-events: none;
}

.ambient-stamp-wrap {
    width: 56px;
    height: 56px;
    opacity: 0.65;
    color: var(--ink);
    pointer-events: none;
}

.ambient-stamp-svg {
    display: block;
    width: 56px;
    height: 56px;
    overflow: visible;
}

.ambient-stamp-spin {
    transform-origin: 50px 50px;
    animation: coastnexStampSpin 14s linear infinite;
}

@keyframes coastnexStampSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 5. Bottom Center — Minimalist About Note */
.ambient-bottom-about {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(58vw, 920px);
    z-index: 20;
    border-top: 1px solid rgba(20, 20, 20, 0.2);
    padding-top: 0.75rem;
    font-family: var(--font-sans);
    font-size: clamp(12px, 0.85vw, 13.5px);
    font-weight: 400;
    line-height: 1.55;
    text-align: center;
    color: rgba(20, 20, 20, 0.52);
    pointer-events: none;
    transition: opacity 0.4s var(--ease);
}

.ambient-bottom-about p {
    margin: 0;
}

.about-mail-link {
    color: rgba(31, 63, 176, 0.78);
    font-weight: 500;
    text-decoration: none;
    pointer-events: auto;
    cursor: pointer;
    transition: color 0.2s var(--ease);
}

.about-mail-link:hover {
    color: var(--cobalt);
    text-decoration: underline;
}

/* 6. Bottom Social Links (Telegram & YouTube) */
.social-links {
    position: fixed;
    right: 3.5rem;
    bottom: 18px;
    z-index: 25;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    transition: opacity 0.4s var(--ease);
}

.social-link-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(20, 20, 20, 0.16);
    background: rgba(255, 255, 255, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    pointer-events: auto;
    transition:
        transform 0.2s var(--ease),
        border-color 0.2s var(--ease),
        background-color 0.2s var(--ease);
}

.social-link-btn svg {
    width: 16px;
    height: 16px;
    display: block;
}

.social-link-tg {
    color: #229ED9;
}

.social-link-yt {
    color: #E62117;
}

.social-link-btn:hover,
.social-link-btn:focus-visible {
    transform: translateY(-1.5px);
    background: rgba(255, 255, 255, 0.9);
    border-color: currentColor;
    outline: none;
}

/* 3. Fade Out All Ambient Overlays When Detail Sheet Is Open */
body.is-detail-open .top-category-bar,
body.is-detail-open .swiss-grid-overlay,
body.is-detail-open .ambient-left-index,
body.is-detail-open .ambient-right-telemetry,
body.is-detail-open .ambient-left-incoming,
body.is-detail-open .ambient-right-incoming,
body.is-detail-open .ambient-right-stamp,
body.is-detail-open .ambient-bottom-about,
body.is-detail-open .social-links,
body.is-detail-open .mobile-open-hint,
body.is-detail-open .ambient-left-index .brand-index-item {
    opacity: 0 !important;
    pointer-events: none !important;
}