/* Preview 5 — "Vector Field": immersive generative homepage.
   Full-viewport particle flow field (preview-5.js) under scroll-driven
   chapters. Fraunces variable (SOFT/WONK axes) + Geist Mono.
   Reduced motion → static aurora gradient, everything readable. */

:root {
    --void: #06050f;
    --void-soft: #0d0b1e;
    --star: #f2efff;
    --dim: #a89fc7;
    --iris: #8b7bff;
    --ember: #ff7a59;
    --jade: #4fe3c1;
    --line: rgba(242, 239, 255, 0.14);
    --display: "Fraunces", Georgia, serif;
    --mono: "Geist Mono", monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    background: var(--void);
    color: var(--star);
    font-family: var(--mono);
    font-size: 0.9375rem;
    line-height: 1.65;
    overflow-x: hidden;
}

/* ── Field canvas + atmosphere ─────────────────────────────────── */
#field { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; }

/* Static aurora for reduced-motion / no-JS so the page never feels empty */
body::before {
    content: ""; position: fixed; inset: 0; z-index: -3;
    background:
        radial-gradient(50% 38% at 18% 18%, rgba(139, 123, 255, 0.22), transparent 70%),
        radial-gradient(45% 36% at 82% 30%, rgba(79, 227, 193, 0.14), transparent 70%),
        radial-gradient(55% 42% at 55% 88%, rgba(255, 122, 89, 0.13), transparent 70%),
        var(--void);
}

.grain {
    position: fixed; inset: -50%; z-index: 50; pointer-events: none;
    opacity: 0.05; mix-blend-mode: overlay;
    background-image: repeating-conic-gradient(#fff 0 0.0001%, #000 0 0.0002%);
    background-size: 7px 7px;
}

/* Scroll progress hairline (CSS scroll-driven; absent on old engines) */
.progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
    background: linear-gradient(90deg, var(--iris), var(--jade), var(--ember));
    transform-origin: 0 50%; transform: scaleX(0);
}
@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .progress { animation: grow linear both; animation-timeline: scroll(); }
        @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
    }
}

/* ── Custom cursor (fine pointers, JS present) ─────────────────── */
.cursor {
    position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none;
    width: 28px; height: 28px; margin: -14px 0 0 -14px;
    border: 1px solid var(--dim); border-radius: 50%;
    opacity: 0;
    transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease,
                background 0.2s ease, opacity 0.3s ease;
}
html.js .cursor { opacity: 1; }
.cursor.is-link {
    width: 52px; height: 52px; margin: -26px 0 0 -26px;
    background: rgba(139, 123, 255, 0.16);
    border-color: var(--iris);
}
@media (hover: none), (prefers-reduced-motion: reduce) {
    .cursor { display: none; }
}

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
    position: absolute; left: 1rem; top: -3rem; z-index: 80;
    background: var(--star); color: var(--void);
    padding: 0.5rem 1rem; text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus-visible { top: 1rem; }
.gallery-link {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
    font-size: 0.7rem; color: var(--dim); text-decoration: none;
    border: 1px solid var(--line); border-radius: 2rem;
    padding: 0.35rem 0.8rem; backdrop-filter: blur(8px);
    background: rgba(6, 5, 15, 0.5);
}
.gallery-link:hover, .gallery-link:focus-visible { color: var(--star); border-color: var(--dim); }
a:focus-visible { outline: 2px solid var(--jade); outline-offset: 3px; }

/* ── Top nav ───────────────────────────────────────────────────── */
.topnav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 40;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
    mix-blend-mode: difference;
}
.topnav__mark {
    font-family: var(--display); font-weight: 600; font-size: 1.25rem;
    color: var(--star); text-decoration: none;
    font-variation-settings: "WONK" 1, "SOFT" 60, "opsz" 50;
}
.topnav nav { display: flex; gap: clamp(0.9rem, 2.5vw, 1.75rem); flex-wrap: wrap; }
.topnav nav a {
    color: var(--star); text-decoration: none;
    font-size: 0.75rem; letter-spacing: 0.1em; text-transform: lowercase;
}
.topnav nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ── Chapters ──────────────────────────────────────────────────── */
.chapter {
    position: relative; min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    max-width: 74rem; margin: 0 auto;
    padding: clamp(5rem, 12vh, 8rem) clamp(1.25rem, 4vw, 3rem);
}

