/* ==========================================================
   continua.st — wabi-sabi meets mathematical elegance
   ========================================================== */

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

/* --- Palette --- */
:root {
    --paper: #f2ede4;
    --stone: #4a4540;
    --moss:  #6b7c5e;
    --rust:  #9a6842;
    --ash:   #c4beb4;
    --mist:  #e8e2d8;
    --ink:   #2a2520;
    --cloud: #faf8f4;
}

/* --- Typography --- */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Shippori Mincho', 'Noto Serif JP', serif;
    font-weight: 400;
    line-height: 2.0;
    color: var(--stone);
    background-color: var(--paper);
    background-image:
        radial-gradient(ellipse at 18% 12%, rgba(154, 104, 66, 0.05) 0%, transparent 45%),
        radial-gradient(ellipse at 82% 78%, rgba(107, 124, 94, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 52% 50%, rgba(232, 226, 216, 0.4) 0%, transparent 70%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    letter-spacing: 0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    color: var(--ink);
    letter-spacing: 0.08em;
    line-height: 1.4;
}

h2 {
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--ink);
    margin-bottom: 1.8rem;
    line-height: 1.5;
}

p {
    max-width: 62ch;
    color: var(--stone);
    margin-bottom: 1.4rem;
}

p:last-child {
    margin-bottom: 0;
}

p.lede {
    font-size: 1.05rem;
    color: var(--ink);
}

p.quiet {
    color: var(--ash);
    font-style: italic;
    font-size: 0.95rem;
}

em {
    font-style: italic;
    color: var(--rust);
}

.section-label {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--ash);
    text-transform: lowercase;
    letter-spacing: 0.25em;
    display: block;
    margin-bottom: 1.5rem;
    border-left: 1px solid var(--ash);
    padding-left: 0.9rem;
}

/* --- Paper Texture Overlay (washi noise) --- */
#paper-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    background-image:
        repeating-conic-gradient(
            var(--stone) 0% 25%,
            transparent 0% 50%
        );
    background-size: 3px 3px;
    mix-blend-mode: multiply;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px 40px;
    position: relative;
}

.hero-inner {
    max-width: 880px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.hero-curve-wrap {
    width: 100%;
    margin-bottom: 3.5rem;
    position: relative;
}

#hero-curve {
    width: 100%;
    height: auto;
    max-height: 420px;
    display: block;
}

#hero-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
}

#hero-kintsugi {
    opacity: 0;
    transition: opacity 0.8s ease 1.8s;
    filter: drop-shadow(0 0 5px rgba(154, 104, 66, 0.55));
}

#hero-kintsugi.shown {
    opacity: 1;
}

.hero-title {
    text-align: center;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1.4s ease 0.6s, transform 1.4s ease 0.6s;
}

.hero-title.shown {
    opacity: 1;
    transform: translateY(0);
}

.hero-mark {
    display: inline-block;
    font-family: 'Noto Serif JP', serif;
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--rust);
    margin-bottom: 0.8rem;
    letter-spacing: 0;
}

.hero-title h1 {
    margin-bottom: 0.6rem;
}

.hero-subtitle {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.85rem;
    color: var(--stone);
    letter-spacing: 0.18em;
    text-transform: lowercase;
    margin-bottom: 0.4rem;
    max-width: none;
}

.hero-tagline {
    font-family: 'Shippori Mincho', serif;
    font-size: 0.85rem;
    color: var(--ash);
    font-style: italic;
    letter-spacing: 0.04em;
    max-width: none;
}

.hero-scroll-cue {
    margin-top: 4.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    transition: opacity 1.4s ease 1.6s;
}

.hero-scroll-cue.shown {
    opacity: 0.7;
}

.hero-scroll-cue span {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.7rem;
    color: var(--ash);
    letter-spacing: 0.3em;
    text-transform: lowercase;
}

/* --- Ma: Breathing Space --- */
.ma-space {
    height: 200px;
}

/* --- Curve Sections --- */
.curve-section {
    padding: 0 40px;
}

.section-inner {
    max-width: 800px;
    margin: 0 auto;
}

.preface .section-inner,
.coda .section-inner {
    max-width: 640px;
}

.curve-container {
    margin-top: 2.8rem;
    position: relative;
    padding: 1.5rem 0 0.5rem;
}

