/* kkaji.com — Muji Industrial / Deep Burgundy */

:root {
    --raw-linen: #F4EDE4;
    --dried-blood: #3D1C1E;
    --terracotta: #A0522D;
    --charred-timber: #1A1210;
    --warm-stone: #B8A99A;
    --copper-patina: #8B5E3C;
    --clean-vellum: #FAF7F2;
    --iron-gall: #2C1810;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    color: var(--dried-blood);
    background: var(--raw-linen);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---- Fixed wordmark ---- */
.fixed-wordmark {
    position: fixed;
    top: 1.5rem;
    left: 8.333%;
    z-index: 100;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-stone);
}

/* ---- Grid fragments (background) ---- */
.grid-fragments {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(184, 169, 154, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(184, 169, 154, 0.08) 1px, transparent 1px);
    background-size: 8.333vw 10vh;
}

/* ---- Sections ---- */
.section {
    position: relative;
    z-index: 1;
    padding-left: 8.333%;
    padding-right: 8.333%;
}

/* ---- Entry threshold ---- */
.section-entry {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

.entry-word {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(5rem, 15vw, 12rem);
    color: var(--dried-blood);
    letter-spacing: -0.02em;
    line-height: 1;
    margin-top: 61.8vh;
    margin-top: calc(61.8vh - 0.5em);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.entry-word.visible {
    opacity: 1;
}

.threshold-line {
    width: 40%;
    height: 1px;
    background: var(--dried-blood);
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

.threshold-line.visible {
    opacity: 0.6;
}

.tl-full {
    width: 100%;
}

/* ---- Registration marks ---- */
.registration-mark {
    position: absolute;
    width: 12px;
    height: 12px;
}

.registration-mark::before,
.registration-mark::after {
    content: '';
    position: absolute;
    background: var(--warm-stone);
}

.registration-mark::before {
    width: 12px;
    height: 0.5px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.registration-mark::after {
    width: 0.5px;
    height: 12px;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.rm-1 {
    right: 4%;
    top: 50%;
}

.rm-2 {
    left: 4%;
    bottom: 20%;
}

/* ---- Z-pattern layout ---- */
.section-diagonal-1,
.section-diagonal-2 {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
    padding-top: 12vh;
    padding-bottom: 12vh;
    position: relative;
}

.z-text {
    flex: 3;
}

.z-illustration {
    flex: 2;
    position: relative;
}

.z-left {
    order: 1;
}

.z-right {
    order: 2;
}

.section-diagonal-2 .z-left {
    order: 1;
}

.section-diagonal-2 .z-right {
    order: 2;
}

/* ---- Section headings ---- */
.section-heading {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--dried-blood);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Body text ---- */
.body-text {
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    max-width: 38em;
    margin-bottom: 2rem;
    color: var(--dried-blood);
}

.body-text em {
    font-style: italic;
    color: var(--copper-patina);
}

.body-text a {
    color: var(--copper-patina);
    text-decoration: underline;
    text-decoration-color: var(--copper-patina);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: color 0.2s ease, text-decoration-thickness 0.2s ease;
}

.body-text a:hover {
    color: var(--terracotta);
    text-decoration-thickness: 2px;
}

/* ---- Sweep section ---- */
.section-sweep {
    padding-top: 12vh;
    padding-bottom: 12vh;
}

.z-full-left {
    max-width: 66.667%;
}

/* ---- Illustrations ---- */
.illus {
    width: 100%;
    height: auto;
    overflow: visible;
}

.illus-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.il-primary {
    stroke: var(--iron-gall);
    stroke-width: 2.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-out;
}

.il-secondary {
    stroke: var(--copper-patina);
    stroke-width: 1.5;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 2.2s ease-out 0.3s;
}

.il-accent {
    stroke: var(--terracotta);
    stroke-width: 1;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2s ease-out 0.6s;
}

.illus.drawn .il-primary,
.illus.drawn .il-secondary,
.illus.drawn .il-accent {
    stroke-dashoffset: 0;
}

.illus-node {
    fill: none;
    stroke: var(--dried-blood);
    stroke-width: 1.5;
    opacity: 0;
    transition: opacity 0.6s ease 1.5s;
}

.illus.drawn .illus-node {
    opacity: 1;
}

.illus-hatch line {
    stroke: var(--warm-stone);
    stroke-width: 0.5;
    opacity: 0;
    transition: opacity 0.6s ease 2s;
}

.illus.drawn .illus-hatch line {
    opacity: 0.3;
}

/* ---- Node clusters ---- */
.node-cluster {
    position: absolute;
    display: flex;
    gap: 8px;
}

.nc-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1.5px solid var(--dried-blood);
}

.nc-1 {
    right: 10%;
    top: 10%;
}

.nc-2 {
    left: 5%;
    bottom: 15%;
}

.nc-1 .nc-dot:nth-child(2) { transform: translate(3px, 8px); }
.nc-1 .nc-dot:nth-child(3) { transform: translate(-5px, 14px); }
.nc-1 .nc-dot:nth-child(4) { transform: translate(8px, 6px); }

.nc-2 .nc-dot:nth-child(2) { transform: translate(6px, -4px); }
.nc-2 .nc-dot:nth-child(3) { transform: translate(-2px, 10px); }

/* ---- Threshold lines (multi-line groups) ---- */
.section-sweep .threshold-line {
    margin-bottom: 3rem;
}

/* ---- Exit threshold ---- */
.section-exit {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 12vh;
    padding-bottom: 6rem;
}

.section-exit .threshold-line {
    width: 60%;
    margin-bottom: 6vh;
    margin-left: auto;
    margin-right: auto;
}

.exit-wordmark {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--dried-blood);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.exit-line {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-stone);
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .section {
        padding-left: 5%;
        padding-right: 5%;
    }

    .section-diagonal-1,
    .section-diagonal-2 {
        flex-direction: column;
        gap: 2rem;
    }

    .z-text,
    .z-illustration {
        flex: none;
        width: 100%;
    }

    .z-left,
    .z-right {
        order: unset;
    }

    .z-full-left {
        max-width: 100%;
    }

    .entry-word {
        font-size: clamp(3rem, 15vw, 6rem);
    }

    .fixed-wordmark {
        left: 5%;
    }

    .node-cluster {
        display: none;
    }
}

/* ---- Tablet ---- */
@media (min-width: 768px) and (max-width: 1023px) {
    .section-diagonal-1,
    .section-diagonal-2 {
        gap: 2rem;
    }

    .z-full-left {
        max-width: 80%;
    }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .entry-word {
        opacity: 1;
    }

    .threshold-line {
        opacity: 0.6;
    }

    .section-heading {
        opacity: 1;
        transform: translateY(0);
    }

    .il-primary,
    .il-secondary,
    .il-accent {
        stroke-dashoffset: 0;
    }

    .illus-node {
        opacity: 1;
    }

    .illus-hatch line {
        opacity: 0.3;
    }
}
