/* shinonome.moe — broken pastoral cottagecore split-screen */

:root {
    /* Hayfield (warm) */
    --vellum: #F4ECD8;
    --ink: #3D2914;
    --sienna: #A6512B;
    /* Reception (cold) */
    --tx-black: #0A0E0F;
    --phosphor: #EDE6D2;
    --aber-red: #FF2E63;
    --aber-cyan: #00E5C7;
    /* Shared */
    --pollen: #E9C46A;
    --seam: #EDE6D2;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--tx-black);
    color: var(--phosphor);
    font-family: 'Caveat', cursive;
}

/* ============== SHELL ============== */
.shell {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

/* ============== PANES ============== */
.pane {
    position: relative;
    height: 100vh;
    overflow: hidden;
}

.pane-warm {
    background: var(--vellum);
    color: var(--ink);
    background-image:
        radial-gradient(ellipse at 18% 22%, rgba(166, 81, 43, 0.07), transparent 60%),
        radial-gradient(ellipse at 82% 78%, rgba(166, 81, 43, 0.06), transparent 60%),
        linear-gradient(180deg, #F6EEDB 0%, #EFE5CD 100%);
}

.pane-cold {
    background: var(--tx-black);
    color: var(--phosphor);
}

/* ============== PAPER GRAIN ============== */
.paper-grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.5;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.24  0 0 0 0 0.16  0 0 0 0 0.08  0 0 0 0.18 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
}

/* Washi tape strips */
.washi-tape {
    position: absolute;
    width: 140px;
    height: 22px;
    background: rgba(166, 81, 43, 0.18);
    background-image:
        repeating-linear-gradient(45deg, rgba(233, 196, 106, 0.4) 0 4px, transparent 4px 8px);
    border-left: 1px dashed rgba(61, 41, 20, 0.35);
    border-right: 1px dashed rgba(61, 41, 20, 0.35);
    pointer-events: none;
    z-index: 4;
}
.washi-1 {
    top: 28px;
    left: 12%;
    transform: rotate(-5deg);
}
.washi-2 {
    bottom: 36px;
    left: 28%;
    transform: rotate(3deg);
}

/* Postal mark */
.postal-mark {
    position: absolute;
    bottom: 18px;
    right: 24px;
    width: 92px;
    height: 92px;
    border: 1.2px solid var(--sienna);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sienna);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.78rem;
    text-align: center;
    transform: rotate(-12deg);
    opacity: 0.55;
    z-index: 3;
    pointer-events: none;
}
.postal-mark::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 0.6px dashed var(--sienna);
    border-radius: 50%;
    opacity: 0.6;
}

/* ============== CRT VIGNETTE + SCANLINES ============== */
.crt-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
}
.scanlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 7;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(237, 230, 210, 0.04) 0px,
        rgba(237, 230, 210, 0.04) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.55;
}

/* ============== PAGES (scroll-snap container) ============== */
.pages {
    position: absolute;
    inset: 0;
    overflow: hidden;
    scroll-snap-type: y mandatory;
    transform: translateY(0);
    transition: transform 380ms cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.page {
    position: absolute;
    left: 0;
    right: 0;
    height: 100vh;
    padding: 5vh 7vw 5vh 5vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === WARM PAGE === */
.pane-warm .page {
    color: var(--ink);
}
.pane-warm .page.right-pad {
    padding-right: 9vw;
}

.hour-plate {
    font-family: 'Homemade Apple', cursive;
    font-size: clamp(2.4rem, 4vw, 3.6rem);
    color: var(--ink);
    line-height: 1;
    margin-bottom: 0.6em;
    position: relative;
    display: inline-block;
}
.hour-plate::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 0.4em;
    width: 110%;
    height: 0.6em;
    background: rgba(233, 196, 106, 0.35);
    z-index: -1;
    transform: skewX(-3deg);
}

.hour-sub {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--sienna);
    font-size: clamp(0.92rem, 1.1vw, 1.05rem);
    margin-bottom: 1.4em;
    letter-spacing: 0.04em;
}

