/* xity.bar - Japanese minimal izakaya timeline */

/* ===== CSS Custom Properties ===== */
:root {
    --sumi-ink: #0d0d0d;
    --aged-paper: #f5efe6;
    --warm-parchment: #e8e0d4;
    --deep-charcoal: #1a1a1a;
    --vermillion: #d44a26;
    --sake-gold: #c9a84c;
    --faded-bone: rgba(232, 224, 212, 0.2);
    --electric-wasabi: #7fff6a;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--sumi-ink);
    color: var(--warm-parchment);
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 1.125rem;
    line-height: 1.75;
    overflow-x: hidden;
    cursor: crosshair;
}

/* ===== Paper Grain Overlay ===== */
#paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    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;
    mix-blend-mode: screen;
}

.section-light #paper-grain,
.section-light ~ #paper-grain {
    mix-blend-mode: multiply;
}

/* ===== Scroll Progress Enso ===== */
#scroll-progress {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.6s ease;
}

#scroll-progress.visible {
    opacity: 1;
}

#enso-bg {
    fill: none;
    stroke: var(--faded-bone);
    stroke-width: 2;
}

#enso-fill {
    fill: none;
    stroke: var(--vermillion);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 263.89;
    stroke-dashoffset: 263.89;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.1s ease-out;
}

/* ===== Ink Trail Canvas ===== */
#ink-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.15;
}

/* ===== Timeline Axis ===== */
#timeline-axis {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
}

#timeline-line {
    width: 1px;
    height: 0%;
    background: var(--warm-parchment);
    opacity: 0.2;
    transition: none;
}

/* ===== Timeline Sections ===== */
.timeline-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.section-dark {
    background-color: var(--sumi-ink);
    color: var(--warm-parchment);
}

.section-light {
    background-color: var(--aged-paper);
    color: var(--deep-charcoal);
}

.section-interstitial {
    min-height: 60vh;
}

/* ===== Kanji Watermarks ===== */
.kanji-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-weight: 900;
    font-size: 20vw;
    opacity: 0.03;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    z-index: 0;
}

.section-dark .kanji-watermark {
    color: var(--warm-parchment);
}

.section-light .kanji-watermark {
    color: var(--deep-charcoal);
}

/* ===== Origin / Wordmark ===== */
.origin-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.wordmark {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-parchment);
    position: relative;
    display: inline-block;
}

.wordmark-char {
    opacity: 0;
    display: inline-block;
    transition: opacity 0.15s ease;
}

.wordmark-char.visible {
    opacity: 1;
}

.wordmark-cursor {
    display: inline-block;
    animation: cursor-blink 0.8s step-end infinite;
    color: var(--vermillion);
    font-weight: 400;
}

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

.origin-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    opacity: 0;
    margin-top: 24px;
    color: var(--sake-gold);
    text-transform: lowercase;
    transition: opacity 1s ease 1.5s;
}

.origin-subtitle.visible {
    opacity: 0.6;
}

/* ===== Timeline Nodes ===== */
.timeline-node {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.node-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--vermillion);
    animation: node-pulse 3s ease-in-out infinite;
}

@keyframes node-pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.8); opacity: 0.4; }
}

.node-timestamp {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 12px;
    white-space: nowrap;
    background: var(--vermillion);
    color: var(--aged-paper);
    padding: 2px 8px;
    border-radius: 50%;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
}

.section-light .node-timestamp {
    background: var(--vermillion);
    color: var(--aged-paper);
}

/* ===== Content Panels ===== */
.content-panel {
    position: relative;
    z-index: 2;
    max-width: 520px;
    padding: 64px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

.panel-left {
    align-self: flex-start;
    margin-left: 8%;
    margin-right: auto;
}

.panel-right {
    align-self: flex-end;
    margin-right: 12%;
    margin-left: auto;
}

/* ===== Section Headings ===== */
.section-heading {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.section-heading::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    transition: width 0.8s ease;
}

.section-dark .section-heading::after {
    background: var(--sumi-ink);
}

.section-light .section-heading::after {
    background: var(--aged-paper);
}

.content-panel.revealed .section-heading::after {
    width: 0%;
}

.section-dark .section-heading {
    color: var(--warm-parchment);
}

.section-light .section-heading {
    color: var(--deep-charcoal);
}

/* ===== Brushstroke Rules ===== */
.brushstroke-rule {
    width: 100%;
    max-width: 300px;
    height: 6px;
    margin-bottom: 32px;
    opacity: 0.7;
}

.brushstroke-rule svg {
    width: 100%;
    height: 100%;
}

/* ===== Body Text ===== */
.body-text {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 1.125rem;
    line-height: 1.75;
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.content-panel.revealed .body-text:nth-child(3) {
    transition-delay: 0.15s;
}

.content-panel.revealed .body-text:nth-child(4) {
    transition-delay: 0.3s;
}

.content-panel.revealed .body-text {
    opacity: 1;
    transform: translateY(0);
}

.section-dark .body-text {
    color: var(--warm-parchment);
    opacity: 0;
}

.section-light .body-text {
    color: var(--deep-charcoal);
    opacity: 0;
}

.content-panel.revealed .body-text {
    opacity: 0.85;
}

/* ===== Morph Shapes ===== */
.morph-container {
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.morph-shape {
    overflow: visible;
}

.morph-polygon {
    fill: none;
    stroke: var(--vermillion);
    stroke-width: 1;
    transition: points 0.5s ease;
}

/* ===== Asanoha Divider ===== */
.asanoha-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%231a1a1a' stroke-width='0.5'%3E%3Cpath d='M30 0 L30 60 M0 30 L60 30 M0 0 L60 60 M60 0 L0 60 M30 0 L0 30 M30 0 L60 30 M30 60 L0 30 M30 60 L60 30'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 60px 60px;
}

/* ===== Closing Mark ===== */
.closing-mark {
    text-align: center;
    margin-top: 80px;
    z-index: 2;
    position: relative;
}

.closing-kanji {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-weight: 900;
    font-size: 3rem;
    color: var(--vermillion);
    opacity: 0.6;
}

/* ===== Hover States ===== */
.content-panel:hover .section-heading {
    color: var(--electric-wasabi);
    transition: color 0.3s ease;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .content-panel {
        padding: 40px 24px;
        max-width: 90%;
    }
    
    .panel-left {
        margin-left: 5%;
    }
    
    .panel-right {
        margin-right: 5%;
    }
    
    .section-heading {
        font-size: clamp(1.6rem, 8vw, 2.8rem);
    }
    
    .kanji-watermark {
        font-size: 40vw;
    }
    
    #scroll-progress {
        bottom: 16px;
        right: 16px;
    }
    
    #scroll-progress svg {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .panel-left,
    .panel-right {
        margin-left: 3%;
        margin-right: 3%;
        align-self: center;
    }
}
