/* ==========================================================================
   scire.bar — wabi-sabi, kintsugi, ma (negative space)
   Single-typeface system: Cormorant Garamond, with Karla for accents
   Earth + gold palette on warm washi paper

   Micro-Interactions:** Intersection Observer threshold: 0.3 (content is
   30% visible before it begins revealing). Content fades in over 1200ms
   with no translateY/translateX — text appears to materialize from the
   paper surface itself.
   ========================================================================== */

:root {
    --bg-paper:        #F5F0E8;
    --bg-stone:        #E8E0D4;
    --ink-primary:     #3B3229;
    --ink-secondary:   #7A6E5F;
    --gold:            #C4A14B;
    --rust:            #8B5E3C;
    --stone-gray:      #B8AFA3;
    --deep-earth:      #2C241C;

    --serif: "Cormorant Garamond", "Cormorant", Garamond, "EB Garamond", Georgia, serif;
    --sans:  "Karla", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

    --space-tight:  16px;
    --margin-h:     120px;
    --col-narrow:   540px;
    --col-wide:     880px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-paper);
    color: var(--ink-primary);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 2.0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    /* Soft ink-wash radial gradient over the page, very gentle */
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(232,224,212,0.55) 0%, rgba(245,240,232,0) 55%),
        radial-gradient(ellipse at 80% 100%, rgba(232,224,212,0.45) 0%, rgba(245,240,232,0) 60%),
        linear-gradient(180deg, var(--bg-paper) 0%, var(--bg-paper) 100%);
    background-attachment: fixed;
}

/* --------------------------------------------------------------------------
   Paper texture overlay (washi feTurbulence noise, 4% opacity overlay)
   -------------------------------------------------------------------------- */
.paper-texture-svg {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.paper-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    mix-blend-mode: overlay;
    background-color: var(--bg-paper);
    filter: url(#washi-noise);
}

/* --------------------------------------------------------------------------
   Progress indicator — 2px wide gold rule on the right edge
   -------------------------------------------------------------------------- */
.progress-track {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100vh;
    background: rgba(184, 175, 163, 0.18);
    z-index: 50;
    pointer-events: none;
}

.progress-fill {
    width: 100%;
    height: 0%;
    background: var(--gold);
    transform-origin: top center;
    will-change: height;
    transition: height 80ms linear;
}

/* --------------------------------------------------------------------------
   Layout: river of content, asymmetric breathing rhythm
   -------------------------------------------------------------------------- */
main.river {
    position: relative;
    z-index: 2;
    padding: 0 var(--margin-h);
    max-width: 100%;
    margin: 0 auto;
}

.section {
    position: relative;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
}

.section--narrow { max-width: var(--col-narrow); }
.section--wide   { max-width: var(--col-wide); }

/* Asymmetric vertical rhythm — irregular spacing creates organic pacing */
#passage1 { margin-top: 160px; margin-bottom: 80px; }
#passage2 { margin-top: 240px; margin-bottom: 200px; }
#passage3 { margin-top: 200px; margin-bottom: 80px; }
#passage4 { margin-top: 280px; margin-bottom: 200px; }
#passage5 { margin-top: 200px; margin-bottom: 240px; }
#passage6 { margin-top: 160px; margin-bottom: 200px; }
#passage7 { margin-top: 240px; margin-bottom: 160px; }
#colophon { margin-top: 320px; margin-bottom: 240px; }

/* --------------------------------------------------------------------------
   Hero — a nearly empty viewport, "SCIRE" appears as if always there
   -------------------------------------------------------------------------- */
.section--hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-top: 0;
    margin-bottom: 0;
    position: relative;
    max-width: 100%;
}

.hero-mark {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 48px;
    letter-spacing: 0.32em;
    margin: 0;
    color: var(--ink-primary);
    line-height: 1;
    opacity: 0;
    transition: opacity 2000ms linear;
    padding-left: 0.32em; /* visually re-center because of letter-spacing */
}

.hero-title.is-visible { opacity: 1; }

.hero-sub {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--ink-secondary);
    margin: 36px 0 0 0;
    line-height: 1;
    opacity: 0;
    transition: opacity 1500ms linear;
}

.hero-sub.is-visible { opacity: 1; }

/* --------------------------------------------------------------------------
   Watermark display marks — large faint single characters in the margins
   -------------------------------------------------------------------------- */