.diary-body {
    font-family: 'Caveat', cursive;
    font-size: clamp(1.25rem, 1.6vw + 1rem, 1.6rem);
    line-height: 1.85;
    color: var(--ink);
    max-width: 92%;
}

.diary-body p {
    margin-bottom: 0.9em;
}

.diary-body .latin {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    color: var(--sienna);
    font-size: 0.86em;
    margin: 0 0.18em;
}

.diary-body .ink-bleed {
    text-shadow: 0.6px 0.4px 0.6px rgba(61, 41, 20, 0.4);
}

.diary-body .glitch-bleed {
    position: relative;
    color: var(--ink);
}
.diary-body .glitch-bleed.bleeding::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    color: var(--aber-cyan);
    transform: translate(-1.2px, 0);
    opacity: 0.7;
    pointer-events: none;
}
.diary-body .glitch-bleed.bleeding::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    color: var(--aber-red);
    transform: translate(1.2px, 0);
    opacity: 0.7;
    pointer-events: none;
}

/* Pressed flora scrap card */
.scrap-card {
    position: absolute;
    width: 140px;
    height: 170px;
    background: #FFF7E2;
    border: 1px solid rgba(166, 81, 43, 0.3);
    box-shadow: 2px 4px 8px rgba(61, 41, 20, 0.15);
    padding: 14px 10px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    z-index: 2;
}
.scrap-card::before,
.scrap-card::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: rgba(166, 81, 43, 0.6);
    border-style: solid;
    border-width: 0;
}
.scrap-card::before {
    top: 2px;
    left: 2px;
    border-top-width: 2px;
    border-left-width: 2px;
}
.scrap-card::after {
    bottom: 2px;
    right: 2px;
    border-bottom-width: 2px;
    border-right-width: 2px;
}
.scrap-card .photo-corner-tr,
.scrap-card .photo-corner-bl {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: rgba(166, 81, 43, 0.6);
    border-style: solid;
    border-width: 0;
}
.scrap-card .photo-corner-tr {
    top: 2px;
    right: 2px;
    border-top-width: 2px;
    border-right-width: 2px;
}
.scrap-card .photo-corner-bl {
    bottom: 2px;
    left: 2px;
    border-bottom-width: 2px;
    border-left-width: 2px;
}
.scrap-card .flora-warm {
    width: 84px;
    height: 84px;
    color: var(--sienna);
    fill: rgba(233, 196, 106, 0.45);
    stroke: var(--sienna);
    stroke-width: 1.2;
}
.scrap-card .flora-warm path,
.scrap-card .flora-warm ellipse,
.scrap-card .flora-warm circle {
    fill: rgba(233, 196, 106, 0.5);
    stroke: var(--sienna);
}
.scrap-card .flora-label {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.78rem;
    color: var(--sienna);
    text-align: center;
    line-height: 1.1;
}
.scrap-card .common-name {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    color: var(--ink);
    margin-bottom: 2px;
}

.scrap-cluster {
    position: relative;
    margin-top: 2.2em;
    height: 180px;
}

/* Card placements */
.scrap-card.c1 { top: 0; left: 4%; transform: rotate(-3deg); }
.scrap-card.c2 { top: 10px; left: 32%; transform: rotate(2deg); }
.scrap-card.c3 { top: -10px; left: 58%; transform: rotate(-1.5deg); }
.scrap-card.c4 { top: 24px; left: 76%; transform: rotate(4deg); }

/* Epigraph (cross-pane) */
.epigraph {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: clamp(0.9rem, 1vw, 1.06rem);
    color: var(--sienna);
    margin-top: 1.4em;
    max-width: 88%;
    border-left: 1px solid rgba(166, 81, 43, 0.4);
    padding-left: 12px;
}

/* === COLD PAGE === */
.pane-cold .page {
    color: var(--phosphor);
    padding-left: 9vw;
    padding-right: 5vw;
    font-family: 'VT323', monospace;
}

