/* iisugi.com - 言い過ぎ (said too much) */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #F2ECE4;
    font-family: 'Caveat', cursive;
    color: #4A423B;
}

/* === Color Variables === */
:root {
    --bg-primary: #F2ECE4;
    --bg-alternate: #E6DFD5;
    --text-primary: #4A423B;
    --text-secondary: #9B8E82;
    --text-tertiary: #6E6459;
    --accent-glow: #C9B8A3;
    --curve-stroke: #B8AAA0;
    --panel-divider: #D5CCC2;
}

/* === Scroll Container === */
.scroll-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

/* === Paper Texture Overlay === */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    mix-blend-mode: multiply;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* === Panel Base === */
.panel {
    position: relative;
    flex: 0 0 100vw;
    width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    overflow: hidden;
}

.panel[data-bg="primary"] {
    background-color: var(--bg-primary);
}

.panel[data-bg="alternate"] {
    background-color: var(--bg-alternate);
}

/* === Panel Divider (right edge) === */
.panel::after {
    content: '';
    position: absolute;
    top: 10%;
    right: 0;
    width: 1px;
    height: 80%;
    background: var(--panel-divider);
    opacity: 0.4;
}

.panel:last-child::after {
    display: none;
}

/* === Background Patterns === */
.panel-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* === Panel Content === */
.panel-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 8vw 15vh;
}

/* === Flowing Curves === */
.flowing-curve {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.curve-path {
    opacity: 0.3;
    stroke-linecap: round;
}

/* === Typography === */

/* Primary Handwritten Utterance */
.utterance-handwritten {
    font-family: 'Caveat', cursive;
    font-size: clamp(2rem, 4vw, 3.6rem);
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.5;
    color: var(--text-primary);
    text-shadow: 0.5px 0.5px 0.8px rgba(74, 66, 59, 0.4);
}

/* Monospace Typewriter Text */
.utterance-mono {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    font-weight: 300;
    color: var(--text-tertiary);
    line-height: 1.8;
}

/* Annotation Text */
.utterance-annotation {
    font-family: 'Karla', sans-serif;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: 1rem;
    display: block;
}

/* === Panel Types === */

/* -- Opening Panel -- */
.opening-content {
    justify-content: center;
    align-items: center;
    padding-bottom: 0;
}

.typewriter-dots {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 300;
    color: var(--text-tertiary);
    letter-spacing: 0.3em;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.opening-utterance {
    opacity: 0;
    text-align: center;
    transition: opacity 800ms ease;
}

.opening-utterance.visible {
    opacity: 1;
}

/* -- Whisper Panel -- */
.whisper-content {
    justify-content: flex-end;
    align-items: flex-start;
    padding: 0 6vw 12vh;
}

.whisper-text {
    max-width: 60%;
}

.whisper-final {
    justify-content: center;
    align-items: center;
    padding: 0;
}

.whisper-final .whisper-text {
    font-size: clamp(3rem, 6vw, 5rem);
    max-width: none;
    text-align: center;
}

/* -- Overflow Panel -- */
.overflow-content {
    justify-content: flex-end;
    padding: 0 5vw 8vh;
}

.overflow-line {
    margin-bottom: 0.3em;
    transform-origin: left center;
}

/* -- Silence Panel -- */
.silence-content {
    justify-content: center;
    align-items: center;
    padding: 0;
}

.silence-cursor {
    font-size: 1.8rem;
}

/* -- Echo Panel -- */
.echo-content {
    justify-content: flex-end;
    align-items: flex-start;
    padding: 0 6vw 10vh;
}

.echo-line {
    margin-bottom: 0.15em;
    transition: none;
}

.echo-line:nth-child(2) {
    transform: translate(1.5rem, -0.2rem);
}

.echo-line:nth-child(3) {
    transform: translate(3rem, -0.4rem);
}

.echo-line:nth-child(4) {
    transform: translate(4.5rem, -0.6rem);
}

.echo-line:nth-child(5) {
    transform: translate(6rem, -0.8rem);
}

/* -- Retraction Panel -- */
.retraction-content {
    justify-content: flex-end;
    align-items: flex-start;
    padding: 0 6vw 15vh;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
}

.retraction-text {
    display: inline;
    white-space: nowrap;
}

.retraction-cursor {
    display: inline;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    vertical-align: baseline;
    margin-left: 1px;
}

/* === Blinking Cursor === */
.blinking-cursor {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    color: var(--text-tertiary);
    display: inline-block;
}

@keyframes cursorBlink {
    0%, 59% { opacity: 1; }
    60%, 100% { opacity: 0; }
}

.blinking-cursor {
    animation: cursorBlink 3s infinite;
}

/* === Progress Bar === */
.progress-bar {
    position: fixed;
    bottom: 16px;
    left: 0;
    width: 100%;
    height: 12px;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 600ms ease;
}

.progress-bar.visible {
    opacity: 1;
}

.progress-line {
    position: absolute;
    bottom: 5px;
    left: 3vw;
    right: 3vw;
    height: 1px;
    background: var(--text-secondary);
}

.progress-ticks {
    position: absolute;
    bottom: 0;
    left: 3vw;
    right: 3vw;
    height: 12px;
}

.progress-tick {
    position: absolute;
    bottom: 2px;
    width: 1px;
    height: 8px;
    background: var(--text-secondary);
    opacity: 0.5;
}

.progress-dot {
    position: absolute;
    bottom: 2px;
    left: 3vw;
    width: 8px;
    height: 8px;
    background: var(--accent-glow);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--accent-glow), 0 0 12px rgba(201, 184, 163, 0.3);
    transform: translateX(-50%);
    transition: left 300ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* === Panel Text Transition on Scroll === */
.panel .utterance {
    transition: opacity 200ms ease;
}

.panel.fading .utterance {
    opacity: 0.6;
}

/* === Responsive: Vertical layout under 768px === */
@media (max-width: 768px) {
    .scroll-container {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
    }

    .panel {
        flex: 0 0 100vh;
        width: 100vw;
        height: 100vh;
    }

    .panel::after {
        top: auto;
        right: auto;
        bottom: 0;
        left: 10%;
        width: 80%;
        height: 1px;
    }

    .panel-content {
        padding: 0 6vw 12vh;
    }

    .whisper-content {
        padding: 0 6vw 10vh;
    }

    .whisper-text {
        max-width: 90%;
    }

    .overflow-content {
        padding: 0 5vw 8vh;
    }

    .echo-content {
        padding: 0 5vw 10vh;
    }

    /* Progress bar becomes vertical right-edge line */
    .progress-bar {
        bottom: auto;
        left: auto;
        top: 0;
        right: 8px;
        width: 12px;
        height: 100%;
    }

    .progress-line {
        bottom: auto;
        left: 5px;
        right: auto;
        top: 3vh;
        width: 1px;
        height: 94vh;
    }

    .progress-ticks {
        bottom: auto;
        left: 0;
        right: auto;
        top: 3vh;
        width: 12px;
        height: 94vh;
    }

    .progress-tick {
        bottom: auto;
        left: 2px;
        width: 8px;
        height: 1px;
    }

    .progress-dot {
        bottom: auto;
        left: 2px;
        top: 3vh;
        transform: translateY(-50%);
        transition: top 300ms cubic-bezier(0.25, 0.1, 0.25, 1.0);
    }

    .whisper-final .whisper-text {
        font-size: clamp(2.5rem, 8vw, 4rem);
    }
}
