/* === Custom Property Registration === */
@property --fill {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: #1c1017;
    color: #d4a88c;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    line-height: 1.85;
    overflow-x: hidden;
}

/* === Ambient Column === */
.ambient-column {
    position: fixed;
    left: 0;
    top: 0;
    width: 8vw;
    height: 100vh;
    background: linear-gradient(180deg, #f7a855 0%, #e8624a 50%, #9b3a6e 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ambient-column::after {
    content: '';
    position: absolute;
    right: 0;
    top: -100%;
    width: 1px;
    height: 300%;
    background: linear-gradient(to bottom, transparent, #f7a855, transparent);
    background-size: 1px 33.33%;
    animation: borderSweep 4s ease-in-out infinite;
}

@keyframes borderSweep {
    0% { transform: translateY(0); }
    100% { transform: translateY(33.33%); }
}

.ambient-kanji {
    font-family: 'Zen Antique', serif;
    font-size: clamp(2rem, 4vw, 4rem);
    color: #1c1017;
    writing-mode: vertical-rl;
    letter-spacing: 0.2em;
    opacity: 0.7;
    will-change: transform;
}

.ambient-icons {
    position: relative;
    width: clamp(2rem, 4vw, 3.5rem);
    height: clamp(2rem, 4vw, 3.5rem);
    margin-top: 2rem;
}

.ambient-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.ambient-icon.active {
    opacity: 0.8;
}

/* === Hero === */
.hero {
    width: 100%;
    height: 100vh;
    margin-left: 8vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #1c1017;
    background-image: radial-gradient(circle at 60% 35%, rgba(247, 168, 85, 0.06) 0%, transparent 60%);
}

.hero-content {
    position: absolute;
    left: 52%;
    top: 35%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.hero-kanji {
    font-family: 'Zen Antique', serif;
    font-size: clamp(8rem, 20vw, 18rem);
    line-height: 1.0;
    color: #f7a855;
    margin: 0;
}

.hero-romanized {
    font-family: 'Outfit', sans-serif;
    font-weight: 200;
    font-size: clamp(1.2rem, 2.5vw, 2.4rem);
    letter-spacing: 0.8em;
    text-transform: uppercase;
    color: #d4a88c;
    margin-top: 1rem;
}

/* === Stanza Base === */
.stanza {
    position: relative;
    padding: clamp(3rem, 5vw, 6rem);
    margin-left: 8vw;
    border: 1px solid rgba(247, 168, 85, 0.2);
    animation: breathingBorder 6s ease-in-out infinite;
}

@keyframes breathingBorder {
    0%, 100% { border-color: rgba(247, 168, 85, 0.1); }
    50% { border-color: rgba(247, 168, 85, 0.5); }
}

/* Corner bloom effect */
.stanza::before,
.stanza::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: rgba(247, 168, 85, 0.6);
}

.stanza::before {
    top: -1px;
    left: -1px;
    border-top: 3px solid rgba(247, 168, 85, 0.6);
    border-left: 3px solid rgba(247, 168, 85, 0.6);
}

.stanza::after {
    bottom: -1px;
    right: -1px;
    border-bottom: 3px solid rgba(247, 168, 85, 0.6);
    border-right: 3px solid rgba(247, 168, 85, 0.6);
}

/* Stanza spacing */
.stanza + .stanza {
    margin-top: 30vh;
}

.hero + .stanza {
    margin-top: 30vh;
}

/* Asymmetric panel widths and offsets */
.stanza-1 {
    width: 55vw;
    margin-left: calc(8vw);
    min-height: 80vh;
}

.stanza-2 {
    width: 75vw;
    margin-left: 20vw;
    min-height: 100vh;
}

.stanza-3 {
    width: 55vw;
    margin-left: 8vw;
    min-height: 80vh;
}

.stanza-4 {
    width: 75vw;
    margin-left: 15vw;
    min-height: 120vh;
}

.stanza-5 {
    width: 55vw;
    margin-left: 8vw;
    min-height: 100vh;
}

/* === Stanza Typography === */
.stanza-kanji {
    font-family: 'Zen Antique', serif;
    font-size: clamp(5rem, 15vw, 14rem);
    line-height: 1.0;
    color: transparent;
    -webkit-text-stroke: 1px #f7a855;
    background: linear-gradient(to top, #f7a855 var(--fill), transparent var(--fill));
    -webkit-background-clip: text;
    background-clip: text;
    transition: --fill 1.2s ease-out;
    display: inline-block;
}

.stanza-kanji.revealed {
    --fill: 100%;
}

.stanza-heading {
    margin-bottom: 2rem;
}

.stanza-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 2.2rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: #d4a88c;
    margin-bottom: 2rem;
}

.stanza-body p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    line-height: 1.85;
    color: #d4a88c;
    margin-bottom: 1.5rem;
    max-width: 60ch;
}

.stanza-body p strong {
    font-weight: 600;
}

/* === Stanza 2: Icon Grid === */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(1rem, 2vw, 2rem);
    margin: 3rem 0;
}