.pane-cold .hour-plate {
    color: var(--phosphor);
    font-family: 'VT323', monospace;
    font-size: clamp(2rem, 3.4vw, 2.8rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.pane-cold .hour-plate::after {
    display: none;
}
.pane-cold .hour-sub {
    color: var(--aber-cyan);
    font-family: 'VT323', monospace;
    font-style: normal;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.tx-body {
    font-family: 'VT323', monospace;
    font-size: clamp(1.05rem, 1.3vw + 0.85rem, 1.35rem);
    letter-spacing: 0.04em;
    line-height: 1.55;
    color: var(--phosphor);
    text-shadow: 0 0 4px rgba(237, 230, 210, 0.18);
    max-width: 92%;
}
.tx-body p {
    margin-bottom: 0.6em;
    min-height: 1.2em;
}

.tx-body .latin {
    color: var(--pollen);
}

/* Chromatic split applied via JS toggling .glitch-on classes */
.tx-body .ghost {
    position: relative;
    display: inline-block;
}
.tx-body .ghost::before,
.tx-body .ghost::after {
    content: attr(data-char);
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}
.tx-body .ghost::before {
    color: var(--aber-red);
    transform: translate(calc(var(--gx, 0.6px) * -1), 0);
    opacity: 0.78;
    mix-blend-mode: screen;
}
.tx-body .ghost::after {
    color: var(--aber-cyan);
    transform: translate(var(--gx, 0.6px), 0);
    opacity: 0.78;
    mix-blend-mode: screen;
}

/* ASCII lattice grid */
.lattice {
    position: relative;
    margin-top: 1.6em;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 1.1em;
    gap: 0;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    line-height: 1.1;
    color: var(--phosphor);
    max-width: 88%;
}
.lattice span {
    text-align: center;
    opacity: 0;
    transition: opacity 220ms ease-out;
}
.lattice.assembled span {
    opacity: 0.86;
}

/* Right-pane epigraph */
.pane-cold .epigraph {
    color: var(--pollen);
    border-left-color: rgba(233, 196, 106, 0.4);
    font-family: 'VT323', monospace;
    font-style: normal;
    margin-top: 1.4em;
}

/* ============== SEAM ============== */
.seam {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: var(--seam);
    z-index: 50;
    box-shadow: 0 0 6px rgba(237, 230, 210, 0.25);
    pointer-events: none;
}

/* ============== ANCHOR ICONS (seam) ============== */
.anchor-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 40;
}
.anchor {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22vh;
    height: 22vh;
    max-width: 220px;
    max-height: 220px;
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0;
    transition: opacity 600ms ease-out, transform 600ms ease-out;
    overflow: visible;
}
.anchor.active {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1);
}
.anchor .anchor-right {
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 600ms ease-out 100ms, transform 600ms ease-out 100ms;
}
.anchor.active .anchor-right {
    opacity: 1;
    transform: translateX(0);
}

/* ============== REC DOT ============== */
.rec-dot {
    position: absolute;
    bottom: 24px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 60;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.14em;
    color: var(--pollen);
}
.rec-circle {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--pollen);
    animation: rec-pulse 2s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(233, 196, 106, 0.5);
}
@keyframes rec-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(233, 196, 106, 0.65); }
    50% { opacity: 0.35; box-shadow: 0 0 3px rgba(233, 196, 106, 0.25); }
}

/* ============== SIGNAL META ============== */
.signal-meta {
    position: absolute;
    top: 22px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 60;
    font-family: 'VT323', monospace;
    font-size: 0.86rem;
    color: var(--phosphor);
    letter-spacing: 0.1em;
    opacity: 0.7;
}
.meta-line {
    text-align: right;
}
#metaSig { color: var(--pollen); }

/* ============== HISS TOGGLE ============== */
.hiss-toggle {
    position: absolute;
    bottom: 24px;
    left: calc(50% + 14px);
    background: transparent;
    border: 1px solid rgba(233, 196, 106, 0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 220ms ease;
}
.hiss-toggle:hover {
    border-color: var(--pollen);
}
.hiss-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(233, 196, 106, 0.4);
    transition: background 220ms ease;
}
.hiss-toggle.on .hiss-dot {
    background: var(--pollen);
    box-shadow: 0 0 6px rgba(233, 196, 106, 0.7);
}

