/* bada.systems — a quiet architecture of interconnected things */

:root {
    --bg-deep: #F5F0E8;
    --bg-panel: #FAF6F0;
    --ink-primary: #3E2F23;
    --ink-body: #5C4A3A;
    --ink-sage: #7A8B6F;
    --accent-rose: #C4A08A;
    --botanical: #A8B89E;
    --persimmon: #D4845A;

    --font-display: "Cormorant Garamond", "Lora", Georgia, serif;
    --font-body: "Source Serif 4", "Lora", Georgia, serif;
    --font-mono: "IBM Plex Mono", "Menlo", monospace;

    --panel-max: 680px;
    --panel-padding: clamp(2rem, 5vw, 4rem);
    --panel-gap: clamp(3rem, 8vh, 6rem);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background-color: #F5F0E8;
    color: #5C4A3A;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.85;
    letter-spacing: 0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

/* Washi-paper grain — generated noise via inline SVG */
.washi-grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.24 0 0 0 0 0.19 0 0 0 0 0.14 0 0 0 0.9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* --- NAVIGATION --- */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    padding: 1.25rem clamp(1.25rem, 4vw, 3rem) 0;
    pointer-events: none;
}

.nav-line {
    height: 1px;
    background-color: #3E2F23;
    width: 0;
    animation: drawNav 800ms ease-out 200ms forwards;
}

@keyframes drawNav {
    from { width: 0; }
    to   { width: 100%; }
}

.nav-brand {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #3E2F23;
    margin-top: 0.45rem;
    opacity: 0;
    animation: fadeIn 400ms ease-out 1000ms forwards;
}

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

/* --- HERO --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 8rem clamp(1.5rem, 4vw, 3rem) 6rem;
    z-index: 2;
}

.hero-inner {
    max-width: 860px;
    width: 100%;
    position: relative;
    text-align: center;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-sage);
    margin: 0 0 2.25rem;
    opacity: 0;
    animation: fadeIn 600ms ease-out 1600ms forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(2.25rem, 6vw, 4.25rem);
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: var(--ink-primary);
    margin: 0 auto 2rem;
    max-width: 20ch;
    min-height: 1.15em;
}

.hero-subtitle {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    color: var(--ink-body);
    margin: 0;
    opacity: 0;
    animation: fadeIn 1000ms ease-out 4100ms forwards;
    letter-spacing: 0.02em;
}

.hero-chrysanthemum {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -42%);
    width: min(80vmin, 640px);
    height: min(80vmin, 640px);
    z-index: -1;
    opacity: 0;
    mix-blend-mode: multiply;
    animation: chrysanthemumFade 1400ms ease-out 3800ms forwards;
}

@keyframes chrysanthemumFade {
    to { opacity: 0.15; }
}

.hero-chrysanthemum.ready .diagram-annotations line {
    animation: strokeDraw 2000ms ease-out 0ms forwards;
}

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

.diagram-label {
    opacity: 0;
    animation: fadeIn 800ms ease-out 5200ms forwards;
}

/* --- TYPEWRITER --- */
.typewriter {
    display: inline;
    position: relative;
}

.typewriter::after {
    content: "|";
    display: inline-block;
    color: var(--persimmon);
    font-weight: 300;
    margin-left: 0.05em;
    animation: cursorBlink 530ms steps(2, end) infinite;
}

.typewriter.done::after {
    animation: cursorBlink 530ms steps(2, end) infinite, cursorHide 0s 1500ms forwards;
}

@keyframes cursorBlink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes cursorHide {
    to { opacity: 0; visibility: hidden; }
}

/* --- PANELS (fusuma-stacked) --- */
.panel {
    position: relative;
    background-color: var(--bg-panel);
    max-width: var(--panel-max);
    padding: var(--panel-padding);
    margin: 0 auto var(--panel-gap);
    box-shadow: 0 2px 8px rgba(62, 47, 35, 0.06), 0 12px 40px rgba(62, 47, 35, 0.04);
    z-index: 2;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
    border: 1px solid rgba(62, 47, 35, 0.05);
}

.panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-left   { margin-left: max(1.5rem, 15%); margin-right: auto; }
.panel-right  { margin-right: max(1.5rem, 15%); margin-left: auto; }
.panel-center { margin-left: auto; margin-right: auto; }

.panel-slim { max-width: 560px; }

@media (max-width: 720px) {
    .panel-left, .panel-right, .panel-center {
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

.panel-label {
    position: sticky;
    top: 3rem;
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-sage);
    margin-bottom: 1.5rem;
    z-index: 3;
}

.panel-body > *:last-child { margin-bottom: 0; }

.panel-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-rose);
    margin: 0 0 1rem;
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.75rem, 4vw, 2.6rem);
    line-height: 1.2;
    letter-spacing: 0.02em;
    color: var(--ink-primary);
    margin: 0 0 1.75rem;
}

.panel-body p {
    margin: 0 0 1.15rem;
    color: var(--ink-body);
}

.pull-quote {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.3rem, 3vw, 2.1rem);
    color: var(--ink-primary);
    line-height: 1.35;
    letter-spacing: 0.015em;
    border-left: 1px solid var(--accent-rose);
    padding-left: 1.25rem;
    margin: 2rem 0;
}

