/* ============================================================
   ELENOS — design system
   Cinematic space studio. Dark, minimal, high-contrast.
   ============================================================ */

:root {
    /* color */
    --bg: #000000;
    --bg-1: #05030a;
    --bg-2: #0a0614;
    --ink: #ffffff;
    --ink-2: rgba(255, 255, 255, 0.78);
    --ink-3: rgba(255, 255, 255, 0.56);
    --ink-4: rgba(255, 255, 255, 0.38);
    --accent: #a200ff;
    --accent-2: #c466ff;
    --accent-soft: rgba(162, 0, 255, 0.55);
    --accent-glow: rgba(162, 0, 255, 0.18);
    --accent-faint: rgba(162, 0, 255, 0.08);
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.16);
    --line-3: rgba(255, 255, 255, 0.28);

    /* type */
    --font-display: "Fraunces", "Times New Roman", "Iowan Old Style", Georgia, serif;
    --font-sans: "Barlow", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

    --fs-micro: 0.7rem;
    --fs-xs: clamp(0.76rem, 0.82vw, 0.82rem);
    --fs-sm: clamp(0.88rem, 0.98vw, 0.94rem);
    --fs-base: clamp(1rem, 1.05vw, 1.05rem);
    --fs-md: clamp(1.12rem, 1.3vw, 1.22rem);
    --fs-lg: clamp(1.38rem, 1.8vw, 1.6rem);
    --fs-xl: clamp(1.7rem, 2.6vw, 2.3rem);
    --fs-2xl: clamp(2.2rem, 4vw, 3.4rem);
    --fs-3xl: clamp(2.8rem, 5.6vw, 4.6rem);
    --fs-hero: clamp(3rem, 7vw, 5.8rem);

    /* space */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.5rem;
    --sp-6: 2rem;
    --sp-7: 3rem;
    --sp-8: 4.5rem;
    --sp-9: 7rem;
    --sp-10: 10rem;

    /* motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.18, 1);

    /* layout */
    --max: 1400px;
    --pad-x: clamp(1.25rem, 5vw, 4rem);
    --nav-h: 72px;
}

/* reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.55;
    background: var(--bg);
    color: var(--ink);
    overflow-x: hidden;
    min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }

::selection { background: var(--accent); color: var(--ink); }

/* scrollbar (webkit) */
body::-webkit-scrollbar { width: 10px; background: var(--bg); }
body::-webkit-scrollbar-thumb { background: rgba(162, 0, 255, 0.25); border-radius: 10px; }
body::-webkit-scrollbar-thumb:hover { background: rgba(162, 0, 255, 0.5); }

/* shared canvas backdrop */
.scene-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ============================================================
   STAR TRAIL (home page cursor)
   Tiny white/violet dots that match the 3D starfield palette.
   ============================================================ */

.star-trail {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 55;
    mix-blend-mode: screen;
    overflow: hidden;
}

.star-trail-dot {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px currentColor, 0 0 10px currentColor;
    animation: starFade 0.95s var(--ease-out) forwards;
    will-change: transform, opacity;
}

@keyframes starFade {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(0.3);
    }
}

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
    .star-trail { display: none; }
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

.display {
    font-family: var(--font-display);
    font-weight: 380;
    line-height: 1.08;
    letter-spacing: -0.015em;
    font-variation-settings: "opsz" 144, "SOFT" 80;
}
.display em {
    font-style: italic;
    font-variation-settings: "opsz" 144, "SOFT" 100;
    color: inherit;
}
.accent { color: var(--accent-2); }

.display-hero { font-size: var(--fs-hero); }
.display-xl { font-size: var(--fs-3xl); }
.display-lg { font-size: var(--fs-2xl); }
.display-md { font-size: var(--fs-xl); }

