/* ============================================================
   NOSUKE.DEV landing — neobrutalism × three.js × gsap
   ============================================================ */

:root {
    --ink: #141414;
    --cream: #faf3e1;
    --paper: #fffdf5;
    --bg-dark: #0a0a12;
    --yellow: #ffd02f;
    --pink: #ff5d9e;
    --blue: #3f7cff;
    --green: #2fd780;
    --purple: #8c6cff;
    --orange: #ff8a3d;
    /* くらむぼん → (interim) Dela Gothic One — display/impact */
    --f-disp: "Kurambon", "Dela Gothic One", "Archivo Black", "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
    /* めもかっち → (interim) Zen Kaku/system — body text */
    --f-body: "Memokacchi", "Space Grotesk", "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
    /* ビルの谷間と高架下 → (interim) Kaisei Decol — retro headings */
    --f-retro: "BiruTanima", "Kaisei Decol", "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
    /* めもわーる-しかく → (interim) Kiwi Maru — kana accents */
    --f-kana: "Memoir", "Kiwi Maru", "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
    --bd: 3px solid var(--ink);
}

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

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--bg-dark);
    color: var(--ink);
    font-family: var(--f-body);
    transition: background-color 0.6s ease;
    -webkit-font-smoothing: antialiased;
}

body.lit {
    background: #f6eed8;
}

::selection {
    background: var(--yellow);
    color: var(--ink);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* --- canvas & flash ------------------------------------------- */

#scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
    touch-action: none;
}

#flash {
    position: fixed;
    inset: 0;
    background: #fffbe8;
    opacity: 0;
    pointer-events: none;
    z-index: 90;
}

/* --- a11y light toggle (visible on keyboard focus) ------------ */

.sr-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 60;
    padding: 0.6em 1em;
    font-family: var(--f-body);
    font-weight: 700;
    font-size: 0.85rem;
    background: var(--yellow);
    border: var(--bd);
    box-shadow: 4px 4px 0 var(--ink);
    cursor: pointer;
    transform: translateY(-200%);
    opacity: 0;
}

.sr-toggle:focus-visible {
    transform: translateY(0);
    opacity: 1;
    outline: 3px dashed var(--pink);
    outline-offset: 3px;
}

/* --- hint (anchored to the cord by JS) ------------------------ */

.hint {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px 12px;
    background: rgba(16, 16, 26, 0.72);
    border: 2px dashed rgba(250, 243, 225, 0.75);
    border-radius: 2px;
    color: var(--cream);
    text-align: center;
    opacity: 0;
    pointer-events: none;
    will-change: transform;
}

.hint-arrow {
    font-size: 1.15rem;
    line-height: 1;
    animation: bob 1.1s ease-in-out infinite;
}

.hint-jp {
    font-family: var(--f-kana);
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: 0.1em;
}

.hint-en {
    font-family: "Space Grotesk", monospace;
    font-size: 0.6rem;
    letter-spacing: 0.34em;
    opacity: 0.75;
}

@keyframes bob {
    0%, 100% { transform: translateY(3px); }
    50% { transform: translateY(-4px); }
}

/* --- neobrutalist buttons -------------------------------------- */

.nbtn {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.62em 1.15em;
    font-family: var(--f-disp);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
    border: var(--bd);
    box-shadow: 4px 4px 0 var(--ink);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.nbtn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
}

.nbtn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--ink);
}

.nbtn:focus-visible {
    outline: 3px dashed var(--pink);
    outline-offset: 3px;
}

.nbtn-yellow { background: var(--yellow); }
.nbtn-sm { padding: 0.5em 0.9em; font-size: 0.78rem; }
.nbtn-big { padding: 0.8em 1.4em; font-size: 1rem; }
.nbtn .arr { margin-left: 0.15em; }

/* --- topbar ----------------------------------------------------- */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 18px 0;
    transform: translateY(-140%);
    transition: transform 0.65s cubic-bezier(0.2, 1.4, 0.3, 1);
    pointer-events: none;
}

body.lit .topbar {
    transform: translateY(0);
    pointer-events: auto;
}