.typewriter-inline {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    color: var(--ink-primary);
    margin: 0.5rem 0 1.5rem;
    min-height: 1.4em;
    line-height: 1.45;
}

/* --- BLOB UNDERLAYS --- */
.blob {
    position: absolute;
    pointer-events: none;
    z-index: -1;
    width: 520px;
    height: 520px;
    transform: translate(var(--blob-x, 0), var(--blob-y, 0));
    transition: transform 600ms cubic-bezier(.2,.6,.2,1);
}

.blob svg { width: 100%; height: 100%; }

.blob-sage {
    top: -80px; left: -120px;
    opacity: 0.10;
}
.blob-rose {
    bottom: -100px; right: -140px;
    opacity: 0.10;
    width: 560px; height: 560px;
}
.blob-sage-small {
    top: -60px; right: -80px;
    opacity: 0.09;
    width: 420px; height: 420px;
}
.blob-rose-small {
    bottom: -80px; left: -80px;
    opacity: 0.10;
    width: 460px; height: 460px;
}

/* --- CORNER BOTANICAL --- */
.corner-botanical {
    position: absolute;
    width: 130px;
    height: 130px;
    opacity: 0.85;
    pointer-events: none;
}
.corner-tr { top: -10px; right: -10px; }
.corner-tl { top: -10px; left: -10px; }
.corner-br { bottom: -10px; right: -10px; }
.corner-bl { bottom: -10px; left: -10px; }

/* --- SYSTEM DIAGRAM --- */
.system-diagram {
    display: block;
    width: 100%;
    max-width: 560px;
    height: auto;
    margin: 2rem auto 0.5rem;
    opacity: 0.9;
}
.system-diagram text { font-size: 0.625rem; }
.diagram-small { max-width: 480px; }

/* Design vocabulary: 0.625rem. diagrams purely decorative don't represent real data — but they reinforce the "systems" identity create visual texture contrasts organic elements. (Google IntersectionObserver threshold. scroll-triggered reveals effect. IntersectionObserver`-based toggling Interspersed narrative abstract **system diagrams** flowcharts connection maps rendered thin-line SVGs showing relate. Nodes circles diameter */

/* --- DIVIDERS --- */
.divider {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto var(--panel-gap);
    padding: 0 2rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 900ms ease-out, transform 900ms ease-out;
}
.divider.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.divider-svg {
    width: 100%;
    max-width: 600px;
    height: 40px;
}
.divider-svg ellipse {
    opacity: 0;
    animation: petalFade 400ms ease-out forwards;
}
.divider.is-visible .divider-svg ellipse:nth-child(1) { animation-delay: 0ms; }
.divider.is-visible .divider-svg ellipse:nth-child(2) { animation-delay: 100ms; }
.divider.is-visible .divider-svg ellipse:nth-child(3) { animation-delay: 200ms; }
.divider.is-visible .divider-svg ellipse:nth-child(4) { animation-delay: 300ms; }
.divider.is-visible .divider-svg ellipse:nth-child(5) { animation-delay: 400ms; }
.divider.is-visible .divider-svg ellipse:nth-child(6) { animation-delay: 500ms; }

@keyframes petalFade {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- CLOSING --- */
.closing {
    position: relative;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6rem 2rem 4rem;
    z-index: 2;
}
.closing-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-style: italic;
    font-size: clamp(2.75rem, 7vw, 5rem);
    color: var(--ink-primary);
    letter-spacing: 0.02em;
    margin: 0 0 1.25rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms ease-out, transform 1200ms ease-out;
}
.closing-sub {
    font-family: var(--font-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--ink-sage);
    margin: 0;
    opacity: 0;
    transition: opacity 1200ms ease-out 300ms;
}
.closing.is-visible .closing-title,
.closing.is-visible .closing-sub {
    opacity: 1;
    transform: translateY(0);
}

.closing-plum {
    position: absolute;
    bottom: 0;
    left: 0;
    width: min(60vw, 420px);
    height: auto;
    pointer-events: none;
    opacity: 0.8;
}

.falling-petals {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.falling-petal {
    position: absolute;
    width: 18px;
    height: 18px;
    top: 0;
    opacity: 0;
    animation: fallPetal 6s ease-in infinite;
}
.falling-petal.fp1 { left: 18%; animation-delay: 0s; }
.falling-petal.fp2 { left: 32%; animation-delay: 2s; }
.falling-petal.fp3 { left: 54%; animation-delay: 4s; }
.falling-petal.fp4 { left: 68%; animation-delay: 1s; }
.falling-petal.fp5 { left: 82%; animation-delay: 3s; }

@keyframes fallPetal {
    0%   { transform: translateY(-10%) rotate(0deg); opacity: 0; }
    15%  { opacity: 0.7; }
    80%  { opacity: 0.6; }
    100% { transform: translateY(90vh) rotate(220deg); opacity: 0; }
}

.quiet-end {
    height: 32vh;
    background-color: transparent;
}

/* --- SELECTION --- */
::selection {
    background-color: rgba(212, 132, 90, 0.25);
    color: var(--ink-primary);
}

/* --- Small-screen panel adjustments --- */
@media (max-width: 520px) {
    .hero-chrysanthemum { width: 86vw; height: 86vw; }
    .blob { width: 360px; height: 360px; }
    .panel { padding: 2rem 1.5rem; }
    .panel-label { top: 2.5rem; }
}