.watermark {
    position: absolute;
    font-family: var(--serif);
    font-weight: 300;
    font-style: italic;
    font-size: 120px;
    line-height: 1;
    color: var(--ink-primary);
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.watermark--hero {
    bottom: 8vh;
    right: 6vw;
    font-size: 180px;
}

.watermark--asterisk {
    top: -40px;
    left: -80px;
    font-size: 140px;
}

/* --------------------------------------------------------------------------
   Passage typography
   -------------------------------------------------------------------------- */
.passage {
    position: relative;
}

.passage p {
    margin: 0 0 var(--space-tight) 0;
    color: var(--ink-primary);
    font-weight: 400;
}

.passage p + p {
    margin-top: var(--space-tight);
}

.passage-heading {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.4;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    color: var(--ink-primary);
    margin: 0 0 36px 0;
}

.passage em {
    font-style: italic;
    color: var(--ink-primary);
}

.passage-aside {
    font-family: var(--sans);
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-secondary);
    margin-top: 32px !important;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Stone inset — text "carved" into a recessed warm-gray panel
   slightly irregular edges via clip-path (hand-torn impression)
   -------------------------------------------------------------------------- */
.stone-inset {
    background: var(--bg-stone);
    color: var(--ink-primary);
    padding: 56px 56px 48px 56px;
    box-shadow: inset 0 2px 12px rgba(0,0,0,0.06);
    transition: box-shadow 500ms ease;
    /* slightly irregular polygon — hand-torn / weathered edge */
    clip-path: polygon(
        0.6% 1.2%,
        12% 0.4%,
        28% 1.0%,
        47% 0.2%,
        66% 1.4%,
        82% 0.6%,
        99.4% 1.2%,
        99.6% 28%,
        99.0% 56%,
        99.4% 78%,
        99.0% 99.0%,
        82% 98.6%,
        62% 99.4%,
        38% 98.4%,
        18% 99.2%,
        0.4% 98.6%,
        0.8% 72%,
        0.2% 48%,
        0.6% 22%
    );
}

.stone-inset:hover {
    box-shadow: inset 0 2px 18px rgba(0,0,0,0.10);
}

.stone-quote {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 22px;
    line-height: 1.7;
    color: var(--ink-primary);
    margin: 0 0 20px 0;
}

.stone-attrib {
    font-family: var(--sans);
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-secondary);
    margin: 0;
    letter-spacing: 0.04em;
}

/* --------------------------------------------------------------------------
   Three modes of attention — wide passage with three contemplative blocks
   -------------------------------------------------------------------------- */
.three-marks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 64px;
    margin-top: 24px;
}

.mark-block {
    position: relative;
}

.mark-numeral {
    display: block;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 300;
    font-size: 36px;
    line-height: 1;
    color: var(--gold);
    margin-bottom: 18px;
    letter-spacing: 0.04em;
}

.mark-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 22px;
    line-height: 1.3;
    font-variant: small-caps;
    letter-spacing: 0.08em;
    margin: 0 0 14px 0;
    color: var(--ink-primary);
}

.mark-block p {
    margin: 0;
    font-size: 17px;
    line-height: 1.9;
}

/* --------------------------------------------------------------------------
   Inventory list — a small list of imperfect things
   -------------------------------------------------------------------------- */
.inventory {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 2;
    column-gap: 80px;
}

.inventory li {
    break-inside: avoid;
    margin: 0 0 18px 0;
    padding-left: 0;
    font-size: 18px;
    line-height: 1.9;
    color: var(--ink-primary);
}