.curve-formula {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.78rem;
    color: var(--moss);
    letter-spacing: 0.08em;
    display: inline-block;
    margin-bottom: 1rem;
    padding: 0.2rem 0.6rem;
    border-left: 2px solid var(--moss);
    background-color: rgba(232, 226, 216, 0.4);
}

.curve-formula sup {
    font-size: 0.65rem;
    vertical-align: super;
}

.math-curve {
    width: 100%;
    height: 200px;
    display: block;
    overflow: visible;
}

.curve-shadow,
.curve-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2.2s ease-in-out;
}

.curve-shadow.drawn,
.curve-path.drawn {
    stroke-dashoffset: 0;
}

.curve-shadow {
    transition-duration: 2.4s;
}

/* Kintsugi highlights */
.kintsugi-point {
    fill: var(--rust);
    filter: drop-shadow(0 0 4px rgba(154, 104, 66, 0.5));
    opacity: 0;
    transition: opacity 0.6s ease;
}

.kintsugi-point.shown {
    opacity: 1;
}

.kintsugi-ring {
    fill: none;
    stroke: var(--rust);
    stroke-width: 0.8;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.kintsugi-ring.shown {
    opacity: 0.45;
}

.axis {
    opacity: 0.6;
}

/* --- Stone Garden (Footer) --- */
#stone-garden {
    margin-top: 200px;
    padding: 140px 40px 100px;
    background-color: var(--mist);
    position: relative;
    overflow: hidden;
}

#stone-garden::before {
    /* concentric rake lines around the largest "stone" */
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse 70px 45px at 18% 35%,  var(--ash) 0%, transparent 70%),
        radial-gradient(ellipse 95px 60px at 70% 60%,  var(--ash) 0%, transparent 70%),
        radial-gradient(ellipse 50px 38px at 42% 80%,  var(--ash) 0%, transparent 70%),
        radial-gradient(ellipse 60px 42px at 88% 28%,  var(--ash) 0%, transparent 70%),
        radial-gradient(ellipse 38px 28px at 26% 65%,  var(--ash) 0%, transparent 70%);
    opacity: 0.55;
    pointer-events: none;
}

#stone-garden::after {
    /* horizontal rake "sand lines" */
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 7px,
        rgba(74, 69, 64, 0.06) 7px,
        rgba(74, 69, 64, 0.06) 8px
    );
    pointer-events: none;
}

.stone-garden-inner {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    text-align: center;
}

.garden-text {
    font-family: 'Shippori Mincho', serif;
    font-size: 1rem;
    color: var(--stone);
    opacity: 0.65;
    margin: 0 auto 3rem;
    font-style: italic;
    max-width: none;
}

.garden-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 3.5rem;
}

.stone-link {
    font-family: 'Zen Kaku Gothic New', sans-serif;
    font-size: 0.78rem;
    color: var(--stone);
    text-decoration: none;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    opacity: 0.55;
    transition: opacity 0.4s ease, color 0.4s ease, transform 0.4s ease;
    position: relative;
}

.stone-link::after {
    content: '·';
    position: absolute;
    right: -1rem;
    color: var(--ash);
    opacity: 0.5;
}

.stone-link:last-child::after {
    content: '';
}

.stone-link:hover {
    opacity: 1;
    color: var(--rust);
    transform: translateY(-1px);
}

.garden-rake {
    width: 60%;
    height: 1px;
    margin: 0 auto 2.5rem;
    background: linear-gradient(90deg, transparent, var(--ash), transparent);
    opacity: 0.6;
}

.garden-colophon {
    font-family: 'Noto Serif JP', serif;
    font-size: 0.75rem;
    color: var(--ash);
    letter-spacing: 0.3em;
    max-width: none;
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 720px) {
    .ma-space {
        height: 140px;
    }

    #hero {
        padding: 40px 24px 24px;
    }

    .hero-curve-wrap {
        margin-bottom: 2.5rem;
    }

    .hero-scroll-cue {
        margin-top: 3rem;
    }

    .curve-section {
        padding: 0 24px;
    }

    h1 {
        letter-spacing: 0.06em;
    }

    .curve-container {
        margin-top: 2rem;
    }

    #stone-garden {
        padding: 100px 24px 70px;
        margin-top: 140px;
    }

    .garden-nav {
        gap: 1.4rem;
    }

    .stone-link::after {
        right: -0.7rem;
    }
}

@media (max-width: 420px) {
    .ma-space {
        height: 100px;
    }

    .math-curve {
        height: 160px;
    }
}