.logo {
    font-family: var(--f-disp);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    background: var(--yellow);
    border: var(--bd);
    box-shadow: 5px 5px 0 var(--ink);
    padding: 0.4em 0.75em;
    transform: rotate(-1.5deg);
    user-select: none;
}

.logo em {
    font-style: normal;
    color: var(--pink);
    -webkit-text-stroke: 1px var(--ink);
}

.topnav {
    display: flex;
    gap: 10px;
}

/* --- 3D-anchored tags ------------------------------------------- */

.tag {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 20;
    padding: 0;
    background: none;
    border: none;
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease 0.55s;
    will-change: transform;
}

body.lit .tag {
    opacity: 1;
    pointer-events: auto;
}

.tag-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    font-family: var(--f-disp);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    color: var(--ink);
    border: var(--bd);
    box-shadow: 4px 4px 0 var(--ink);
    padding: 0.5em 0.95em;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    animation: wiggle 3.2s ease-in-out infinite;
}

.tag-pink .tag-inner {
    background: var(--pink);
    transform: rotate(-4deg);
}

.tag-blue .tag-inner {
    background: var(--blue);
    color: var(--paper);
    transform: rotate(3deg);
    animation-delay: 1.4s;
}

.tag:hover .tag-inner,
.tag:focus-visible .tag-inner {
    transform: rotate(0deg) translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--ink);
    animation-play-state: paused;
}

.tag:focus-visible {
    outline: 3px dashed var(--pink);
    outline-offset: 4px;
}

@keyframes wiggle {
    0%, 100% { rotate: 0deg; }
    50% { rotate: 3deg; }
}

/* --- marquee ribbon ---------------------------------------------- */

.marquee {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    overflow: hidden;
    background: var(--ink);
    border-top: 3px solid var(--ink);
    box-shadow: 0 -4px 0 rgba(20, 20, 20, 0.18);
    transform: translateY(130%);
    transition: transform 0.65s cubic-bezier(0.2, 1.4, 0.3, 1) 0.1s;
    padding-bottom: env(safe-area-inset-bottom);
}

body.lit .marquee {
    transform: translateY(0);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 26s linear infinite;
}

.marquee-chunk {
    display: inline-block;
    white-space: nowrap;
    font-family: var(--f-disp);
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    color: var(--cream);
    padding: 0.75em 0;
}

.marquee-chunk b {
    font-weight: 400;
    padding: 0 0.5em;
}

.s-y { color: var(--yellow); }
.s-p { color: var(--pink); }
.s-b { color: #7ea4ff; }
.s-g { color: var(--green); }

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* --- about modal --------------------------------------------------- */

.modal-wrap {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-wrap[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 24, 0.5);
}

.modal-card {
    position: relative;
    width: min(580px, 94vw);
    max-height: min(84vh, 84svh);
    overflow-y: auto;
    background: var(--paper);
    border: 4px solid var(--ink);
    box-shadow: 12px 12px 0 var(--ink);
    padding: clamp(22px, 4.5vw, 40px);
    transform: rotate(-1deg);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    font-family: var(--f-disp);
    font-size: 1.05rem;
    background: var(--yellow);
    border: var(--bd);
    box-shadow: 3px 3px 0 var(--ink);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
    box-shadow: 4px 4px 0 var(--ink);
}

.modal-close:focus-visible {
    outline: 3px dashed var(--pink);
    outline-offset: 3px;
}

.sticker {
    display: inline-block;
    font-family: var(--f-disp);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    padding: 0.45em 0.9em;
    border: var(--bd);
    box-shadow: 3px 3px 0 var(--ink);
    transform: rotate(-2deg);
    margin-bottom: 18px;
}

.sticker-pink {
    background: var(--pink);
    color: var(--paper);
}

.modal-name {
    font-family: var(--f-retro);
    font-weight: 700;
    font-size: clamp(2.1rem, 6vw, 3rem);
    line-height: 1.05;
    letter-spacing: 0.04em;
}

.modal-name small {
    display: block;
    font-family: var(--f-kana);
    font-weight: 400;
    font-size: 0.88rem;
    letter-spacing: 0.22em;
    margin-top: 10px;
    color: #57524a;
}

.modal-lead {
    margin-top: 18px;
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.75;
}

.modal-sub {
    margin-top: 10px;
    font-size: 0.86rem;
    line-height: 1.65;
    color: #57524a;
}

.chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 20px;
}