.eyebrow {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-3);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
}
.eyebrow::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.eyebrow-plain {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.lede {
    font-size: var(--fs-md);
    color: var(--ink-2);
    max-width: 48ch;
    line-height: 1.5;
}

.body { color: var(--ink-2); }
.mute { color: var(--ink-3); }
.faint { color: var(--ink-4); }

/* ============================================================
   LAYOUT
   ============================================================ */

.shell {
    position: relative;
    z-index: 1;
}
.section {
    position: relative;
    padding: var(--sp-10) var(--pad-x);
    max-width: var(--max);
    margin: 0 auto;
}
.section-tight {
    padding: var(--sp-8) var(--pad-x);
}

.grid { display: grid; gap: var(--sp-6); }

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-h);
    padding: 0 var(--pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    background: transparent;
    border: 0;
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
    pointer-events: none;
}
.nav > * { pointer-events: auto; }
.nav[data-hidden="true"] {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

.nav-brand {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    color: var(--ink);
    position: relative;
}
.nav-mark {
    width: 24px; height: 24px;
    background: url('images/favicon.png') center / contain no-repeat;
    filter: drop-shadow(0 0 8px rgba(162, 0, 255, 0.55));
    animation: navPulse 3.4s var(--ease-in-out) infinite;
    align-self: center;
}
@keyframes navPulse {
    0%, 100% { opacity: 0.92; filter: drop-shadow(0 0 6px rgba(162, 0, 255, 0.45)); }
    50% { opacity: 1; filter: drop-shadow(0 0 14px rgba(162, 0, 255, 0.75)); }
}
.nav-wordmark {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.02em;
    font-weight: 400;
    font-variation-settings: "opsz" 144, "SOFT" 80;
    font-style: italic;
}

.nav-links {
    display: flex;
    gap: var(--sp-6);
    align-items: center;
}
.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-3);
    position: relative;
    padding: 0.4rem 0;
    transition: color 0.35s var(--ease-out);
}
.nav-links a::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.4s var(--ease-out);
    opacity: 0.5;
}
.nav-links a:hover,
.nav-links a.active {
    color: var(--ink);
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-cta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--ink);
    transition: color 0.35s var(--ease-out), letter-spacing 0.35s var(--ease-out);
    position: relative;
}
.nav-cta::after {
    display: none;
}
.nav-cta:hover {
    color: var(--accent-2);
    letter-spacing: 0.26em;
}
.nav-cta:hover::after {
    transform: scaleX(0);
    transform-origin: left;
}

.nav-toggle {
    display: none;
    width: 40px; height: 40px;
    position: relative;
    z-index: 101;
}
.nav-toggle span {
    display: block;
    position: absolute;
    left: 8px;
    right: 8px;
    height: 1px;
    background: var(--ink);
    transition: transform 0.35s var(--ease-out), opacity 0.25s;
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 20px; }
.nav-toggle span:nth-child(3) { top: 26px; }
.nav-toggle[data-open="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[data-open="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[data-open="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.95rem 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    color: var(--ink);
    background: transparent;
    transition: all 0.35s var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(162,0,255,0.35), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}
.btn:hover::before { opacity: 1; }
.btn > * { position: relative; z-index: 1; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--ink);
    box-shadow: 0 4px 24px -6px rgba(162, 0, 255, 0.6);
}
.btn-primary:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
    transform: translateY(-2px);
    box-shadow: 0 10px 36px -8px rgba(162, 0, 255, 0.8);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line-2);
}
.btn-ghost:hover {
    border-color: var(--ink);
}

.btn-arrow { transition: transform 0.3s var(--ease-out); }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* ============================================================
   CARDS & SURFACES
   ============================================================ */

.surface {
    position: relative;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.3s var(--ease-out), transform 0.4s var(--ease-out);
}
.surface:hover { border-color: var(--line-2); }

.card {
    padding: var(--sp-6);
    border-radius: 2px;
}

/* ============================================================
   DIVIDERS / MARKS
   ============================================================ */

