/* ====================================================
   taisho.day — Wabi-Sabi HUD Interface
   Aurora-gradient on oxidized surfaces
   ==================================================== */

/* @property for aurora animation */
@property --aurora-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ---- CSS Custom Properties ---- */
:root {
    --base-dark: #1a1c2e;
    --base-mid: #2e3028;
    --surface: #e4dfd3;
    --aurora-1: #7ff5c4;
    --aurora-2: #c97dff;
    --aurora-3: #ff9e64;
    --aurora-4: #c8f7dc;
    --crack-line: #4a6741;
    --ghost: #6b6e7a;
    --brass: #8b7d3c;
    --charcoal: #2a2d3a;

    --aurora-angle: 0deg;
    --aurora-speed: 30s;
    --hud-opacity: 1;
    --section-hue-shift: 0;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--base-dark);
    color: var(--surface);
    font-family: 'Literata', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Washi paper texture background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, transparent 40%, rgba(26, 28, 46, 0.6) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(228, 223, 211, 0.008) 2px,
            rgba(228, 223, 211, 0.008) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 3px,
            rgba(228, 223, 211, 0.005) 3px,
            rgba(228, 223, 211, 0.005) 6px
        );
    pointer-events: none;
    z-index: 0;
}

/* Grain overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    pointer-events: none;
    z-index: 0;
}

/* ---- HUD FRAME ---- */
#hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
    opacity: var(--hud-opacity);
    transition: opacity 0.8s ease;
}

.hud-strip {
    position: absolute;
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    background: rgba(26, 28, 46, 0.4);
    pointer-events: auto;
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Crackle texture on HUD strips */
.hud-strip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.15' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23c)' opacity='0.06'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: 0.06;
    pointer-events: none;
}

/* Aurora gradient on HUD strips border */
.hud-strip::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from var(--aurora-angle), #7ff5c4, #c97dff, #ff9e64, #7ff5c4);
    opacity: 0.06;
    pointer-events: none;
    animation: aurora-rotate var(--aurora-speed) linear infinite;
}

@keyframes aurora-rotate {
    from { --aurora-angle: 0deg; }
    to { --aurora-angle: 360deg; }
}

/* Top Strip */
#hud-top {
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    border-bottom: 1px solid rgba(127, 245, 196, 0.1);
    transform: translateY(-100%);
}

#hud-top.active {
    transform: translateY(0);
}

.hud-era-label {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--aurora-4);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.kanji-inline {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: 1.1em;
    margin: 0 0.3em;
}

.hud-sensor {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aurora-1);
    opacity: 0.85;
    text-shadow: 0 0 12px rgba(127, 245, 196, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.sensor-label {
    opacity: 0.6;
}

.sensor-value {
    color: var(--aurora-1);
    font-weight: 400;
}

.sensor-unit {
    opacity: 0.5;
    font-size: 0.65rem;
}

/* Right Strip - Timeline */
#hud-right {
    top: 48px;
    right: 0;
    bottom: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(127, 245, 196, 0.1);
    transform: translateX(100%);
}

#hud-right.active {
    transform: translateX(0);
}

#timeline-svg {
    width: 100%;
    height: 100%;
}

.year-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 7px;
    fill: var(--ghost);
    letter-spacing: 0.05em;
}

.year-notch {
    cursor: pointer;
    pointer-events: auto;
    transition: opacity 0.3s;
}

.year-notch.active line {
    stroke: var(--aurora-1);
    stroke-width: 2;
}

.year-notch.active text {
    fill: var(--aurora-1);
}

/* Bottom Strip */
#hud-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px;
    border-top: 1px solid rgba(127, 245, 196, 0.1);
    transform: translateY(100%);
}

#hud-bottom.active {
    transform: translateY(0);
}

.hud-section-readout {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--aurora-1);
    opacity: 0.85;
    text-shadow: 0 0 12px rgba(127, 245, 196, 0.3);
}

.progress-leaf {
    width: 30px;
    height: 36px;
}

/* Left Strip */
#hud-left {
    top: 48px;
    left: 0;
    bottom: 48px;
    width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    border-right: 1px solid rgba(127, 245, 196, 0.1);
    transform: translateX(-100%);
}

#hud-left.active {
    transform: translateX(0);
}

.kanji-vert {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--aurora-4);
    writing-mode: vertical-rl;
    animation: kanji-glow 8s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(127, 245, 196, 0.2);
}

#kanji-dai { animation-delay: 0s; }
#kanji-sho { animation-delay: 2.66s; }
#kanji-nichi { animation-delay: 5.33s; }

@keyframes kanji-glow {
    0%, 100% { 
        text-shadow: 0 0 15px rgba(127, 245, 196, 0.15);
        opacity: 0.7;
    }
    50% { 
        text-shadow: 0 0 25px rgba(127, 245, 196, 0.4), 0 0 50px rgba(201, 125, 255, 0.15);
        opacity: 1;
    }
}

