/* ─────────── JAPANESE TYPEWRITER ─────────── *
   Vertical kanji typed character-by-character with a red typewriter
   striker, sitting behind the travel page. Cycles through travel
   phrases — 4+ characters each.
   ──────────────────────────────────────────────────────────── */

.jp-typewriter {
    position: fixed;
    top: 116px;
    right: clamp(12px, 3vw, 56px);
    bottom: 96px;
    width: clamp(120px, 12vw, 180px);
    z-index: 1;
    pointer-events: none;
    overflow: hidden;

    /* OUTER container is in normal (horizontal-tb) flow so we can stack
       the kanji column + romaji whisper using a regular flex column. */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;

    font-family: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN",
                 "Yu Mincho", serif;
    font-weight: 600;
    font-size: clamp(40px, 4.6vw, 64px);
    line-height: 1.35;
    letter-spacing: 0.08em;

    color: var(--ink);
    opacity: 0;
    mix-blend-mode: multiply;
    transition: opacity 0.8s ease;
}

.jp-typewriter.in { opacity: 0.42; }

html[data-theme="dark"] .jp-typewriter {
    mix-blend-mode: screen;
}
html[data-theme="dark"] .jp-typewriter.in { opacity: 0.55; }

/* (Decorative margin line removed — keep the column visually clean.) */

/* ── Kanji column — vertical-rl writing mode ── */
.jp-col {
    /* This is where vertical text actually happens.
       Spans inside are inline and flow top-to-bottom naturally. */
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: relative;
    padding: 28px 12px 0;
    max-height: 100%;
}

.jp-col .jp-char {
    display: inline;
    opacity: 0;
    transition: opacity 0.10s linear;
}
.jp-col .jp-char.in  { opacity: 1; }
.jp-col .jp-char.out { opacity: 0; transition: opacity 0.30s ease; }

/* ── The red typewriter striker ── *
   A chunky bar that sits just below the most recently typed character,
   with a small "type-slug" extension and a faint paper-bite impression. */
.jp-striker {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 1.15em;
    height: 5px;
    background: var(--accent);
    transition: top 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 0 12px rgba(122, 22, 32, 0.65),
        0 0 24px rgba(122, 22, 32, 0.3);
    opacity: 0.95;
    z-index: 3;
}
.jp-striker::before {
    /* Slug indicator to the right — the type-bar coming forward */
    content: "";
    position: absolute;
    top: 50%; right: -16px;
    transform: translateY(-50%);
    width: 12px;
    height: 2px;
    background: var(--accent);
    opacity: 0.7;
}
.jp-striker::after {
    /* Faint paper-bite impression under the striker */
    content: "";
    position: absolute;
    top: 9px; left: 50%;
    transform: translateX(-50%);
    width: 1em;
    height: 1px;
    background: var(--accent);
    opacity: 0.3;
}
.jp-striker.idle {
    opacity: 0.55;
    box-shadow: 0 0 6px rgba(122, 22, 32, 0.4);
}
.jp-striker.hidden { opacity: 0; }

/* ── Romaji whisper below the kanji column ── *
   Read horizontally, very small, oxblood-tinted. */
.jp-romaji {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--accent);
    text-align: center;
    max-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-weight: 500;
    line-height: 1.3;
    /* Wrap if a long romaji line overflows */
    word-break: break-word;
}
.jp-romaji.in { opacity: 0.85; }

/* Hide on tablets and below — would crowd narrow layouts */
@media (max-width: 1020px) {
    .jp-typewriter { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .jp-col .jp-char,
    .jp-striker { transition: none; box-shadow: none; }
}