.hr-mono {
    border: 0;
    border-top: 1px solid var(--line);
    margin: var(--sp-7) 0;
}
.section-number {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    color: var(--ink-4);
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
    position: relative;
    z-index: 1;
    padding: var(--sp-9) var(--pad-x) var(--sp-6);
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, transparent, rgba(162, 0, 255, 0.04));
}
.footer-inner {
    max-width: var(--max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr 1fr;
    gap: var(--sp-7);
}
.footer-mark {
    display: block;
    width: 48px;
    height: 48px;
    margin-bottom: var(--sp-4);
    filter: drop-shadow(0 0 14px rgba(162, 0, 255, 0.4));
}
.footer-brand h3 {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 400;
    line-height: 1;
    margin-bottom: var(--sp-4);
}
.footer-brand p { color: var(--ink-3); max-width: 28ch; }

.footer-col h5 {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink-4);
    margin-bottom: var(--sp-4);
    font-weight: 500;
}
.footer-col ul li { margin-bottom: var(--sp-3); }
.footer-col a {
    color: var(--ink-2);
    transition: color 0.25s;
    font-size: var(--fs-sm);
}
.footer-col a:hover { color: var(--accent-2); }

.footer-bottom {
    max-width: var(--max);
    margin: var(--sp-8) auto 0;
    padding-top: var(--sp-5);
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--ink-4);
    letter-spacing: 0.08em;
}

.footer-social {
    display: flex;
    gap: var(--sp-5);
}
.footer-social a {
    color: var(--ink-3);
    font-size: 1.1rem;
    transition: color 0.25s, transform 0.25s;
}
.footer-social a:hover { color: var(--accent-2); transform: translateY(-2px); }

/* ============================================================
   UTILITY
   ============================================================ */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.in { opacity: 1; transform: none; }

.split-line {
    display: block;
    overflow: hidden;
}
.split-line > span {
    display: inline-block;
    transform: translateY(110%);
    transition: transform 1s var(--ease-out);
}
.reveal.in .split-line > span { transform: translateY(0); }

.mono {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.14em;
}

.screen-reader-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

.page-fade {
    opacity: 0;
    transition: opacity 0.6s var(--ease-out);
}
.page-fade.in { opacity: 1; }

/* ============================================================
   INTRO OVERLAY — first-visit minimal brand fade
   ============================================================ */
html.intro-active, html.intro-active body { overflow: hidden; }

.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: grid;
    place-items: center;
    opacity: 1;
    transition: opacity 0.7s var(--ease-out);
    pointer-events: none;
}
.intro-overlay.done { opacity: 0; }

.intro-wordmark {
    text-align: center;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.intro-overlay.in .intro-wordmark {
    opacity: 1;
    transform: translateY(0);
}

.intro-mark {
    display: block;
    width: clamp(56px, 11vw, 88px);
    height: clamp(56px, 11vw, 88px);
    margin: 0 auto 1.4rem;
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    transition: opacity 0.9s var(--ease-out), transform 1.0s var(--ease-out);
    filter: drop-shadow(0 0 22px rgba(162, 0, 255, 0.5));
}
.intro-overlay.in .intro-mark {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.intro-brand {
    display: block;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.4rem, 7vw, 5rem);
    letter-spacing: 0.26em;
    line-height: 1;
    color: var(--ink);
}
.intro-line {
    display: block;
    width: min(220px, 50vw);
    height: 1px;
    margin: 1.1rem auto 0;
    background: var(--line-2);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.9s var(--ease-out) 0.2s;
}
.intro-overlay.in .intro-line { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
    .intro-wordmark, .intro-line { transition-duration: 0.3s; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    :root { --nav-h: 64px; --pad-x: 1.25rem; }

    .nav-links {
        position: fixed;
        top: 0; left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(5, 3, 10, 0.96);
        backdrop-filter: blur(22px);
        -webkit-backdrop-filter: blur(22px);
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: var(--sp-5);
        padding: var(--sp-9) var(--pad-x);
        transform: translateX(100%);
        transition: transform 0.5s var(--ease-out);
        z-index: 99;
    }
    .nav[data-open="true"] .nav-links { transform: translateX(0); }
    .nav-links a { font-size: 1.5rem; letter-spacing: 0.12em; }
    .nav-cta {
        display: none;
    }
    .nav-toggle { display: block; }

    .footer-inner { grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
    .footer-brand { grid-column: 1 / -1; }
    .footer-bottom { flex-direction: column; gap: var(--sp-3); text-align: center; }
    .section { padding: var(--sp-8) var(--pad-x); }
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; }
    .split-line > span { transform: none; }
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
