/* ============================================================
   SSETTL.com - Styles
   Japanese-minimal scholarly reading experience
   ============================================================ */

/* Custom Properties */
:root {
    /* Colors - Analogous palette */
    --shiro: #F5F3EF;          /* Background - warm off-white */
    --sumi: #1C1C1E;           /* Primary text - near-black ink */
    --hai: #3A3A3C;            /* Secondary text - warm dark gray */
    --nezumi: #8E8E93;         /* Tertiary - annotations, metadata */
    --ai: #3D5A80;             /* Accent - indigo */
    --kon: #293241;            /* Accent deep - navy */
    --kitsune: #C17817;        /* Accent warm - fox/lantern */
    --kasumi: #D1CFC7;         /* Divider - mist */

    /* Typography scale (modular, ratio 1.333) */
    --font-xs: 12px;
    --font-sm: 14px;
    --font-base: 17px;
    --font-md: 22px;
    --font-lg: 30px;
    --font-xl: 40px;
    --font-2xl: 53px;

    /* Font families */
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Source Sans 3', 'Helvetica Neue', sans-serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    /* Spacing */
    --gutter: 24px;
    --content-max: 900px;
    --breathing-margin: 120px;

    /* Transitions */
    --ease-default: cubic-bezier(0.25, 0.1, 0.25, 1);
    --duration-reveal: 800ms;
}

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

html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--shiro);
    color: var(--hai);
    font-family: var(--font-body);
    font-size: var(--font-base);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ============================================================
   Cursor-follow Lantern
   ============================================================ */
#cursor-lantern {
    position: fixed;
    top: 0;
    left: 0;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(193, 120, 23, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-300px, -300px);
    transition: transform 0.3s var(--ease-default);
    will-change: transform;
}

/* ============================================================
   Navigation Spine
   ============================================================ */
#nav-spine {
    position: fixed;
    top: 40px;
    left: 30px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
}

#nav-logo {
    font-family: var(--font-display);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--sumi);
    text-decoration: none;
    letter-spacing: 0.05em;
    transition: color 0.3s var(--ease-default);
}

#nav-logo:hover {
    color: var(--kon);
}

#nav-dots {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 2px;
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid var(--ai);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.4s var(--ease-default), border-color 0.4s var(--ease-default);
}

.nav-dot.active {
    background-color: var(--ai);
}

.nav-dot:hover {
    border-color: var(--kon);
}

/* ============================================================
   Chapter Layout
   ============================================================ */
.chapter {
    position: relative;
    min-height: 100vh;
    padding: 80px var(--gutter) 80px var(--breathing-margin);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Chapter number - rotated in left margin */
.chapter-number {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center center;
}

.chapter-number span {
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--kasumi);
    white-space: nowrap;
}

/* Kamon emblem watermarks */
.kamon-emblem {
    position: absolute;
    top: 60px;
    right: 80px;
    width: 200px;
    height: 200px;
    opacity: 0.08;
    animation: kamon-rotate 120s linear infinite;
    pointer-events: none;
}

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

.kamon-emblem svg {
    width: 100%;
    height: 100%;
}

/* Chapter content - F-pattern layout */
.chapter-content {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 60px;
    max-width: 1200px;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--duration-reveal) var(--ease-default),
                transform var(--duration-reveal) var(--ease-default);
}

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

/* Hero chapter specific */
.chapter-content--hero {
    align-items: center;
}

.chapter-content--hero .chapter-text {
    padding-top: 0;
}

/* Chapter text */
.chapter-text {
    max-width: 640px;
}

.hero-title {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 400;
    color: var(--sumi);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 24px;
    opacity: 0;
    transition: opacity 2s var(--ease-default);
}

.hero-title.revealed {
    opacity: 1;
}

.hero-epigraph {
    font-family: var(--font-body);
    font-size: var(--font-base);
    color: var(--hai);
    line-height: 1.75;
    max-width: 480px;
    opacity: 0;
    transition: opacity 1.5s var(--ease-default);
}

.hero-epigraph.revealed {
    opacity: 1;
}

.chapter-heading {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 400;
    color: var(--sumi);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 32px;
}

.chapter-body {
    font-family: var(--font-body);
    font-size: var(--font-base);
    color: var(--hai);
    line-height: 1.75;
    letter-spacing: 0.01em;
    margin-bottom: 20px;
    max-width: 580px;
}

.chapter-body:last-child {
    margin-bottom: 0;
}

/* Chapter objects (3D renders) */
.chapter-object {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chapter-object svg {
    max-width: 100%;
    height: auto;
}

/* Hairline */
.hairline {
    width: 38.2%;
    height: 1px;
    background-color: var(--kasumi);
    margin-top: 60px;
}

/* Ink drop */
.ink-drop {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--sumi) 0%, transparent 70%);
    margin-top: 48px;
    opacity: 0.6;
}

/* ============================================================
   Breath Gaps
   ============================================================ */
.breath-gap {
    height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.breath-hairline {
    width: 60px;
    height: 1px;
    background-color: var(--kasumi);
    opacity: 0.5;
}

.breath-gap--final {
    height: 60vh;
    flex-direction: column;
    gap: 40px;
}

.final-signature {
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    color: var(--kasumi);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-align: center;
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    #cursor-lantern {
        display: none;
    }

    .chapter-content {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-title,
    .hero-epigraph {
        opacity: 1;
        transition: none;
    }

    .kamon-emblem {
        animation: none;
    }

    .nav-dot {
        transition: none;
    }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    :root {
        --breathing-margin: 80px;
    }

    .chapter-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .chapter-object {
        order: -1;
        max-width: 300px;
        margin: 0 auto;
    }

    .kamon-emblem {
        right: 40px;
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 768px) {
    :root {
        --breathing-margin: 24px;
    }

    .chapter {
        padding: 60px var(--gutter) 60px var(--gutter);
        padding-left: 60px;
    }

    .chapter-number {
        left: 12px;
    }

    #nav-spine {
        left: 16px;
        top: 20px;
    }

    .kamon-emblem {
        right: 20px;
        top: 30px;
        width: 100px;
        height: 100px;
    }

    .chapter-heading {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }

    .hero-title {
        font-size: clamp(2.2rem, 6vw, 3.5rem);
    }

    .chapter-object svg {
        max-width: 250px;
    }

    .breath-gap {
        height: 25vh;
    }

    .breath-gap--final {
        height: 40vh;
    }
}

@media (max-width: 480px) {
    .chapter {
        padding-left: 48px;
    }

    .chapter-number {
        left: 8px;
    }

    #nav-spine {
        left: 10px;
    }

    .chapter-body {
        font-size: 15px;
    }
}

/* ============================================================
   Touch device: hide lantern
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
    #cursor-lantern {
        display: none;
    }
}