/* HUD crack overlay */
.hud-crack-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 110;
}

.hud-crack-overlay path {
    transition: opacity 1s ease;
}

/* ---- CONTENT WELL ---- */
#content-well {
    position: relative;
    z-index: 1;
    padding: 0 48px;
}

.content-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px 0;
}

#section-initializing {
    min-height: 100vh;
}

#section-era {
    min-height: 120vh;
}

#section-democracy {
    min-height: 120vh;
}

#section-culture {
    min-height: 140vh;
}

#section-earthquake {
    min-height: 100vh;
}

#section-twilight {
    min-height: 100vh;
}

#section-decommission {
    min-height: 80vh;
}

.section-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* ---- SECTION 1: INITIALIZING ---- */
.initializing-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 100%;
}

.hero-kanji {
    width: clamp(300px, 60vw, 600px);
    height: auto;
}

.hero-kanji-text {
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    font-size: 120px;
    transition: stroke-dashoffset 3s ease-out;
}

.hero-kanji-text.drawn {
    stroke-dashoffset: 0;
    fill-opacity: 1;
}

.initializing-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--aurora-1);
    opacity: 0;
    margin-top: 2rem;
    text-shadow: 0 0 12px rgba(127, 245, 196, 0.3);
    transition: opacity 1s ease 2.5s;
}

.initializing-subtitle.visible {
    opacity: 0.7;
}

/* ---- SECTION HEADINGS ---- */
.section-heading {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: var(--aurora-4);
    margin-bottom: 2rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
    font-variation-settings: 'WONK' 0, 'SOFT' 50;
    transition: font-variation-settings 0.6s ease;
}

.section-heading:hover {
    font-variation-settings: 'WONK' 1, 'SOFT' 100;
}

.earthquake-heading {
    color: var(--aurora-3);
}

/* ---- BODY TEXT ---- */
.body-text {
    margin-bottom: 1.8rem;
    color: var(--surface);
    max-width: 65ch;
}

.body-text em {
    font-style: italic;
    color: var(--aurora-2);
}

.body-text strong {
    font-weight: 600;
    color: var(--aurora-4);
}

/* ---- NARRATIVE PANEL ---- */
.narrative-panel {
    position: relative;
}

/* ---- SPLIT PANEL ---- */
.split-panel {
    display: flex;
    gap: 3rem;
    max-width: 1000px;
}

.split-main {
    flex: 3;
}

.split-aside {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inline-split {
    margin: 2rem 0;
}

/* ---- GLASSMORPHIC CARDS ---- */
.glass-card {
    position: relative;
    backdrop-filter: blur(20px) brightness(1.1);
    -webkit-backdrop-filter: blur(20px) brightness(1.1);
    background: rgba(30, 28, 46, 0.35);
    border: 1px solid rgba(127, 245, 196, 0.15);
    border-radius: 4px;
    padding: 1.5rem;
    margin: 2rem 0;
    overflow: hidden;
    transform: scale(1);
    filter: brightness(1);
    transition: transform 0.6s ease, filter 0.6s ease;
}

.glass-card.pulsed {
    animation: pulse 0.8s ease-out;
}

@keyframes pulse {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.03); filter: brightness(1.15); }
    100% { transform: scale(1); filter: brightness(1); }
}

.card-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-1);
    opacity: 0.7;
    display: block;
    margin-bottom: 0.75rem;
    text-shadow: 0 0 8px rgba(127, 245, 196, 0.2);
}

.card-content {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--surface);
}

.card-content strong {
    color: var(--aurora-4);
    font-weight: 600;
}

.card-crack {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
}

/* Earthquake card variation */
.earthquake-card {
    border-color: rgba(255, 158, 100, 0.25);
    background: rgba(46, 28, 20, 0.4);
}

.earthquake-card .card-label {
    color: var(--aurora-3);
    text-shadow: 0 0 8px rgba(255, 158, 100, 0.3);
}

/* Twilight card variation */
.twilight-card {
    opacity: 0.8;
}

/* ---- CRACK DIVIDERS ---- */
.crack-divider {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 48px;
}

.crack-svg {
    width: 100%;
    height: 20px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.crack-svg.visible {
    opacity: 1;
}

.crack-svg.pulsed {
    animation: crack-pulse 1s ease-out;
}

@keyframes crack-pulse {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.8); }
    100% { filter: brightness(1); }
}

/* ---- EARTHQUAKE SPECIFIC ---- */
.earthquake-panel {
    position: relative;
}

.earthquake-crack {
    width: 100%;
    height: 20px;
    margin: 1rem 0;
}