.chip {
    font-family: var(--f-body);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.42em 0.8em;
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    background: var(--paper);
}

.chip.c-y { background: var(--yellow); }
.chip.c-p { background: var(--pink); color: var(--paper); }
.chip.c-b { background: var(--blue); color: var(--paper); }
.chip.c-g { background: var(--green); }
.chip.c-pu { background: var(--purple); color: var(--paper); }
.chip.c-o { background: var(--orange); }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

/* --- no-WebGL fallback hero ----------------------------------------- */

.fallback {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
    padding: 24px;
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 93, 158, 0.35) 0 120px, transparent 121px),
        radial-gradient(circle at 85% 78%, rgba(63, 124, 255, 0.3) 0 150px, transparent 151px),
        #f6eed8;
}

body.no-webgl .fallback {
    display: flex;
}

body.no-webgl #scene,
body.no-webgl .hint {
    display: none;
}

.fb-badge {
    font-family: var(--f-disp);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    background: var(--yellow);
    border: var(--bd);
    box-shadow: 4px 4px 0 var(--ink);
    padding: 0.45em 0.9em;
    transform: rotate(-2deg);
}

.fb-title {
    font-family: var(--f-retro);
    font-weight: 700;
    font-size: clamp(2.4rem, 8vw, 4rem);
    line-height: 1.05;
}

.fb-title span {
    display: block;
    font-family: var(--f-kana);
    font-weight: 400;
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    margin-top: 10px;
    color: #57524a;
}

.fb-lead {
    font-weight: 700;
}

.fb-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
    margin-top: 12px;
}

.fb-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 190px;
    padding: 22px 26px;
    font-family: var(--f-disp);
    font-size: 1.15rem;
    color: var(--ink);
    text-decoration: none;
    border: 4px solid var(--ink);
    box-shadow: 8px 8px 0 var(--ink);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.fb-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 11px 11px 0 var(--ink);
}

.fb-card:active {
    transform: translate(3px, 3px);
    box-shadow: 2px 2px 0 var(--ink);
}

.fb-card small {
    font-family: var(--f-body);
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
}

.fb-card-emoji {
    font-size: 2rem;
    line-height: 1.2;
}

.fb-card-pink { background: var(--pink); color: var(--paper); }
.fb-card-blue { background: var(--blue); color: var(--paper); }

/* --- noscript -------------------------------------------------------- */

.noscript-hero {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    padding: 28px;
    background: var(--cream);
    font-family: var(--f-body);
}

.noscript-hero h2 {
    font-family: var(--f-retro);
    font-size: 2rem;
}

.noscript-hero a {
    font-weight: 700;
    color: var(--ink);
    background: var(--yellow);
    border: var(--bd);
    box-shadow: 4px 4px 0 var(--ink);
    padding: 0.5em 1em;
    text-decoration: none;
    display: inline-block;
    margin-top: 6px;
}

/* --- responsive ------------------------------------------------------- */

@media (max-width: 640px) {
    .topbar {
        padding: calc(10px + env(safe-area-inset-top)) 12px 0;
    }

    .logo {
        font-size: 0.95rem;
        box-shadow: 4px 4px 0 var(--ink);
    }

    .nbtn-sm {
        padding: 0.45em 0.7em;
        font-size: 0.7rem;
    }

    .tag-inner {
        font-size: 0.72rem;
        padding: 0.45em 0.75em;
    }

    .marquee-chunk {
        font-size: 0.68rem;
        padding: 0.65em 0;
    }

    .hint-jp {
        font-size: 0.85rem;
    }

    .modal-card {
        box-shadow: 8px 8px 0 var(--ink);
    }

    .modal-actions .nbtn-big {
        width: 100%;
        justify-content: center;
    }
}

@media (max-height: 460px) {
    .modal-card {
        max-height: 92vh;
    }
}

/* --- reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .marquee-track {
        animation: none;
    }

    .hint-arrow,
    .tag-inner {
        animation: none;
    }

    .topbar,
    .marquee,
    .nbtn,
    .fb-card,
    .tag-inner {
        transition-duration: 0.01s;
    }
}
