/* ==========================================================
   heisei.day — Museum-quality chronicle
   Palette:
     #f8f4ee  warm museum white (bg)
     #2c2418  rich dark brown (text)
     #9e8a6c  warm bronze (timeline)
     #c67a50  terracotta (warm accent)
     #5a7a94  slate blue (cool accent)
     #b5a08e  soft umber (frame)
     #f0ebe0  light oat (alt section bg)
     #8898aa  cool gray-blue (transition)
     #eef0f4  cool light (gradient endpoint)
   ========================================================== */

:root {
    --bg: #f8f4ee;
    --bg-alt: #f0ebe0;
    --bg-cool: #eef0f4;
    --text: #2c2418;
    --bronze: #9e8a6c;
    --terracotta: #c67a50;
    --slate: #5a7a94;
    --umber: #b5a08e;
    --cool-gray: #8898aa;

    --font-jp-display: "Noto Serif JP", "Hiragino Mincho ProN", serif;
    --font-jp-body: "Noto Sans JP", "Hiragino Sans", sans-serif;
    --font-en-display: "DM Serif Display", "Source Serif 4", serif;
    --font-en-body: "Source Serif 4", Georgia, serif;
    --font-mono: "DM Mono", ui-monospace, monospace;

    --max-w: 1100px;
}

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

html, body {
    background: #f8f4ee;
    color: #2c2418;
    font-family: var(--font-en-body);
    font-size: 16px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    overflow-x: hidden;
    position: relative;
}

p { font-weight: 400; }
em { font-style: italic; color: #c67a50; }

/* ===========================
   TIMELINE SPINE (right edge)
   =========================== */
.timeline-spine {
    position: fixed;
    top: 0;
    right: 8%;
    bottom: 0;
    width: 60px;
    pointer-events: none;
    z-index: 5;
}
.spine-line {
    position: absolute;
    top: 8vh;
    bottom: 8vh;
    left: 50%;
    width: 1px;
    background: linear-gradient(to bottom, #9e8a6c 0%, #9e8a6c 60%, #5a7a94 100%);
    transform: translateX(-50%);
}
.spine-years {
    list-style: none;
    position: absolute;
    top: 8vh;
    bottom: 8vh;
    left: 0;
    right: 0;
}
.spine-years li {
    position: absolute;
    top: var(--p);
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 14px;
    white-space: nowrap;
}
.spine-years li .dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9e8a6c;
    box-shadow: 0 0 0 3px #f8f4ee;
    transition: background 0.6s ease, transform 0.6s ease;
}
.spine-years li.is-active .dot {
    background: #c67a50;
    transform: scale(1.4);
}
.spine-years li .year {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: #9e8a6c;
    transform: translateX(8px);
    transition: color 0.6s ease;
}
.spine-years li.is-active .year { color: #2c2418; }

@media (max-width: 900px) {
    .timeline-spine { right: 12px; }
    .spine-years li .year { font-size: 0.7rem; }
}

/* ===========================
   HERO — Era Stamp
   =========================== */
.hero {
    position: relative;
    min-height: 100vh;
    padding: 12vh 8vw 8vh;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    overflow: hidden;
}
.hero-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.03;
    pointer-events: none;
}
.hero-watermark svg {
    width: 40vw;
    min-width: 320px;
    height: auto;
}
.hero-inner {
    position: relative;
    max-width: 720px;
    padding-left: 4vw;
}
.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #9e8a6c;
    margin-bottom: 3rem;
}
.hero-kanji {
    font-family: var(--font-jp-display);
    font-weight: 700;
    font-size: clamp(5rem, 18vw, 16rem);
    line-height: 1;
    color: #2c2418;
    letter-spacing: 0.04em;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 0.02em rgba(198, 122, 80, 0.15);
}
.hero-romaji {
    font-family: var(--font-en-display);
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    color: #c67a50;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 1.6rem;
}
.hero-translation {
    font-family: var(--font-en-body);
    font-size: 1.05rem;
    color: #2c2418;
    max-width: 36ch;
    opacity: 0.85;
}

/* Hero edge: thin vertical timeline preview right column */
.hero-edge {
    position: relative;
    height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding-right: 3vw;
}
.hero-edge .edge-rule {
    flex: 1;
    width: 1px;
    background: linear-gradient(to bottom, #9e8a6c, #b5a08e);
    margin: 12px 0;
}
.hero-edge .edge-year {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: #9e8a6c;
}

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding: 10vh 6vw 6vh; }
    .hero-edge { display: none; }
}

/* ===========================
   INTRO
   =========================== */
.intro {
    max-width: var(--max-w);
    margin: 6rem auto 4rem;
    padding: 0 6vw;
}
.intro-inner {
    max-width: 720px;
    margin: 0 auto;
}
.intro-lead {
    font-family: var(--font-en-display);
    font-size: clamp(1.25rem, 2.2vw, 1.6rem);
    line-height: 1.65;
    color: #2c2418;
    text-align: center;
    letter-spacing: 0.005em;
}

/* Section separator (diamond on a thin rule) */
.separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 6rem auto 6rem;
    width: 100%;
}
.separator .sep-line {
    width: 80px;
    height: 1px;
    background: #9e8a6c;
}
.separator .sep-diamond {
    width: 8px;
    height: 8px;
    background: #9e8a6c;
    transform: rotate(45deg);
}

/* ===========================
   CHRONICLE SPREAD
   =========================== */
.spread {
    max-width: var(--max-w);
    margin: 4rem auto;
    padding: 0 6vw;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    min-height: 80vh;
    align-items: center;
}
.spread-even .spread-text { order: 1; }
.spread-even .spread-illu { order: 2; }
.spread-odd .spread-illu { order: 1; }
.spread-odd .spread-text { order: 2; }