/* ============== HOUR SPINE ============== */
.hour-spine {
    position: absolute;
    top: 50%;
    left: calc(50% - 14px);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 60;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 0.78rem;
    color: rgba(61, 41, 20, 0.55);
}
.hour-mark {
    cursor: pointer;
    text-align: right;
    padding-right: 4px;
    transition: color 280ms ease, transform 280ms ease;
}
.hour-mark.active {
    color: var(--sienna);
    transform: scale(1.3);
}

/* ============== GLITCH STATES ============== */
.pane-cold.glitching-mild .tx-body {
    animation: chroma-mild 4s steps(8) infinite;
}
.pane-cold.glitching-heavy .tx-body {
    animation: chroma-heavy 0.4s steps(4) infinite;
}
@keyframes chroma-mild {
    0%, 92%, 100% { filter: none; }
    93% { filter: hue-rotate(8deg) drop-shadow(0.4px 0 var(--aber-red)) drop-shadow(-0.4px 0 var(--aber-cyan)); }
    97% { filter: none; }
}
@keyframes chroma-heavy {
    0% { transform: translateX(0); filter: drop-shadow(1.5px 0 var(--aber-red)) drop-shadow(-1.5px 0 var(--aber-cyan)); }
    50% { transform: translateX(0.5px); filter: drop-shadow(0.8px 0 var(--aber-red)) drop-shadow(-0.8px 0 var(--aber-cyan)); }
    100% { transform: translateX(0); filter: drop-shadow(1.5px 0 var(--aber-red)) drop-shadow(-1.5px 0 var(--aber-cyan)); }
}

/* VHS Rewind tear (applied on page change) */
.pane-cold.rewind .pages {
    animation: vhs-rewind 80ms steps(2);
}
@keyframes vhs-rewind {
    0% { transform: translateY(-40px); }
    50% { transform: translateY(-40px) translateX(2px); }
    100% { transform: translateY(0); }
}

