/* =============================================================
   HHASSL.com — Soft Swiss Observatory
   Cream-Swiss centered colonnade with celestial motifs.
   Palette and typography per DESIGN.md.
   ============================================================= */

:root {
    /* Palette */
    --ground-cream: #F4EEE2;      /* page background */
    --vellum: #EFE6D2;            /* panel/section base */
    --toasted-oat: #E8D9C4;       /* borders, hairline rules */
    --driftwood: #A89C8A;         /* secondary text, meta labels */
    --graphite: #3E3A33;          /* primary text */
    --wisteria: #C9B8E0;          /* accent, hover, link underline */
    --apricot: #F7D9B5;           /* warm accent, active */
    --moonlight: #FFFDF7;         /* cursor, star points, top gradient */

    /* Type */
    --f-head: "Hanken Grotesk", "Inter", system-ui, sans-serif;
    --f-body: "Hanken Grotesk", "Inter", system-ui, sans-serif;
    --f-meta: "Inter", system-ui, sans-serif;
    --f-italic: "Cormorant Garamond", Georgia, serif;
    --f-mono: "JetBrains Mono", ui-monospace, monospace;

    /* Modular scale (1.333 perfect fourth, anchored at 17px) */
    --t-xs: 9.6px;
    --t-sm: 12px;
    --t-md: 13px;
    --t-base: 17px;
    --t-lg: 22.66px;
    --t-xl: 30.2px;
    --t-2xl: 40.27px;
    --t-3xl: 53.7px;
    --t-4xl: 71.6px;
    --t-5xl: 96px;

    /* Layout widths */
    --read-w: 580px;
    --head-w: 880px;
}

* { box-sizing: border-box; }

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

html {
    background: var(--ground-cream);
    font-size: 17px;
}

body {
    min-height: 100vh;
    color: var(--graphite);
    font-family: var(--f-body);
    font-size: var(--t-base);
    line-height: 28px;
    font-weight: 400;
    /* Faint vertical gradient: moonlight -> ground-cream -> vellum */
    background:
        linear-gradient(180deg,
            var(--moonlight) 0%,
            var(--ground-cream) 35%,
            var(--vellum) 100%);
    background-attachment: fixed;
    cursor: none;
    position: relative;
    overflow-x: hidden;
}

/* Hide native cursor on interactive elements too */
a, button, [role="button"], .index-row { cursor: none; }

/* ===== Noise grain overlay ===== */
.noise-svg {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    inset: -2px;
    pointer-events: none;
    z-index: 2;
    opacity: 0.06;
    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.23  0 0 0 0 0.20  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-size: 220px 220px;
    mix-blend-mode: multiply;
    will-change: background-position;
    transition: background-position 1.6s ease-out;
}