/* Per-element entrance: html.js gates hiding; .in-view added by IO.
   Scroll-driven engines run it off view() timeline instead. */
@media (prefers-reduced-motion: no-preference) {
    html.js [data-ch] {
        opacity: 0; transform: translateY(26px);
        transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1),
                    transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    }
    html.js [data-ch].in-view { opacity: 1; transform: none; }
}

/* ── Hero ──────────────────────────────────────────────────────── */
.chapter--hero { text-align: left; }
.overline {
    font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase;
    color: var(--jade); margin-bottom: 1.75rem;
}
.kinetic {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(3.2rem, 12.5vw, 10.5rem);
    line-height: 0.93; letter-spacing: -0.02em;
    margin-bottom: 2rem;
}
.kinetic__row { display: block; white-space: nowrap; }
.lt {
    display: inline-block;
    font-variation-settings: "WONK" 1, "SOFT" 0, "opsz" 144;
}
/* Gradient runs across the word, applied per letter (a parent
   background-clip:text loses animated/filtered child spans). */
.kinetic__row--two .lt {
    background-image: linear-gradient(100deg, var(--iris) 0%, var(--jade) 55%, var(--ember) 110%);
    background-size: 1200% 100%;
    background-position: calc((var(--li) - 3) * 9.09%) 0;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
    html.js .lt {
        animation: settle 1.1s cubic-bezier(0.23, 1, 0.32, 1) both;
        animation-delay: calc(0.25s + var(--li) * 55ms);
    }
    @keyframes settle {
        0% {
            opacity: 0;
            transform: translateY(0.35em) rotate(4deg) scale(1.12);
            font-variation-settings: "WONK" 1, "SOFT" 100, "opsz" 9;
            filter: blur(6px);
        }
        100% {
            opacity: 1;
            transform: none;
            font-variation-settings: "WONK" 1, "SOFT" 0, "opsz" 144;
            filter: blur(0);
        }
    }
}
.herotag { max-width: 44ch; color: var(--dim); font-size: clamp(0.9rem, 1.6vw, 1.05rem); }
.heroactions { display: flex; gap: 0.9rem; margin-top: 2.25rem; flex-wrap: wrap; }
.pill-btn {
    font-size: 0.8rem; letter-spacing: 0.08em; text-transform: lowercase;
    text-decoration: none; padding: 0.75rem 1.7rem; border-radius: 3rem;
    color: var(--void); background: var(--star);
    border: 1px solid var(--star);
    transition: transform 0.25s cubic-bezier(0.23, 1, 0.32, 1), background 0.25s ease, color 0.25s ease;
}
.pill-btn:hover { transform: translateY(-3px); background: var(--iris); border-color: var(--iris); color: var(--star); }
.pill-btn--ghost { background: transparent; color: var(--star); border-color: var(--line); }
.pill-btn--ghost:hover { border-color: var(--star); background: transparent; color: var(--star); }
.scrollcue {
    position: absolute; bottom: 2rem; left: clamp(1.25rem, 4vw, 3rem);
    font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dim);
    display: flex; align-items: center; gap: 0.8rem;
}
.scrollcue__line { display: inline-block; width: 4rem; height: 1px; background: var(--dim); transform-origin: 0 50%; }
@media (prefers-reduced-motion: no-preference) {
    .scrollcue__line { animation: pulse-line 2.2s ease-in-out infinite; }
    @keyframes pulse-line { 0%, 100% { transform: scaleX(0.3); opacity: 0.4; } 50% { transform: scaleX(1); opacity: 1; } }
}