/* ---- INSTRUMENT DIALS ---- */
.instrument-dial {
    position: absolute;
    pointer-events: none;
}

.seismic-dial {
    width: 100px;
    height: 100px;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
}

.instrument-pair {
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.humidity-dial,
.light-dial {
    width: 80px;
    height: 80px;
}

/* ---- LEAF MOTIFS ---- */
.pressed-leaf {
    position: absolute;
    pointer-events: none;
}

.leaf-bg-1 {
    width: 200px;
    height: 240px;
    right: -60px;
    top: 20%;
}

/* Living leaves - cultural section */
.floating-leaves {
    position: relative;
    height: 120px;
    margin: 2rem 0;
}

.living-leaf {
    position: absolute;
    animation: leaf-drift 12s ease-in-out infinite;
}

.leaf-1 {
    width: 50px;
    left: 10%;
    top: 0;
    animation-delay: 0s;
}

.leaf-2 {
    width: 40px;
    left: 45%;
    top: 20px;
    animation-delay: -4s;
}

.leaf-3 {
    width: 35px;
    left: 75%;
    top: 10px;
    animation-delay: -8s;
}

@keyframes leaf-drift {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(3deg) translateY(-8px); }
}

/* Skeleton leaf */
.skeleton-leaf {
    width: 120px;
    height: 160px;
}

.vein-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease;
}

.skeleton-leaf.drawn .vein-path {
    stroke-dashoffset: 0;
}

/* Pamphlet illustration */
.pamphlet-illustration {
    width: 100%;
    max-width: 200px;
    height: auto;
}

/* Twilight leaves */
.twilight-leaves {
    position: relative;
    height: 140px;
    margin: 2rem 0;
    display: flex;
    align-items: center;
    gap: 3rem;
    justify-content: center;
}

.twilight-leaf-1 {
    width: 100px;
    height: 120px;
    position: relative;
}

.twilight-leaf-2 {
    width: 80px;
    height: 100px;
    position: relative;
}

/* ---- SECTION 7: DECOMMISSION ---- */
.decommission-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.decommission-dates {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.decom-year {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--aurora-4);
    opacity: 0.6;
    line-height: 1;
}

.decom-dash {
    font-family: 'Fraunces', serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--ghost);
    opacity: 0.4;
}

.decommission-text {
    font-family: 'Literata', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    color: var(--ghost);
    max-width: 50ch;
    line-height: 1.8;
    opacity: 0.7;
}

/* ---- HUD CORNER LEAVES ---- */
.hud-corner-leaf {
    position: fixed;
    z-index: 101;
    pointer-events: none;
    animation: leaf-drift 15s ease-in-out infinite;
}

.hud-corner-leaf.top-left {
    top: 56px;
    left: 56px;
    width: 30px;
    height: 36px;
}

.hud-corner-leaf.bottom-right {
    bottom: 56px;
    right: 56px;
    width: 25px;
    height: 30px;
    animation-delay: -7s;
}

/* ---- SVG FILTERS ---- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    #hud-top,
    #hud-bottom {
        padding: 0 1rem;
        height: 40px;
    }

    #hud-left,
    #hud-right {
        width: 36px;
    }

    #content-well {
        padding: 0 36px;
    }

    .section-inner {
        padding: 1rem;
    }

    .split-panel {
        flex-direction: column;
    }

    .split-aside {
        max-height: 300px;
    }

    .inline-split {
        flex-direction: column;
    }

    .instrument-dial,
    .instrument-pair {
        display: none;
    }

    .pressed-leaf.leaf-bg-1 {
        display: none;
    }

    .hud-sensor {
        display: none;
    }

    .crack-divider {
        height: 100px;
    }

    .hud-corner-leaf {
        display: none;
    }
}

@media (max-width: 480px) {
    #hud-left {
        display: none;
    }

    #hud-right {
        width: 28px;
    }

    #content-well {
        padding: 0 28px 0 8px;
    }

    .section-heading {
        font-size: clamp(1.8rem, 8vw, 3rem);
    }
}

/* ---- BODY STATE: EARTHQUAKE ---- */
body.earthquake-active {
    --aurora-3-dominant: 1;
}

body.earthquake-active .glass-card:not(.earthquake-card) {
    border-color: rgba(255, 158, 100, 0.12);
}

/* ---- BODY STATE: DECOMMISSION ---- */
body.decommission-active #hud-frame {
    opacity: 0.3;
}

body.decommission-active .kanji-vert {
    animation-play-state: paused;
    opacity: 0.3;
}

body.decommission-active .hud-corner-leaf {
    opacity: 0.1;
}

/* ---- TRANSITIONS FOR SECTION VISIBILITY ---- */
.content-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Section 1 is always visible initially */
#section-initializing {
    opacity: 1;
    transform: translateY(0);
}