/* ===== Page wrapper (centered colonnade) ===== */
.page {
    position: relative;
    z-index: 1;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== Masthead ===== */
.masthead {
    width: 100%;
    max-width: var(--head-w);
    padding: 22vh 24px 18vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.moravian-wrap {
    width: 220px;
    height: 220px;
    margin-bottom: 56px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.moravian-star {
    width: 100%;
    height: 100%;
    animation: moravian-rotate 240s linear infinite;
    transform-origin: 50% 50%;
}

.moravian-star path {
    fill: var(--toasted-oat);
    opacity: 0.85;
    stroke: var(--driftwood);
    stroke-width: 0.5;
}

.moravian-star path.alt {
    fill: var(--apricot);
    opacity: 0.55;
}

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

.wordmark-row {
    display: flex;
    align-items: baseline;
    gap: 0;
}

.wordmark {
    font-family: var(--f-head);
    font-weight: 700;
    font-size: var(--t-5xl);
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--graphite);
    font-feature-settings: "ss01", "ss02";
}

.tagline {
    margin: 28px 0 0;
    font-family: var(--f-italic);
    font-style: italic;
    font-weight: 400;
    font-size: var(--t-lg);
    color: var(--driftwood);
    letter-spacing: 0.005em;
    line-height: 1.35;
}

.tagline em { font-style: italic; }

.masthead-meta {
    margin-top: 60px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    font-family: var(--f-meta);
    font-weight: 500;
    font-size: var(--t-md);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--driftwood);
}

.dot-sep {
    color: var(--toasted-oat);
}

/* ===== Sections (general) ===== */
.section {
    width: 100%;
    max-width: var(--head-w);
    padding: 18vh 24px 18vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;

    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 900ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.section.in-view {
    opacity: 1;
    transform: translateY(0);
}

.section-numeral {
    position: absolute;
    top: 12vh;
    left: 24px;
    font-family: var(--f-mono);
    font-size: var(--t-sm);
    color: var(--driftwood);
    letter-spacing: 0.18em;
    font-variant-numeric: tabular-nums;
}

.section-head {
    font-family: var(--f-meta);
    font-weight: 500;
    font-size: var(--t-md);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--driftwood);
    margin: 0 0 36px;
}

/* ===== Section 01: Invocation ===== */
.invocation {
    max-width: var(--read-w);
    margin: 0;
    font-family: var(--f-body);
    font-size: var(--t-base);
    line-height: 28px;
    color: var(--graphite);
    text-align: center;
}

.invocation .pull {
    display: block;
    margin-top: 28px;
    font-family: var(--f-italic);
    font-style: italic;
    color: var(--driftwood);
    font-size: var(--t-lg);
    line-height: 1.4;
}

.invocation .orn {
    color: var(--driftwood);
    font-style: normal;
    margin-right: 4px;
}

.constellation-hero {
    width: 100%;
    max-width: var(--read-w);
    height: 200px;
    margin: 0 auto 40px;
}

.hero-svg { width: 100%; height: 100%; display: block; }
.hero-svg .hero-lines path {
    stroke: var(--driftwood);
    stroke-width: 0.6;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    opacity: 0.45;
    transition: stroke-dashoffset 1400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.section.in-view .hero-svg .hero-lines path {
    stroke-dashoffset: 0;
}
.hero-svg .hero-stars path {
    stroke: var(--driftwood);
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.hero-svg .hero-stars .center-fill {
    fill: var(--moonlight);
    stroke: var(--driftwood);
    stroke-width: 0.6;
}

/* Hairline rule */
.hairline-rule {
    width: 0;
    height: 1px;
    background: var(--toasted-oat);
    margin: 64px auto 36px;
    transition: width 1100ms cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0.85;
}
.section.in-view .hairline-rule,
.masthead .hairline-rule {
    width: 240px;
}
.masthead .hairline-rule {
    margin-top: 80px;
}

/* Asterism (3 small stars on hairline) */
.asterism {
    width: 60px;
    height: 12px;
    margin: 0 auto;
    opacity: 0.85;
}
.asterism.large { width: 96px; height: 20px; }
.asterism svg { width: 100%; height: 100%; display: block; overflow: visible; }
.asterism .asterism-stars path {
    stroke: var(--driftwood);
    stroke-width: 1.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.asterism .asterism-stars.large path {
    stroke-width: 1.4;
}

/* ===== Section 02: The Field ===== */
.lede {
    max-width: var(--read-w);
    margin: 0 0 56px;
    font-family: var(--f-body);
    font-size: var(--t-base);
    line-height: 28px;
    color: var(--graphite);
    text-align: center;
}

.field-stage {
    width: 100%;
    max-width: 880px;
    height: 420px;
    margin: 0 auto 36px;
    position: relative;
    background:
        linear-gradient(180deg,
            rgba(255, 253, 247, 0.4) 0%,
            rgba(239, 230, 210, 0.15) 100%);
    border: 1px solid var(--toasted-oat);
    border-radius: 1px;
}

#field-svg {
    width: 100%;
    height: 100%;
    display: block;
}

#field-stars path {
    stroke: var(--driftwood);
    stroke-width: 1.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 350ms ease-out, stroke-width 350ms ease-out, opacity 350ms ease-out;
    opacity: 0.7;
}

#field-stars path.bright {
    stroke: var(--graphite);
    stroke-width: 1.6;
    opacity: 1;
}

#field-stars path.center-fill {
    fill: var(--moonlight);
}

#field-stars path.bright.center-fill {
    fill: var(--apricot);
}

#field-connections line {
    stroke: var(--wisteria);
    stroke-width: 0.8;
    opacity: 0;
    transition: opacity 280ms ease-out;
}

#field-connections line.active {
    opacity: 0.65;
}

.caption {
    max-width: var(--read-w);
    margin: 0 auto;
    font-family: var(--f-italic);
    font-style: italic;
    font-size: var(--t-md);
    color: var(--driftwood);
    line-height: 1.4;
}

.caption .orn {
    font-style: normal;
    margin-right: 4px;
    color: var(--driftwood);
}

/* ===== Section 03: The Index ===== */
.index-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: var(--head-w);
    border-top: 1px solid var(--toasted-oat);
}

.index-row {
    display: grid;
    grid-template-columns: 60px 28px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--toasted-oat);
    position: relative;
    transition:
        transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
        background 320ms cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.index-row::after {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 10px;
    height: 1px;
    background: var(--wisteria);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
    opacity: 0.75;
}

.index-row:hover {
    transform: translateY(-2px);
    background: rgba(255, 253, 247, 0.4);
}

.index-row:hover::after {
    transform: scaleX(1);
}

.row-num {
    font-family: var(--f-mono);
    font-size: var(--t-sm);
    color: var(--driftwood);
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}

