:root {
    --parchment: #f0e6d3;
    --roasted-night: #1a1209;
    --warm-bark: #3d2e1f;
    --dark-umber: #2b1f14;
    --electric-teal: #00b8a9;
    --tube-amber: #e8a630;
    --aged-brass: #c4a882;
    --copper-patina: #5c8a6e;
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--parchment);
    color: var(--warm-bark);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* Brass Rule */
.brass-rule {
    position: fixed;
    top: 0;
    left: 50%;
    width: 1px;
    height: 0;
    background: var(--aged-brass);
    z-index: 10;
    transform: translateX(-50%);
}

@media (prefers-reduced-motion: no-preference) {
    .brass-rule.animate {
        animation: drawRule 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

@keyframes drawRule {
    to { height: 100vh; }
}

.brass-rule.drawn {
    height: 100vh;
}

/* Navigation Dots */
.nav-dots {
    position: fixed;
    right: clamp(1.5rem, 4vw, 4rem);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 100;
    opacity: 0;
}

.nav-dots.visible {
    opacity: 1;
    transition: opacity 0.8s ease;
}

.nav-dot {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: radial-gradient(ellipse at 30% 40%, rgba(90,65,35,0.15) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, rgba(90,65,35,0.1) 0%, transparent 40%);
    background-color: var(--aged-brass);
    position: relative;
    transition: transform 0.3s ease;
    padding: 0;
}

.nav-dot:hover {
    transform: scale(1.15);
}

.nav-dot svg {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 24px;
    height: 24px;
}

.nav-dot .dot-border {
    fill: none;
    stroke: var(--electric-teal);
    stroke-width: 2;
    stroke-dasharray: 63;
    stroke-dashoffset: 63;
    transition: stroke-dashoffset 0.01s;
}

.nav-dot.active .dot-border {
    animation: drawBorder 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawBorder {
    to { stroke-dashoffset: 0; }
}

/* Sections */
.section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 5vw, 4rem);
    position: relative;
}

.section-content {
    max-width: 520px;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
}

@media (prefers-reduced-motion: no-preference) {
    .section-content.visible {
        animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Breathing space */
.breath {
    height: 100vh;
}

/* Typography */
.site-title {
    font-family: var(--font-display);
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 700;
    color: var(--dark-umber);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1rem;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--electric-teal);
    opacity: 0;
}

.subtitle.visible {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

h2 {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    font-weight: 600;
    color: var(--dark-umber);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin-bottom: 1.5rem;
}

.section-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--electric-teal);
    margin-bottom: 1rem;
}

.body-text {
    max-width: 52ch;
    color: var(--warm-bark);
    opacity: 0;
}

.body-text.visible {
    opacity: 1;
}

.haiku {
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    line-height: 2;
}

/* Kinetic Typography */
.kinetic .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(120%) rotate(2deg);
}

@media (prefers-reduced-motion: no-preference) {
    .kinetic.animate .char {
        animation: charReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

@keyframes charReveal {
    to { opacity: 1; transform: translateY(0) rotate(0); }
}

/* Kanji decorations */
.kanji-flanks {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.kanji-deco {
    font-family: var(--font-display);
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--aged-brass);
    text-shadow: 0 0 20px rgba(232, 166, 48, 0.3);
    line-height: 1;
    user-select: none;
}

.section-text {
    flex: 1;
}

/* Chevron divider */
.chevron-divider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        var(--aged-brass),
        var(--aged-brass) 2px,
        transparent 2px,
        transparent 8px
    ),
    repeating-linear-gradient(
        -45deg,
        var(--aged-brass),
        var(--aged-brass) 2px,
        transparent 2px,
        transparent 8px
    );
    background-size: 16px 8px;
}

.chevron-amber {
    height: 16px;
    background: repeating-linear-gradient(
        45deg,
        var(--tube-amber),
        var(--tube-amber) 2px,
        transparent 2px,
        transparent 8px
    ),
    repeating-linear-gradient(
        -45deg,
        var(--tube-amber),
        var(--tube-amber) 2px,
        transparent 2px,
        transparent 8px
    );
    background-size: 16px 16px;
}

/* Circuit Grid */
.circuit-grid {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    position: relative;
    max-width: 320px;
}

.circuit-component {
    width: 100%;
    aspect-ratio: 1.5;
    border: 1px solid var(--aged-brass);
    border-radius: 4px;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(196, 168, 130, 0.3) 3px,
        rgba(196, 168, 130, 0.3) 4px
    );
}

.circuit-component.c1, .circuit-component.c4, .circuit-component.c7 {
    border-radius: 50%;
    aspect-ratio: 1;
}

.circuit-component.c2, .circuit-component.c5 {
    border-radius: 2px;
    border-width: 2px;
}

.circuit-line {
    position: absolute;
    background: var(--aged-brass);
    opacity: 0.5;
}

.circuit-line.cl1 {
    width: 1px;
    height: 60%;
    top: 20%;
    left: 33%;
}

.circuit-line.cl2 {
    width: 60%;
    height: 1px;
    top: 50%;
    left: 20%;
}

.circuit-line.cl3 {
    width: 1px;
    height: 40%;
    top: 30%;
    left: 66%;
}

/* Karesansui */
.karesansui {
    margin-top: 3rem;
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.sand-lines {
    position: absolute;
    inset: 0;
}

.sand-line {
    width: 100%;
    height: 2px;
    background: var(--aged-brass);
    margin-bottom: 12px;
    animation: rakeShift 8s ease-in-out infinite alternate;
}

@keyframes rakeShift {
    from { transform: translateX(0); }
    to { transform: translateX(2px); }
}

.stone {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 40%, rgba(90,65,35,0.2) 0%, transparent 50%),
                radial-gradient(ellipse at 70% 60%, rgba(90,65,35,0.15) 0%, transparent 40%);
    background-color: var(--warm-bark);
}

.stone1 {
    width: 40px;
    height: 40px;
    top: 30px;
    left: 20%;
}

.stone2 {
    width: 55px;
    height: 50px;
    top: 80px;
    left: 55%;
}

.stone3 {
    width: 30px;
    height: 30px;
    top: 120px;
    left: 35%;
}

/* Resolution section */
.resolution-text {
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.3;
}

.attribution {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--electric-teal);
    margin-top: 2rem;
}

/* Heading underline animation */
h2.underline-drawn {
    background-image: linear-gradient(var(--electric-teal), var(--electric-teal));
    background-size: 100% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    animation: drawUnderline 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawUnderline {
    from { background-size: 0% 2px; }
    to { background-size: 100% 2px; }
}

/* Mobile */
@media (max-width: 768px) {
    .brass-rule {
        display: none;
    }

    .breath {
        height: 50vh;
    }

    .nav-dots {
        position: fixed;
        top: auto;
        bottom: 1.5rem;
        right: 50%;
        transform: translateX(50%);
        flex-direction: row;
    }

    .kanji-flanks {
        flex-direction: column;
    }

    .kanji-deco {
        font-size: clamp(4rem, 12vw, 6rem);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .brass-rule {
        height: 100vh;
    }

    .section-content {
        opacity: 1;
        transform: none;
    }

    .kinetic .char {
        opacity: 1;
        transform: none;
    }

    .subtitle {
        opacity: 1;
    }

    .body-text {
        opacity: 1;
    }

    .nav-dots {
        opacity: 1;
    }

    .nav-dot.active .dot-border {
        stroke-dashoffset: 0;
    }

    .sand-line {
        animation: none;
    }
}
