/* ==========================================================
   reiwa.boo — pixel-art terracotta arcade
   ========================================================== */

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

html {
    scroll-behavior: smooth;
    image-rendering: pixelated;
}

body {
    background: #FFF4E8;
    color: #5A3818;
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Canvas for pixel fish --- */
#fish-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

/* --- Parallax Sections --- */
.parallax-section {
    position: relative;
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.section-hero {
    min-height: 100vh;
    background: #FFF4E8;
}

.section-concept {
    background: #FFF8EE;
}

.section-world {
    background: #FFF4E8;
}

.section-craft {
    background: #FFF8EE;
}

.section-system {
    background: #FFF4E8;
}

.section-footer {
    min-height: 40vh;
    background: #FFF8EE;
}

/* --- Parallax Background Layer --- */
.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    will-change: transform;
}

/* --- Parallax Midground Layer --- */
.parallax-mid {
    position: relative;
    z-index: 3;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
}

/* --- Pixel Landscapes (SVG in bg) --- */
.pixel-landscape {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    image-rendering: pixelated;
}

.landscape-hero {
    height: 300px;
}

/* --- Pixel Step Border Between Sections --- */
.pixel-border-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 8px;
    z-index: 5;
    background:
        repeating-linear-gradient(
            90deg,
            #8A5A38 0px,
            #8A5A38 8px,
            transparent 8px,
            transparent 16px
        );
    opacity: 0.15;
}

/* --- Hero Content --- */
.hero-content {
    text-align: center;
    padding: 2rem;
}

.hero-title-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
}

.hero-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 6rem);
    color: #2A1408;
    letter-spacing: 0.08em;
    line-height: 1.1;
    margin-bottom: 0;
    text-shadow: 4px 4px 0 rgba(138, 90, 56, 0.15);
}

.hero-cursor {
    display: inline-block;
    width: clamp(4px, 0.5vw, 6px);
    height: clamp(2.4rem, 6.5vw, 4.8rem);
    background: #C07850;
    margin-left: 0.15em;
    animation: blink-cursor 1s steps(2, start) infinite;
    vertical-align: middle;
}

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

.hero-tagline {
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 1.5rem;
}

/* Hero decorative pixels */
.hero-pixels {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 2.5rem;
}

.hero-pixel {
    display: block;
    width: 8px;
    height: 8px;
    background: #C07850;
    opacity: 0;
    animation: pixel-appear 0.3s ease forwards;
    animation-delay: var(--delay, 0.8s);
}

@keyframes pixel-appear {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 0.3;
        transform: scale(1);
    }
}

/* --- Section Content --- */
.section-content {
    max-width: 800px;
    width: 100%;
    padding: 4rem 2rem;
    margin: 0 auto;
}

.section-heading {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    color: #2A1408;
    margin-bottom: 2rem;
    text-shadow: 3px 3px 0 rgba(138, 90, 56, 0.1);
}

/* --- Game Tags --- */
.game-tag {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    color: #8A5A38;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* --- Pixel Blocks (hover-lift) --- */
.pixel-block {
    background: #FFF8EE;
    border: 2px solid rgba(138, 90, 56, 0.12);
    padding: 1.8rem 2rem;
    margin-bottom: 1.5rem;
    transition: transform 0.15s steps(3), box-shadow 0.15s steps(3);
    cursor: default;
    image-rendering: auto;
}

.pixel-block:hover {
    transform: translateY(-4px);
    box-shadow: 4px 4px 0 #8A5A38;
}

.pixel-block p {
    color: #5A3818;
    font-weight: 300;
}

/* Pixel blocks alternate backgrounds to contrast with section */
.section-world .pixel-block,
.section-hero .pixel-block,
.section-system .pixel-block {
    background: #FFF8EE;
}

.section-concept .pixel-block,
.section-craft .pixel-block,
.section-footer .pixel-block {
    background: #FFF4E8;
}

/* --- Pixel Grid (2 columns on wider screens) --- */
.pixel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .pixel-grid {
        grid-template-columns: 1fr 1fr;
    }

    .pixel-grid .pixel-block {
        margin-bottom: 0;
    }
}