/* Page tear */
.shell.tearing::before,
.shell.tearing::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 70;
    pointer-events: none;
    animation: tear-line 380ms ease-out forwards;
}
.shell.tearing::before {
    top: 50%;
    background: linear-gradient(90deg, transparent, var(--sienna), transparent);
}
.shell.tearing::after {
    top: 50%;
    background: linear-gradient(90deg, transparent, var(--aber-red), var(--aber-cyan), transparent);
    transform: translateY(2px);
}
@keyframes tear-line {
    0% { transform: scaleX(0); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}

/* Word glitch flash (left pane) */
@keyframes word-bleed {
    0%, 100% { color: var(--ink); text-shadow: none; }
    20% { color: var(--ink); text-shadow: -0.8px 0 var(--aber-red), 0.8px 0 var(--aber-cyan); }
    40% { color: var(--ink); text-shadow: 0.8px 0 var(--aber-red), -0.8px 0 var(--aber-cyan); }
    60% { color: var(--ink); text-shadow: -0.4px 0 var(--aber-red), 0.4px 0 var(--aber-cyan); }
}

/* Hare */
.hare {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}
.hare-matins {
    bottom: 8%;
    right: 6%;
    width: 96px;
    height: 96px;
    color: var(--sienna);
}
.hare-sext {
    bottom: 4%;
    right: 4%;
    width: 80px;
    height: 100px;
    color: var(--ink);
    opacity: 0.7;
}
.hare-vigil {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    z-index: 41;
}

/* Star (Vigil) */
.vigil-star {
    position: absolute;
    top: 18%;
    right: 12%;
    width: 14px;
    height: 14px;
    background: var(--phosphor);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    opacity: 0.9;
    animation: star-flicker 5s ease-in-out infinite;
}
@keyframes star-flicker {
    0%, 100% { opacity: 0.95; }
    20% { opacity: 0.4; }
    25% { opacity: 0.9; }
    70% { opacity: 0.5; }
}

/* Final line on Vigil */
.final-line {
    font-family: 'Homemade Apple', cursive;
    font-size: clamp(1.1rem, 1.4vw, 1.4rem);
    color: var(--ink);
    margin-top: 2em;
    line-height: 1.6;
    max-width: 84%;
}
.pane-cold .final-line {
    font-family: 'VT323', monospace;
    color: var(--phosphor);
    text-shadow: 0 0 6px rgba(237, 230, 210, 0.4);
}

/* === Floral dingbat replacement char === */
.dropout {
    color: var(--pollen);
    animation: dingbat-flash 0.18s steps(2);
}
@keyframes dingbat-flash {
    0% { color: var(--aber-red); }
    50% { color: var(--aber-cyan); }
    100% { color: var(--pollen); }
}

/* === Scanline drift overlay === */
.scan-drift {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(237, 230, 210, 0.5);
    z-index: 9;
    pointer-events: none;
    top: -2px;
    animation: drift-down 4s linear infinite;
}
@keyframes drift-down {
    0% { top: -2px; opacity: 0; }
    5% { opacity: 0.7; }
    95% { opacity: 0.7; }
    100% { top: 100%; opacity: 0; }
}
.pane-warm .scan-drift {
    background: rgba(166, 81, 43, 0.45);
    mix-blend-mode: multiply;
}

/* Latin label mis-render container */
.latin-mis {
    display: inline-block;
}
.latin-mis.misrender {
    animation: mis-render 600ms steps(6);
}
@keyframes mis-render {
    0% { letter-spacing: 0.04em; }
    33% { letter-spacing: 0.2em; transform: skewX(-2deg); }
    66% { letter-spacing: -0.04em; transform: skewX(1deg); color: var(--aber-red); }
    100% { letter-spacing: 0.04em; transform: skewX(0deg); }
}

/* ============== HIDE NATIVE SCROLL ============== */
.pages::-webkit-scrollbar { display: none; }
.pages { scrollbar-width: none; }

/* Page transitioning (slide) */
.pages.is-changing { transition: transform 380ms cubic-bezier(0.22, 0.61, 0.36, 1); }

/* Anchor icon hover-un-press for warm halves */
.scrap-card:hover .flora-warm {
    transform: scale(1.04) rotate(-1deg);
    transition: transform 600ms ease-out;
}
.scrap-card .flora-warm {
    transition: transform 600ms ease-out;
}

/* Vigil glitch — half-watercolor-half-wireframe hare */
.hare-vigil .hare-warm-half {
    fill: rgba(166, 81, 43, 0.65);
    stroke: var(--sienna);
}
.hare-vigil .hare-cold-half {
    fill: none;
    stroke: var(--phosphor);
    stroke-width: 1;
}

/* Initial loaded fade-in */
.shell {
    opacity: 0;
    animation: shell-fade-in 800ms ease-out 200ms forwards;
}
@keyframes shell-fade-in {
    to { opacity: 1; }
}

/* Cross-seam flora */
.cross-flora {
    position: absolute;
    pointer-events: none;
    z-index: 41;
    width: 96px;
    height: 96px;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 600ms ease;
}
.cross-flora.active {
    opacity: 0.92;
}
.cross-flora svg {
    width: 100%;
    height: 100%;
}

/* Tall narrow viewports: keep split */
@media (max-width: 720px) {
    .scrap-card { width: 100px; height: 130px; }
    .hour-plate { font-size: 2rem; }
    .pane-warm .page { padding: 4vh 5vw; }
    .pane-cold .page { padding-left: 6vw; padding-right: 4vw; }
    .anchor { width: 18vh; height: 18vh; }
    .signal-meta { font-size: 0.7rem; right: 12px; top: 14px; }
    .rec-dot { right: 12px; bottom: 14px; font-size: 0.7rem; }
    .postal-mark { width: 64px; height: 64px; font-size: 0.6rem; right: 10px; bottom: 10px; }
}
