/* ============================================================
   miko.day — styles.css
   Palette:
     Paper         #F2EDE4
     Ash Ink       #4A4640
     Tarnished Brass #9C8C5A
     Dusty Plum    #7A6478
     Cool Graphite #2E2D2B
     Phosphor Signal #7AFF8A
     Aged Grain Base #C8C0B2
     Fog White     #F8F5F0
     Sand Mid      #8A8478
   ============================================================ */

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

html {
    font-size: 14px;
    background: #F2EDE4;
}

body {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    background-color: #F2EDE4;
    color: #4A4640;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* ---- Grain Overlay ---- */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
    opacity: 0.22;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-size: 300px 300px;
    transition: opacity 500ms ease-out;
}

.grain-overlay.grain-intense {
    opacity: 0.35;
}

/* ---- HUD Panel (fixed right edge) ---- */
.hud-panel {
    position: fixed;
    right: 0;
    top: 40%;
    transform: translateY(-50%);
    width: 160px;
    background-color: rgba(46, 45, 43, 0.85);
    padding: 16px 12px;
    z-index: 100;
    font-family: 'Space Mono', monospace;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.hud-panel.hud-visible {
    opacity: 1;
}

.hud-line {
    display: block;
    font-size: 10px;
    line-height: 1.8;
    letter-spacing: 0.1em;
    color: rgba(122, 255, 138, 0.6);
    white-space: nowrap;
}

.hud-label {
    color: rgba(156, 140, 90, 0.8);
    margin-bottom: 4px;
}

.hud-sep {
    color: rgba(138, 132, 120, 0.4);
    font-size: 8px;
    margin: 2px 0;
}

.hud-status {
    color: rgba(156, 140, 90, 0.7);
    letter-spacing: 0.15em;
}

.hud-jp {
    font-family: 'Noto Serif JP', serif;
    font-weight: 300;
    font-size: 12px;
    color: rgba(122, 255, 138, 0.4);
    margin-top: 4px;
}

/* Blinking cursor */
.blink-cursor {
    color: rgba(122, 255, 138, 0.8);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ---- Scroll Canvas ---- */
.scroll-canvas {
    position: relative;
    width: 100%;
}

/* ---- Acts (each ~100vh) ---- */
.act {
    position: relative;
    min-height: 100vh;
    width: 100%;
}

/* ---- ACT I: Signal ---- */
.act-one {
    min-height: 100vh;
    background-color: #F2EDE4;
}

.compass-container {
    position: absolute;
    left: 72%;
    top: 28vh;
    transform: translateX(-50%);
}

.compass-rose {
    display: block;
    filter: drop-shadow(0 0 1px rgba(74, 70, 64, 0.1));
}

.domain-label {
    position: absolute;
    left: 50%;
    top: calc(180px + 24px);
    transform: translateX(-50%);
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.4em;
    color: #8A8478;
    white-space: nowrap;
}

/* ---- ACT II: The Fragments ---- */
.act-two {
    min-height: 200vh;
    background-color: #F2EDE4;
}

.fragment {
    position: absolute;
    max-width: 280px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    line-height: 2;
    color: #4A4640;
    opacity: 0;
    transition: opacity 500ms ease-out;
}

.fragment.revealed {
    opacity: 1;
}

.fragment p {
    margin: 0;
    letter-spacing: 0.08em;
}

.fragment p em {
    font-style: italic;
    color: #8A8478;
}

.fragment-one {
    left: 12%;
    top: 15vh;
}

.fragment-two {
    left: 58%;
    top: 65vh;
}

.fragment-three {
    left: 22%;
    top: 115vh;
}

.caveat-note {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    color: #9C8C5A;
    display: block;
    margin-top: 8px;
    transform: rotate(-1.5deg);
    display: inline-block;
}

/* HUD brackets around fragment-two */
.hud-bracketed {
    position: absolute;
    padding: 16px;
}

.hud-bracketed::before,
.hud-bracketed::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: #9C8C5A;
    border-style: solid;
    border-width: 0;
}

.hud-bracketed::before {
    top: 0;
    left: 0;
    border-top-width: 1px;
    border-left-width: 1px;
}

.hud-bracketed::after {
    bottom: 0;
    right: 0;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

/* Additional pseudo corner brackets via wrapper */
.hud-bracketed > p {
    position: relative;
}

.hud-bracketed > p::before,
.hud-bracketed > p::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-color: #9C8C5A;
    border-style: solid;
    border-width: 0;
}

.hud-bracketed > p::before {
    top: -16px;
    right: -16px;
    border-top-width: 1px;
    border-right-width: 1px;
}

.hud-bracketed > p::after {
    bottom: -16px;
    left: -16px;
    border-bottom-width: 1px;
    border-left-width: 1px;
}

/* Targeting reticle */
.targeting-reticle {
    position: absolute;
    left: 38%;
    top: 148vh;
    width: 64px;
    height: 64px;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.targeting-reticle.revealed {
    opacity: 1;
}

/* CSS-drawn crosshair: four gap-separated line segments */
.targeting-reticle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border: none;
    /* top segment */
    background:
        linear-gradient(#9C8C5A, #9C8C5A) no-repeat center 0 / 0.8px 22px,
        linear-gradient(#9C8C5A, #9C8C5A) no-repeat center 100% / 0.8px 22px,
        linear-gradient(#9C8C5A, #9C8C5A) no-repeat 0 center / 22px 0.8px,
        linear-gradient(#9C8C5A, #9C8C5A) no-repeat 100% center / 22px 0.8px;
}

.targeting-reticle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 0.8px solid rgba(156, 140, 90, 0.5);
}

/* ---- Petal scatter ---- */
.petal {
    position: absolute;
    background-color: #7A6478;
    border-radius: 50% 40% 60% 30%;
    pointer-events: none;
}

/* ---- ACT III: Spring Intrusion ---- */
.act-three {
    min-height: 110vh;
    background-color: #F2EDE4;
    overflow: hidden;
}

.branch-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.branch-container.revealed {
    opacity: 1;
}

.branch-svg {
    width: 100%;
    height: 200px;
}

.branch-annotation {
    position: absolute;
    top: 160px;
    left: 8%;
    opacity: 0;
    transition: opacity 500ms ease-out;
}

.branch-annotation.revealed {
    opacity: 1;
}

.branch-annotation .caveat-note {
    font-size: 15px;
    color: #7A6478;
    transform: rotate(-2deg);
}

/* ---- ACT IV: Data Ghost ---- */
.act-four {
    min-height: 100vh;
    background-color: #F2EDE4;
    position: relative;
}

.hatching-bg {
    position: absolute;
    right: 0;
    top: 10%;
    width: 300px;
    height: 400px;
    opacity: 0;
    transition: opacity 600ms ease-out;
}

.hatching-bg.revealed {
    opacity: 1;
}

.hatching-svg {
    width: 100%;
    height: 100%;
}

/* ---- ACT V: Return ---- */
.act-five {
    min-height: 100vh;
    background-color: #F8F5F0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.act-five-center {
    text-align: center;
}

.final-phrase {
    font-family: 'Space Mono', monospace;
    font-size: 32px;
    font-weight: 400;
    color: #4A4640;
    line-height: 1.6;
    letter-spacing: 0.1em;
    text-align: center;
    position: relative;
    display: inline-block;
    cursor: default;
}

.final-phrase::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #4A4640;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 400ms ease-out;
}

.final-phrase.underlined::after {
    transform: scaleX(1);
}

.jp-char {
    font-family: 'Noto Serif JP', serif;
    font-weight: 300;
    font-size: 28px;
    color: #7A6478;
    display: block;
    margin-top: 4px;
}

/* ---- Scroll Reveal (base state) ---- */
.scroll-reveal {
    opacity: 0;
    transition: opacity 400ms ease-out;
}

.scroll-reveal.revealed {
    opacity: 1;
}

/* Override for elements with their own opacity transitions */
.branch-container.scroll-reveal,
.hatching-bg.scroll-reveal {
    transition: opacity 600ms ease-out;
}