.spread-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: #9e8a6c;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}
.spread-jp {
    font-family: var(--font-jp-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.4rem);
    color: #2c2418;
    margin-bottom: 0.6rem;
    letter-spacing: 0.04em;
    line-height: 1.2;
}
.spread-en {
    font-family: var(--font-en-display);
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.7rem);
    color: #c67a50;
    margin-bottom: 1.8rem;
    letter-spacing: 0.01em;
    line-height: 1.3;
}
.spread-body {
    font-family: var(--font-en-body);
    font-size: 1rem;
    line-height: 1.85;
    color: #2c2418;
    margin-bottom: 1.4rem;
    max-width: 38ch;
}
.spread-body em { font-style: italic; color: #9e8a6c; }

/* Frame for line illustrations */
.frame {
    aspect-ratio: 1;
    border: 1px solid #b5a08e;
    background: #f0ebe0;
    padding: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    position: relative;
}
.frame::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px dashed rgba(158, 138, 108, 0.25);
    pointer-events: none;
}
.frame:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -20px rgba(44, 36, 24, 0.25);
}
.line-illu {
    width: 80%;
    max-width: 260px;
    height: auto;
    display: block;
}
.frame-caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: #9e8a6c;
    text-transform: uppercase;
    text-align: center;
}

@media (max-width: 900px) {
    .spread {
        grid-template-columns: 1fr;
        gap: 40px;
        min-height: auto;
        margin: 3rem auto;
    }
    .spread-even .spread-text,
    .spread-odd .spread-text { order: 2; }
    .spread-even .spread-illu,
    .spread-odd .spread-illu { order: 1; }
    .frame { max-width: 360px; margin: 0 auto; }
}

/* ===========================
   OBJECT GALLERY
   =========================== */
.gallery-section {
    background: #f0ebe0;
    padding: 8rem 0 7rem;
    margin: 4rem 0;
    position: relative;
}
.gallery-header {
    max-width: var(--max-w);
    margin: 0 auto 3rem;
    padding: 0 6vw;
    text-align: center;
}
.gallery-title-jp {
    font-family: var(--font-jp-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    color: #2c2418;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}
.gallery-title-en {
    font-family: var(--font-en-display);
    font-weight: 400;
    font-size: 1.4rem;
    color: #c67a50;
    letter-spacing: 0.04em;
}
.object-gallery {
    display: flex;
    gap: 32px;
    overflow-x: auto;
    padding: 40px 6vw;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #9e8a6c transparent;
    cursor: grab;
}
.object-gallery::-webkit-scrollbar { height: 6px; }
.object-gallery::-webkit-scrollbar-track { background: transparent; }
.object-gallery::-webkit-scrollbar-thumb { background: #b5a08e; border-radius: 3px; }

.frame-sm {
    min-width: 220px;
    width: 220px;
    aspect-ratio: 1;
    border: 1px solid #b5a08e;
    background: #f8f4ee;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: transform 0.5s ease, border-color 0.5s ease;
    position: relative;
}
.frame-sm:hover {
    transform: translateY(-3px);
    border-color: #c67a50;
}
.frame-sm svg { width: 70%; height: 70%; }
.frame-sm figcaption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: #9e8a6c;
    text-transform: uppercase;
    text-align: center;
}

/* ===========================
   CODA — Heisei → Reiwa
   =========================== */
.coda {
    background: linear-gradient(to bottom, #f8f4ee 0%, #eef0f4 100%);
    padding: 12rem 6vw;
    text-align: center;
    margin-top: 4rem;
    transition: background 1s ease;
}
.coda-inner {
    max-width: 780px;
    margin: 0 auto;
}
.coda-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: #8898aa;
    text-transform: uppercase;
    margin-bottom: 3rem;
}
.coda-kanji-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 3rem;
}
.coda-kanji {
    font-family: var(--font-jp-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4.4rem);
    letter-spacing: 0.08em;
    line-height: 1.2;
    transition: opacity 1.2s ease, color 1.2s ease, filter 1.2s ease;
}
.coda-kanji-from {
    color: #2c2418;
}
.coda-kanji-to {
    color: #5a7a94;
    opacity: 0.35;
    filter: blur(1px);
}
.coda.is-revealed .coda-kanji-from {
    opacity: 0.25;
    color: #9e8a6c;
    filter: blur(1px);
}
.coda.is-revealed .coda-kanji-to {
    opacity: 1;
    filter: blur(0);
}
.coda-arrow {
    font-family: var(--font-en-body);
    font-size: 1.4rem;
    color: #8898aa;
    transition: transform 1.2s ease;
}
.coda.is-revealed .coda-arrow {
    transform: translateY(6px);
    color: #5a7a94;
}
.coda-body {
    font-family: var(--font-en-body);
    font-size: 1.05rem;
    line-height: 1.85;
    color: #2c2418;
    max-width: 56ch;
    margin: 0 auto 2rem;
}
.coda-sig {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: #8898aa;
    text-transform: uppercase;
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
    background: #eef0f4;
    padding: 3rem 6vw;
    text-align: center;
    border-top: 1px solid #b5a08e;
}
.site-footer p {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: #8898aa;
    text-transform: uppercase;
}

/* ===========================
   ENTER ANIMATIONS (subtle)
   =========================== */
.spread, .gallery-section, .coda, .intro {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 1.1s ease, transform 1.1s ease;
}
.spread.is-visible, .gallery-section.is-visible, .coda.is-visible, .intro.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.hero-kanji {
    animation: heroFadeIn 1.6s ease forwards;
}
@keyframes heroFadeIn {
    0% { opacity: 0; transform: translateY(20px); letter-spacing: 0.12em; }
    100% { opacity: 1; transform: translateY(0); letter-spacing: 0.04em; }
}