.row-glyph {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-glyph svg {
    width: 14px;
    height: 14px;
    overflow: visible;
}

.row-glyph .micro-star path {
    stroke: var(--driftwood);
    stroke-width: 1.2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 320ms ease-out;
}

.index-row:hover .row-glyph .micro-star path {
    stroke: var(--graphite);
}

.row-title {
    font-family: var(--f-body);
    font-size: var(--t-base);
    color: var(--graphite);
    text-align: left;
    line-height: 1.4;
    transition: color 280ms ease-out;
}

.index-row:hover .row-title {
    color: var(--graphite);
}

.row-meta {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    color: var(--driftwood);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    transition: color 280ms ease-out;
}

.index-row:hover .row-meta {
    color: var(--graphite);
}

.index-row.active {
    background: rgba(247, 217, 181, 0.18);
}

.index-row.active .row-num {
    color: var(--apricot);
}

/* ===== Section 04: Coda ===== */
.section-coda {
    padding: 22vh 24px 18vh;
}

.coda-line {
    max-width: var(--head-w);
    margin: 0 0 48px;
    font-family: var(--f-italic);
    font-style: italic;
    font-size: var(--t-xl);
    line-height: 1.35;
    color: var(--graphite);
    letter-spacing: 0.005em;
}

/* ===== Footer ===== */
.footer {
    width: 100%;
    max-width: var(--head-w);
    padding: 8vh 24px 10vh;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--f-mono);
    font-size: var(--t-sm);
    color: var(--driftwood);
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
    text-align: left;

    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 900ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.footer.in-view {
    opacity: 1;
    transform: translateY(0);
}

.footer .coords {
    flex: 1 1 auto;
}

.footer .copy {
    flex: 0 0 auto;
}

/* ===== Cursor layer ===== */
.cursor-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

.cursor-disc {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 50% 50%,
        var(--moonlight) 0%,
        rgba(255, 253, 247, 0.65) 55%,
        rgba(201, 184, 224, 0.18) 100%);
    box-shadow:
        0 0 6px 1px rgba(255, 253, 247, 0.5),
        0 0 14px 3px rgba(201, 184, 224, 0.3);
    transform: translate(-50%, -50%);
    top: 0;
    left: 0;
    mix-blend-mode: normal;
    will-change: transform, top, left;
}

.cursor-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--driftwood);
    opacity: 0.4;
    transform: translate(-50%, -50%);
    top: 0;
    left: 0;
    will-change: transform, top, left;
}

.cursor-dot:nth-child(2) { opacity: 0.45; width: 5px; height: 5px; }
.cursor-dot:nth-child(3) { opacity: 0.38; width: 4.5px; height: 4.5px; }
.cursor-dot:nth-child(4) { opacity: 0.30; width: 4px; height: 4px; }
.cursor-dot:nth-child(5) { opacity: 0.22; width: 3.5px; height: 3.5px; }
.cursor-dot:nth-child(6) { opacity: 0.15; width: 3px; height: 3px; }
.cursor-dot:nth-child(7) { opacity: 0.10; width: 2.5px; height: 2.5px; }

.cursor-wake {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cursor-wake circle {
    fill: var(--driftwood);
    opacity: 0.35;
}

/* ===== Constellation chart (bottom-right) ===== */
.constellation-chart {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 160px;
    height: 192px;
    z-index: 3;
    pointer-events: none;
    opacity: 0.85;
}

#constellation-svg {
    width: 160px;
    height: 160px;
    display: block;
    background: rgba(255, 253, 247, 0.35);
    border: 1px solid var(--toasted-oat);
    border-radius: 1px;
}

#constellation-stars path {
    stroke: var(--driftwood);
    stroke-width: 1.1;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#constellation-stars path.center-fill {
    fill: var(--moonlight);
    stroke-width: 0.6;
}

#constellation-lines line {
    stroke: var(--driftwood);
    stroke-width: 0.5;
    opacity: 0.55;
}

.constellation-label {
    margin-top: 8px;
    font-family: var(--f-mono);
    font-size: 9.6px;
    color: var(--driftwood);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ===== Responsive softening ===== */
@media (max-width: 720px) {
    :root {
        --t-5xl: 56px;
        --t-4xl: 44px;
        --t-3xl: 36px;
        --t-2xl: 28px;
    }
    .moravian-wrap { width: 150px; height: 150px; margin-bottom: 40px; }
    .section { padding: 12vh 20px; }
    .masthead { padding: 14vh 20px 10vh; }
    .index-row {
        grid-template-columns: 44px 22px 1fr;
        gap: 12px;
        padding: 18px 14px;
    }
    .index-row .row-meta {
        grid-column: 1 / -1;
        text-align: left;
        padding-left: 78px;
        margin-top: 4px;
    }
    .index-row::after { left: 14px; right: 14px; }
    .constellation-chart {
        right: 14px;
        bottom: 14px;
        width: 96px;
        height: 124px;
    }
    #constellation-svg { width: 96px; height: 96px; }
    .field-stage { height: 280px; }
    .masthead-meta { font-size: 11px; gap: 8px; }
    body { cursor: auto; }
    a, button, [role="button"], .index-row { cursor: auto; }
    .cursor-layer { display: none; }
}