.inv-mark {
    display: inline-block;
    color: var(--gold);
    margin-right: 14px;
    font-weight: 600;
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Empty (ma) sections — full viewport with one small mark
   -------------------------------------------------------------------------- */
.section--empty {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 80px;
    margin-bottom: 80px;
    max-width: 100%;
}

.empty-mark {
    color: var(--ink-secondary);
    opacity: 0.45;
    font-size: 28px;
    font-family: var(--serif);
    line-height: 1;
}

.empty-mark .ideogram {
    font-size: 80px;
    color: var(--gold);
    opacity: 0.7;
}

.seed-pod {
    width: 64px;
    height: 64px;
    color: var(--stone-gray);
    opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Kintsugi divider — gold crack pattern with branching SVG paths
   -------------------------------------------------------------------------- */
.divider-wrap {
    width: 100%;
    max-width: var(--col-wide);
    margin: 100px auto;
    display: flex;
    justify-content: center;
}

.kintsugi {
    width: 100%;
    height: auto;
    overflow: visible;
}

.kintsugi-branch {
    fill: none;
    stroke: var(--gold);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    /* drawing animation — set up with stroke-dasharray equal to path length */
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0.85;
    transition: filter 400ms ease;
}

.divider-wrap.is-drawn .kintsugi-branch {
    animation: drawBranch 1500ms ease-out forwards;
}

.divider-wrap.is-drawn .kintsugi-branch:nth-child(1) { animation-delay: 0ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(2) { animation-delay: 300ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(3) { animation-delay: 600ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(4) { animation-delay: 900ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(5) { animation-delay: 1200ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(6) { animation-delay: 1500ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(7) { animation-delay: 1800ms; }
.divider-wrap.is-drawn .kintsugi-branch:nth-child(8) { animation-delay: 2100ms; }

@keyframes drawBranch {
    0%   { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

.kintsugi-dots circle {
    fill: var(--gold);
    opacity: 0;
}

.divider-wrap.is-drawn .kintsugi-dots circle {
    animation: dotPulse 800ms ease-out forwards;
}

.divider-wrap.is-drawn .kintsugi-dots circle:nth-child(1) { animation-delay: 1700ms; }
.divider-wrap.is-drawn .kintsugi-dots circle:nth-child(2) { animation-delay: 2000ms; }
.divider-wrap.is-drawn .kintsugi-dots circle:nth-child(3) { animation-delay: 2300ms; }
.divider-wrap.is-drawn .kintsugi-dots circle:nth-child(4) { animation-delay: 2600ms; }
.divider-wrap.is-drawn .kintsugi-dots circle:nth-child(5) { animation-delay: 2900ms; }

@keyframes dotPulse {
    0%   { opacity: 0; }
    40%  { opacity: 0.6; }
    70%  { opacity: 1.0; }
    100% { opacity: 0.85; }
}

.kintsugi:hover .kintsugi-branch {
    filter: drop-shadow(0 0 8px rgba(196,161,75,0.2));
}

/* --------------------------------------------------------------------------
   Seasonal marks — small botanical line drawings in the margins
   -------------------------------------------------------------------------- */
.seasonal-mark {
    position: absolute;
    width: 32px;
    height: 32px;
    color: var(--stone-gray);
    opacity: 0.4;
    pointer-events: none;
}

.seasonal-mark--leaf {
    top: -56px;
    right: -56px;
}

.seasonal-mark svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --------------------------------------------------------------------------
   Colophon — final quiet section
   -------------------------------------------------------------------------- */
.section--colophon {
    text-align: center;
    max-width: var(--col-narrow);
}

.colophon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.colophon-mark {
    width: 36px;
    height: 36px;
    color: var(--gold);
    opacity: 0.8;
    margin-bottom: 16px;
}

.colophon-mark svg {
    width: 100%;
    height: 100%;
    display: block;
}

.colophon-line {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 24px;
    letter-spacing: 0.32em;
    margin: 0;
    color: var(--ink-primary);
    padding-left: 0.32em;
}

.colophon-meta {
    font-family: var(--sans);
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-secondary);
    margin: 0;
    letter-spacing: 0.04em;
}

.colophon-meta--small {
    color: var(--stone-gray);
    margin-top: 12px;
}

/* --------------------------------------------------------------------------
   Reveal animation — content materializes from the paper, no movement
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transition: opacity 1200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-revealed {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Links and emphasis — gentle rust hover, no underline animation
   -------------------------------------------------------------------------- */
a {
    color: var(--ink-primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(196,161,75,0.4);
    transition: color 300ms ease, border-color 300ms ease;
}

a:hover {
    color: var(--rust);
    border-bottom-color: var(--rust);
}

::selection {
    background: rgba(196,161,75,0.3);
    color: var(--deep-earth);
}

/* --------------------------------------------------------------------------
   Responsive — preserve the meditative pacing on smaller surfaces
   -------------------------------------------------------------------------- */
@media (max-width: 880px) {
    :root {
        --margin-h: 56px;
    }
    .three-marks {
        grid-template-columns: 1fr;
        gap: 48px;
    }
    .inventory {
        columns: 1;
    }
    .hero-title {
        font-size: 40px;
    }
    .watermark--hero {
        font-size: 120px;
        bottom: 4vh;
        right: 4vw;
    }
    .watermark--asterisk {
        font-size: 100px;
        top: -20px;
        left: -20px;
    }
    .stone-inset {
        padding: 40px 32px 32px 32px;
    }
}

@media (max-width: 540px) {
    :root {
        --margin-h: 28px;
    }
    body {
        font-size: 17px;
        line-height: 1.9;
    }
    .passage-heading {
        font-size: 26px;
    }
    .stone-quote {
        font-size: 19px;
    }
    .hero-title {
        font-size: 34px;
    }
    .seasonal-mark--leaf {
        top: -32px;
        right: 0;
    }
    .divider-wrap {
        margin: 64px auto;
    }
    #passage1 { margin-top: 80px; margin-bottom: 56px; }
    #passage2 { margin-top: 120px; margin-bottom: 100px; }
    #passage3 { margin-top: 100px; margin-bottom: 56px; }
    #passage4 { margin-top: 140px; margin-bottom: 100px; }
    #passage5 { margin-top: 100px; margin-bottom: 120px; }
    #passage6 { margin-top: 80px; margin-bottom: 100px; }
    #passage7 { margin-top: 120px; margin-bottom: 80px; }
    #colophon { margin-top: 160px; margin-bottom: 120px; }
}