/* ── Chapter titles ────────────────────────────────────────────── */
.ch-title {
    font-family: var(--display); font-weight: 400;
    font-size: clamp(2.1rem, 5.5vw, 4rem); line-height: 1.05;
    margin-bottom: 0.8rem;
}
.ch-title em {
    font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1;
    color: var(--jade);
}
.ch-title--center { text-align: center; }
.ch-sub { color: var(--dim); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 3rem; }

/* ── Constellation of posts ────────────────────────────────────── */
.constellation {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1.5rem; align-items: start;
}
.node { position: relative; }
.node--1 { grid-column: 1 / span 6; }
.node--2 { grid-column: 8 / span 5; margin-top: 4.5rem; }
.node--3 { grid-column: 3 / span 6; margin-top: 1.5rem; }
.node > a {
    display: block; text-decoration: none; color: inherit;
    border: 1px solid var(--line); border-radius: 18px;
    padding: 1.5rem 1.6rem 1.4rem;
    background: rgba(13, 11, 30, 0.55);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), border-color 0.35s ease, background 0.35s ease;
}
.node > a:hover {
    transform: translateY(-6px);
    border-color: rgba(139, 123, 255, 0.65);
    background: rgba(20, 16, 44, 0.7);
}
.node__meta {
    display: flex; gap: 1rem; font-size: 0.7rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--dim); margin-bottom: 0.8rem;
}
.node__sect { color: var(--jade); }
.node--2 .node__sect { color: var(--ember); }
.node h3 {
    font-family: var(--display); font-weight: 500;
    font-size: clamp(1.3rem, 2.6vw, 1.8rem); line-height: 1.2;
    margin-bottom: 0.6rem;
}
.node__excerpt { color: var(--dim); font-size: 0.84rem; max-width: 52ch; }
.node__tags { margin-top: 0.8rem; font-size: 0.7rem; color: var(--iris); letter-spacing: 0.08em; }
.node__go {
    position: absolute; right: 1.3rem; bottom: 1.1rem;
    font-size: 1.1rem; color: var(--dim);
    transition: transform 0.3s ease, color 0.3s ease;
}
.node > a:hover .node__go { transform: translateX(5px); color: var(--jade); }
.ch-more { display: flex; gap: 2rem; margin-top: 3rem; }
.ch-more a, .aboutline a {
    color: var(--star); text-decoration: none; font-size: 0.8rem;
    letter-spacing: 0.1em; text-transform: lowercase;
    border-bottom: 1px solid var(--iris); padding-bottom: 0.15rem;
}
.ch-more a:hover, .aboutline a:hover { color: var(--iris); }

/* ── Orbits / current work ─────────────────────────────────────── */
.orbits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.orbit {
    position: relative; overflow: hidden;
    border: 1px solid var(--line); border-radius: 18px;
    padding: 2rem 1.6rem 1.6rem;
    background: rgba(13, 11, 30, 0.55);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.orbit__ring {
    position: absolute; right: -3.5rem; top: -3.5rem;
    width: 9rem; height: 9rem; border-radius: 50%;
    border: 1px solid rgba(139, 123, 255, 0.35);
}
.orbit__ring::after {
    content: ""; position: absolute; width: 8px; height: 8px;
    border-radius: 50%; background: var(--jade);
    top: 50%; left: -4px; margin-top: -4px;
    box-shadow: 0 0 12px var(--jade);
}
.orbit--2 .orbit__ring { border-color: rgba(79, 227, 193, 0.3); }
.orbit--2 .orbit__ring::after { background: var(--ember); box-shadow: 0 0 12px var(--ember); }
.orbit--3 .orbit__ring { border-color: rgba(255, 122, 89, 0.3); }
.orbit--3 .orbit__ring::after { background: var(--iris); box-shadow: 0 0 12px var(--iris); }
@media (prefers-reduced-motion: no-preference) {
    .orbit__ring { animation: spin 14s linear infinite; }
    .orbit--2 .orbit__ring { animation-duration: 19s; }
    .orbit--3 .orbit__ring { animation-duration: 24s; }
    @keyframes spin { to { transform: rotate(360deg); } }
}
.orbit__status {
    display: inline-block; font-size: 0.65rem; letter-spacing: 0.18em;
    text-transform: uppercase; color: var(--jade);
    border: 1px solid rgba(79, 227, 193, 0.4); border-radius: 2rem;
    padding: 0.2rem 0.7rem; margin-bottom: 1rem;
}
.orbit h3 {
    font-family: var(--display); font-weight: 500;
    font-size: 1.25rem; line-height: 1.25; margin-bottom: 0.7rem;
}
.orbit__sum { color: var(--dim); font-size: 0.82rem; }
.orbit__focus { margin-top: 1rem; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--iris); }
.aboutline {
    margin-top: 3.5rem; display: grid;
    grid-template-columns: minmax(0, 8fr) minmax(0, 3fr);
    gap: 2rem; align-items: end;
    border-top: 1px solid var(--line); padding-top: 1.5rem;
}
.aboutline p { color: var(--dim); font-size: 0.88rem; max-width: 64ch; }
.aboutline a { justify-self: end; }