/* --- System Block --- */
.system-block {
    padding: 2.5rem 2rem;
}

.system-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(138, 90, 56, 0.08);
}

.system-row:last-child {
    border-bottom: none;
}

.system-row .game-tag {
    min-width: 70px;
    margin-bottom: 0;
}

/* --- Color Swatches --- */
.color-swatches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.swatch {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(138, 90, 56, 0.15);
    transition: transform 0.15s steps(3), box-shadow 0.15s steps(3);
    position: relative;
}

.swatch:hover {
    transform: translateY(-3px);
    box-shadow: 3px 3px 0 #8A5A38;
}

/* Light swatches need visible border */
.swatch:nth-child(6),
.swatch:nth-child(7) {
    border-color: rgba(138, 90, 56, 0.25);
}

/* --- Font Samples --- */
.font-sample {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(138, 90, 56, 0.1);
    font-size: 0.85rem;
    color: #5A3818;
    transition: transform 0.15s steps(3), box-shadow 0.15s steps(3);
}

.font-sample:hover {
    transform: translateY(-2px);
    box-shadow: 2px 2px 0 #8A5A38;
}

.font-display {
    font-family: 'Zilla Slab', serif;
    font-weight: 500;
}

.font-body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
}

.font-mono {
    font-family: 'Fira Code', monospace;
    font-weight: 500;
}

/* --- Footer --- */
.footer-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.footer-pixel-art {
    display: flex;
    gap: 4px;
    margin-bottom: 2rem;
}

.footer-px {
    display: block;
    width: 8px;
    height: 8px;
    background: #C09060;
    opacity: 0.2;
}

.footer-px:nth-child(1) { height: 16px; background: #8A5A38; }
.footer-px:nth-child(2) { height: 24px; background: #C07850; }
.footer-px:nth-child(3) { height: 32px; background: #C09060; }
.footer-px:nth-child(4) { height: 40px; background: #8A5A38; }
.footer-px:nth-child(5) { height: 32px; background: #C09060; }
.footer-px:nth-child(6) { height: 24px; background: #C07850; }
.footer-px:nth-child(7) { height: 16px; background: #8A5A38; }

.footer-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-sub {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    color: #C09060;
}

.footer-year {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #C09060;
    opacity: 0.6;
}

/* --- Scroll fade-in for content --- */
.pixel-block,
.section-heading,
.hero-title-wrap,
.hero-tagline,
.hero-pixels,
.system-block,
.footer-pixel-art,
.footer-label,
.footer-sub,
.footer-year {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.pixel-block.is-visible:hover {
    transform: translateY(-4px);
}

.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger animation for grid items */
.pixel-grid .pixel-block:nth-child(2) {
    transition-delay: 0.08s;
}

.pixel-grid .pixel-block:nth-child(3) {
    transition-delay: 0.16s;
}

.pixel-grid .pixel-block:nth-child(4) {
    transition-delay: 0.24s;
}

/* Footer pixel art special visibility */
.footer-pixel-art.is-visible .footer-px {
    animation: footer-px-rise 0.4s ease forwards;
}

.footer-px:nth-child(1) { animation-delay: 0s; }
.footer-px:nth-child(2) { animation-delay: 0.05s; }
.footer-px:nth-child(3) { animation-delay: 0.1s; }
.footer-px:nth-child(4) { animation-delay: 0.15s; }
.footer-px:nth-child(5) { animation-delay: 0.2s; }
.footer-px:nth-child(6) { animation-delay: 0.25s; }
.footer-px:nth-child(7) { animation-delay: 0.3s; }

@keyframes footer-px-rise {
    from {
        opacity: 0;
        transform: scaleY(0);
        transform-origin: bottom;
    }
    to {
        opacity: 0.2;
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .section-content {
        padding: 3rem 1.2rem;
    }

    .pixel-block {
        padding: 1.4rem 1.2rem;
    }

    .hero-title {
        letter-spacing: 0.04em;
    }

    .system-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .hero-pixels {
        gap: 6px;
    }
}