.icon-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.icon-cell.revealed {
    opacity: 1;
    transform: translateY(0);
}

.icon-cell svg {
    width: clamp(2.5rem, 5vw, 4rem);
    height: clamp(2.5rem, 5vw, 4rem);
}

.icon-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    letter-spacing: 0.05em;
    color: #8b6e5a;
    text-align: center;
}

/* === Stanza 3: Timeline === */
.timeline {
    margin: 3rem 0;
}

.timeline-line {
    width: 100%;
    max-width: 600px;
}

.timeline-svg {
    width: 100%;
    height: 40px;
}

.timeline-dash {
    stroke-dasharray: 8 4;
    animation: dashMigration 3s linear infinite;
}

@keyframes dashMigration {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -120; }
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    max-width: 600px;
    margin-top: 0.5rem;
}

.timeline-date {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.05em;
}

.timeline-date-left {
    color: #6b7b8d;
}

.timeline-date-right {
    color: #f7a855;
}

.timeline-era-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    color: #8b6e5a;
}

/* === Stanza 4: Maple Leaf === */
.maple-leaf-container {
    position: relative;
    width: 40vw;
    height: 40vw;
    max-width: 400px;
    max-height: 400px;
    float: left;
    margin: 0 3rem 2rem 0;
    shape-outside: circle(50%);
}

.maple-leaf {
    position: relative;
    width: 100%;
    height: 100%;
    animation: leafSpin 120s linear infinite;
}

.maple-lobe {
    position: absolute;
    width: 50%;
    height: 70%;
    top: 15%;
    left: 25%;
    clip-path: ellipse(50% 35% at 50% 50%);
    background: radial-gradient(circle at center, #f7a855, #e8624a);
    opacity: 0.4;
    transform-origin: center center;
}

.maple-lobe:nth-child(1) { transform: rotate(0deg); }
.maple-lobe:nth-child(2) { transform: rotate(72deg); }
.maple-lobe:nth-child(3) { transform: rotate(144deg); }
.maple-lobe:nth-child(4) { transform: rotate(216deg); }
.maple-lobe:nth-child(5) { transform: rotate(288deg); }

@keyframes leafSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === Stanza 5: Ghost Effect === */
.stanza-5 {
    overflow: hidden;
    position: relative;
    animation: none;
    border-color: rgba(155, 58, 110, 0.2);
}

.ghost-content {
    -webkit-mask-image: radial-gradient(circle 150px at var(--mx, 50%) var(--my, 50%), black 40%, transparent 100%);
    mask-image: radial-gradient(circle 150px at var(--mx, 50%) var(--my, 50%), black 40%, transparent 100%);
}

/* Stanza 5 hover text brightening */
.stanza-5 .stanza-kanji.revealed {
    -webkit-text-stroke-color: #fce4c4;
}

.ghost-content .stanza-title,
.ghost-content p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.6vw, 1.35rem);
    line-height: 1.85;
    color: #d4a88c;
    margin-bottom: 1.5rem;
    max-width: 60ch;
}

.ghost-content .stanza-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 2.2rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.ghost-afterimages {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ghost-icon {
    position: absolute;
    width: clamp(4rem, 8vw, 8rem);
    height: clamp(4rem, 8vw, 8rem);
    opacity: 0.03;
}

.gi-1 { top: 10%; right: 10%; }
.gi-2 { bottom: 20%; left: 5%; }
.gi-3 { top: 50%; right: 25%; }

/* === Footer === */
.footer-strip {
    height: 15vh;
    margin-left: 8vw;
    background: linear-gradient(90deg, #f7a855 0%, #e8624a 50%, #9b3a6e 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(2rem, 4vw, 5rem);
    margin-top: 30vh;
}

.footer-domain {
    font-family: 'Outfit', sans-serif;
    font-weight: 100;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: #1c1017;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.footer-year {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: #2d1f27;
}

/* === Responsive === */
@media (max-width: 768px) {
    .ambient-column {
        width: 12vw;
    }

    .hero {
        margin-left: 12vw;
    }

    .stanza {
        margin-left: 12vw !important;
        width: calc(88vw - 1rem) !important;
    }

    .footer-strip {
        margin-left: 12vw;
    }

    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .maple-leaf-container {
        float: none;
        margin: 2rem auto;
        shape-outside: none;
    }
}