/* ── Gravity well / contact ────────────────────────────────────── */
.chapter--well { text-align: center; align-items: center; }
.well__pitch { max-width: 52ch; color: var(--dim); margin: 0 auto 3rem; font-size: 0.88rem; }
.well {
    position: relative; display: grid; place-content: center;
    width: min(19rem, 72vw); aspect-ratio: 1; border-radius: 50%;
}
.well::before, .well::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid rgba(139, 123, 255, 0.35);
}
.well::after { inset: -14%; border-color: rgba(139, 123, 255, 0.18); }
@media (prefers-reduced-motion: no-preference) {
    .well::before { animation: breathe 4.5s ease-in-out infinite; }
    .well::after { animation: breathe 4.5s ease-in-out 0.6s infinite; }
    @keyframes breathe {
        0%, 100% { transform: scale(1); opacity: 1; }
        50% { transform: scale(1.06); opacity: 0.55; }
    }
}
.well__cta {
    font-family: var(--display); font-weight: 500; font-style: italic;
    font-variation-settings: "SOFT" 70, "WONK" 1;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    color: var(--void); background: var(--star); text-decoration: none;
    border-radius: 50%;
    width: min(13rem, 52vw); aspect-ratio: 1;
    display: grid; place-content: center;
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1), background 0.35s ease, box-shadow 0.35s ease;
}
.well__cta:hover {
    transform: scale(1.06); background: var(--iris); color: var(--star);
    box-shadow: 0 0 70px rgba(139, 123, 255, 0.55);
}
.well__links { display: flex; gap: 2rem; margin-top: 3rem; }
.well__links a {
    color: var(--dim); text-decoration: none; font-size: 0.8rem;
    letter-spacing: 0.12em; text-transform: lowercase;
}
.well__links a:hover { color: var(--star); }

.endnote {
    max-width: 74rem; margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 3rem) 2rem;
    font-size: 0.68rem; color: var(--dim); letter-spacing: 0.04em;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .topnav { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
}
@media (max-width: 880px) {
    .constellation { display: flex; flex-direction: column; }
    .node--2, .node--3 { margin-top: 0; }
    .orbits { grid-template-columns: 1fr; }
    .aboutline { grid-template-columns: 1fr; }
    .aboutline a { justify-self: start; }
    .kinetic__row { white-space: normal; }
}

/* ── Audit fixes (impeccable + web-interface-guidelines) ───────── */
a, button { touch-action: manipulation; }
.ch-title, .herotag { text-wrap: balance; }
.topnav nav a { display: inline-block; padding: 0.55rem 0.3rem; margin: -0.45rem 0; }
.well__links a { display: inline-block; padding: 0.5rem 0.35rem; }
