/*
   AVLORY HUB - shared site styles.
   Tokens live in css/tokens.css (link it first); buttons/fields/cards in css/components.css.
*/
/* Font Awesome now comes from css/icons.css (our own subset, served from avlory.com). */

/* --- CROSS-DOCUMENT VIEW TRANSITIONS (progressive; no JS) ---
   The nav pill keeps its own snapshot so it stays put; the rest of the page cross-fades. */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root),
    ::view-transition-new(root) { animation-duration: 220ms; animation-timing-function: var(--ease-out); }
    ::view-transition-group(site-nav) { animation-duration: 220ms; }
}

.activity-dot {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, #FF1493, var(--b-base));
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.6), 0 0 20px rgba(42, 101, 229, 0.4);
    animation: dot-pulse 2.5s infinite ease-in-out;
}

@keyframes dot-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

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

html {
    scroll-behavior: auto;
    background-color: var(--black);
    color-scheme: dark;
    -webkit-tap-highlight-color: transparent;
}
@media (pointer: fine) {
    html { overscroll-behavior: none; }
}

/* Visible focus everywhere (replaces any outline:none) */
:focus-visible {
    outline: var(--focus-ring) !important;
    outline-offset: 3px;
}

body {
    background-color: transparent;
    color: var(--white);
    font-family: var(--font-body);
    overflow-x: hidden;
    overflow-x: clip;
    line-height: 1.5;
}

main:focus { outline: none; }
/* `hidden` always wins over component display rules (until-found keeps its own behaviour). */
[hidden]:not([hidden="until-found"]) { display: none !important; }
[id] { scroll-margin-top: 96px; }

canvas#neuron-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* --- TYPE --- */
.title-lg {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.75rem, 7vw, 4.75rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
h1, h2 { text-wrap: balance; }

/* --- REVEAL ---
   Content is visible by default. The hidden start state only applies once the inline
   <head> snippet has added .js-reveal to <html> (it skips that under reduced motion and
   removes it again if hub.js never starts), so text never stays at opacity 0 without JS.
   Browsers with scroll-driven animations get a CSS view() timeline; others use the single
   IntersectionObserver in js/hub.js. */
.reveal { transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.js-reveal .reveal { opacity: 0; transform: translateY(15px); }
.js-reveal .reveal.active { opacity: 1; transform: translateY(0); }

p.reveal, h1.reveal, h2.reveal, h3.reveal, label.reveal, .team-item.reveal { transition-delay: 0.1s; }

@keyframes reveal-in {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        /* fill: backwards - once past the entry range the element falls back to its .active
           state, so it never re-hides on scroll-up and hover transforms keep working. */
        .js-reveal .reveal:not(.hero .reveal) {
            transition: none;
            animation-name: reveal-in;
            animation-timing-function: linear;
            animation-fill-mode: backwards;
            animation-timeline: view();
            animation-range: entry 0% entry 65%;
        }
        /* On screen when the page opened (js/hub.js): shown in full at once, never dimmed waiting for a scroll */
        .js-reveal .reveal.reveal-now:not(.hero .reveal) { animation: none; }
    }
}

.hero-word { display: inline-block; }
.hero-word--accent { color: var(--p-base); }

/* Hero headline entrance: the page's one load moment (CSS only, no GSAP needed). */
@keyframes hero-word-in {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
    .js-reveal .hero-word {
        animation: hero-word-in 1s var(--ease-out) both;
        animation-delay: calc(0.2s + var(--i, 0) * 0.15s);
    }
    .hero-word:nth-of-type(2) { --i: 1; }
    .hero-word:nth-of-type(3) { --i: 2; }
    .hero-word:nth-of-type(4) { --i: 3; }
    .hero-word:nth-of-type(5) { --i: 4; }
}

/* --- TYPEWRITER --- */
.typing-text::after { content: '|'; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- CORE LAYOUT --- */
section, header { position: relative; padding: 6rem 10%; }
.hero { min-height: 80svh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-top: 140px; }

/* --- NAVIGATION --- */
nav#navbar, nav.site-nav {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    max-width: calc(100vw - 2rem);
    height: 60px;
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    padding: 0 1.5rem 0 2rem;
    display: flex;
    align-items: center;
    gap: 2.5rem;
    z-index: 5000;
    view-transition-name: site-nav;
}

.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--font-display); font-weight: 800; border-radius: var(--radius-sm); }
.nav-brand img { height: 26px; width: auto; }
.nav-brand span {
    background: linear-gradient(135deg, var(--p-base), var(--b-base));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a:not(.btn) {
    position: relative;
    text-decoration: none;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    border-radius: 4px;
    padding: 6px 0;
    transition: color var(--dur-fast) var(--ease-out);
}
/* Current page: full white plus a short brand bar under the label. */
.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--p-base), var(--b-base));
    transform: scaleX(0);
    transition: transform var(--dur-med) var(--ease-out);
}
.nav-links a:not(.btn):hover,
.nav-links a.active,
.nav-links a[aria-current="page"] { color: var(--white); }
.nav-links a:not(.btn):hover::after { transform: scaleX(0.5); }
.nav-links a.active::after,
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-links .nav-login-btn { margin-left: 0.5rem; font-size: 0.75rem; letter-spacing: 0.06em; min-height: 32px; }

.mobile-toggle {
    display: none;
    width: 44px;
    height: 44px;
    margin-right: -0.5rem;
    background: none;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: clamp(1rem, 3.5vh, 2rem);
    z-index: 1000000; /* above the cookie banner: the menu is modal */
    overscroll-behavior: contain;
    overflow-y: auto;
    padding: 2rem 1rem;
}
.mobile-overlay.active { display: flex; animation: overlay-in var(--dur-med) var(--ease-out); }
.overlay-link {
    position: relative;
    text-decoration: none;
    color: var(--text);
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    font-family: var(--font-display);
    font-weight: 800;
    border-radius: var(--radius-sm);
    padding: 0 0.5rem;
    transition: color var(--dur-fast) var(--ease-out);
}
.overlay-link:hover, .overlay-link:focus-visible, .overlay-link[aria-current="page"] { color: var(--white); }
.overlay-link[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 0.18em;
    text-decoration-color: var(--p-base);
}
/* Sign In / Account Dashboard: light violet-to-blue gradient text, >= 9:1 on the black overlay. */
.overlay-link.overlay-login {
    color: var(--accent-text);
    background: linear-gradient(135deg, var(--accent-text), var(--accent-text-2));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.mobile-overlay.active .overlay-link { animation: overlay-link-in 0.45s var(--ease-out) backwards; }
.mobile-overlay.active .overlay-link:nth-child(2) { animation-delay: 30ms; }
.mobile-overlay.active .overlay-link:nth-child(3) { animation-delay: 60ms; }
.mobile-overlay.active .overlay-link:nth-child(4) { animation-delay: 90ms; }
.mobile-overlay.active .overlay-link:nth-child(5) { animation-delay: 120ms; }
.mobile-overlay.active .overlay-link:nth-child(6) { animation-delay: 150ms; }
.mobile-overlay.active .overlay-link:nth-child(7) { animation-delay: 180ms; }
.menu-close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-top: 1rem;
    padding: 0;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--white);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.menu-close:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.32); }
.menu-close:active { transform: scale(0.96); }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlay-link-in { from { opacity: 0; transform: translateY(16px); } }

/* --- CAROUSEL ---
   Natively scrollable by default; index.js adds .is-pinned when GSAP drives it. */
.carousel-view {
    display: flex;
    gap: 2rem;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    padding: 2rem 10vw;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 10vw;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.carousel-view::-webkit-scrollbar { display: none; }
.carousel-view.is-pinned { width: max-content; overflow: visible; scroll-snap-type: none; }

.carousel-slide {
    min-width: clamp(280px, 80vw, 350px);
    width: clamp(280px, 80vw, 350px);
    background: var(--dark);
    border: 1px solid var(--glass-border);
    padding: 3.5rem 2.5rem;
    border-radius: 45px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), opacity var(--transition);
}
.carousel-slide:hover { border-color: var(--p-base); }
.carousel-slide h3 { font-family: var(--font-display); font-size: 1.35rem; margin-bottom: 0.75rem; }

.carousel-indicators { display: flex; justify-content: center; gap: 10px; margin-top: 3rem; }
.dot { width: 8px; height: 8px; background: rgba(255,255,255,0.1); border-radius: 50%; }
.dot.active { width: 24px; background: var(--p-base); border-radius: 10px; }

/* --- ELECTRIC FLOW / ROADMAP --- */
.timeline-container { position: relative; max-width: 1100px; margin: 4rem auto; view-timeline-name: --roadmap; }
.circuit-path { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: rgba(199, 0, 255, 0.1); transform: translateX(-50%); }
.circuit-path::after {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100px;
    background: linear-gradient(to bottom, transparent, var(--p-base), var(--b-base), transparent);
    filter: blur(2px); animation: electric-flow 4s infinite linear;
}
@keyframes electric-flow {
    0% { transform: translateY(-100px); opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(1000px); opacity: 0; }
}

/* Roadmap progress line: drawn by scroll where supported, otherwise shown in full. */
@keyframes draw-line { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .wave-line {
            stroke-dasharray: 1;
            animation-name: draw-line;
            animation-timing-function: linear;
            animation-fill-mode: both;
            animation-timeline: --roadmap;
            animation-range: entry 20% exit 35%;
        }
    }
}

.timeline-row { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 5rem; position: relative; }
.timeline-row:nth-child(even) { flex-direction: row-reverse; }

.timeline-node { position: absolute; left: 50%; transform: translateX(-50%); width: 16px; height: 16px; background: var(--dark); border: 2px solid var(--p-base); border-radius: 50%; box-shadow: 0 0 15px var(--p-base); z-index: 10; }
.timeline-node.active { background: var(--p-base); box-shadow: 0 0 25px var(--p-base); }
.timeline-node.in-progress { background: var(--b-base); border-color: var(--b-base); box-shadow: 0 0 15px var(--b-base); }

.timeline-card { display: grid; width: 45%; min-height: 260px; background: var(--dark); border: 1px solid var(--glass-border); border-radius: 40px; perspective: 1000px; cursor: pointer; transition: transform var(--dur-med) var(--ease-out); }
.timeline-card:hover { transform: scale(1.02); border-color: var(--p-base); }
.timeline-card:focus-visible { border-color: var(--p-base); }

/* Flip card: both faces share one grid cell, so the card is as tall as its taller face and the
   faces never overflow onto each other. backface-visibility hides the far face; the visibility
   swap half-way through the turn is the fallback for engines that flatten the 3D context
   (older iOS Safari) and also hides the far face from screen readers. */
.flip-inner { display: grid; position: relative; width: 100%; transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.timeline-card.flipped .flip-inner { transform: rotateY(180deg); }
.flip-front, .flip-back {
    grid-area: 1 / 1;
    min-width: 0;
    padding: 3rem;
    border-radius: 40px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: visibility 0s linear 0.3s;
}
.flip-front { transform: rotateY(0deg); }
.flip-back { transform: rotateY(180deg); background: #080808; border: 1px solid var(--p-base); visibility: hidden; }
.timeline-card.flipped .flip-back { visibility: visible; }
.timeline-card.flipped .flip-front { visibility: hidden; }
.flip-front h3, .flip-back h3 { font-family: var(--font-display); font-size: 1.35rem; }
.flip-hint { margin-top: auto; padding-top: 1rem; font-size: 0.72rem; color: var(--text-muted); }
.flip-hint i { margin-right: 0.35rem; }

/* --- TEAM GRID & EDITORIAL --- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 2rem; margin-top: 4rem; perspective: 1000px; }
.team-item {
    background: var(--dark);
    border: 1px solid var(--glass-border);
    padding: 3.5rem 2.5rem;
    border-radius: 50px;
    transition: transform var(--dur-med) cubic-bezier(0.23, 1, 0.32, 1), opacity var(--dur-med) cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}
.team-item h3 { font-family: var(--font-display); font-size: 1.35rem; }

/* 3D Hover Spotlight Glow */
@media (hover: hover) and (pointer: fine) {
    .team-item::after {
        content: "";
        position: absolute;
        inset: -1px;
        background: radial-gradient(500px circle at var(--mouse-x, 0) var(--mouse-y, 0), rgba(199, 0, 255, 0.2), transparent 40%);
        opacity: 0;
        transition: opacity 0.5s;
        z-index: 10;
        pointer-events: none;
        border-radius: inherit;
        mix-blend-mode: color-dodge;
    }
    .team-item:hover::after { opacity: 1; }
}

/* Constant Ethereal Glow */
.note-glow::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(199, 0, 255, 0.05) 0%, transparent 60%);
    animation: pulse-glow 4s infinite ease-in-out;
    pointer-events: none;
    z-index: 0;
}
@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.6; }
}

.team-item:hover { border-color: var(--p-base); }

/* --- AURORA ORBS --- */
.aurora-orb {
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    z-index: -3;
    pointer-events: none;
}
/* The top orb is anchored to the top of the page and offset by its own size (translate), not by a
   percentage of the page height: late layout (fonts, the pinned carousel's spacer) used to move it
   and register as layout shift. Parallax (index.js) adds a transform on top. */
.aurora-pink { background: var(--p-base); top: 0; left: -20%; translate: 0 -60%; }
.aurora-blue { background: var(--b-base); top: 50%; right: -20%; }

/* --- FOOTER --- */
footer { padding: 6rem 10% 4rem 10%; border-top: 1px solid var(--glass-border); background: #080808; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 4rem; text-align: left; }
.footer-col h2, .footer-col h3, .footer-col h4 { font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 2px; color: var(--p-base); margin-bottom: 1.5rem; text-transform: uppercase; }
.footer-col p { color: var(--text-muted); }

.label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--p-base);
    letter-spacing: 3px;
    margin-bottom: 1rem;
}
.footer-col a { display: block; width: fit-content; text-decoration: none; color: var(--light); opacity: 0.7; font-size: 0.8rem; margin-bottom: 0.8rem; border-radius: 4px; transition: opacity var(--dur-med) var(--ease-out); }
.footer-col a:hover { opacity: 1; color: #fff; }
.footer-logo { height: 28px; width: auto; margin-bottom: 1.5rem; }

@media (max-width: 1024px) {
    nav#navbar, nav.site-nav { width: calc(100vw - 2rem); justify-content: space-between; padding: 0 1.25rem 0 1.5rem; }
    .nav-links { display: none; }
    .mobile-toggle { display: inline-flex; align-items: center; justify-content: center; }

    footer { padding: 4rem 10%; }
    .footer-grid { grid-template-columns: 1fr; gap: 3.5rem; text-align: center; }
    .footer-col { align-items: center; display: flex; flex-direction: column; }
    .footer-col h2, .footer-col h3, .footer-col h4 { margin-bottom: 1rem; }
    .footer-col p { max-width: 300px; }

    .timeline-row { flex-direction: column !important; align-items: flex-start; padding-left: 30px; }
    .circuit-path, .circuit-svg { left: 0 !important; transform: translateX(-50%) !important; width: 50px !important; }
    .timeline-node { left: 0; transform: translateX(-50%); }
    .timeline-card { width: 100%; min-height: 240px; }
    .carousel-slide { min-width: 280px; padding: 2.5rem 2rem; }
}

@media (max-width: 600px) {
    section, header { padding-left: 1.25rem; padding-right: 1.25rem; }
    .flip-front, .flip-back { padding: 2rem 1.75rem; }
}

/* --- NATIVE SELECTS: dark, readable (Windows dark mode needs explicit colours) --- */
:where(select) {
    color-scheme: dark;
    background-color: var(--surface-field);
    color: var(--text);
}
:where(select) option,
:where(select) optgroup {
    background-color: var(--surface-field);
    color: var(--text);
}

/* Reduced motion: stop decorative loops and entrance animations (content stays visible). */
@media (prefers-reduced-motion: reduce) {
    .activity-dot,
    .typing-text::after,
    .circuit-path::after,
    .note-glow::before,
    .mobile-overlay.active,
    .mobile-overlay.active .overlay-link { animation: none; }
    .reveal, .carousel-slide, .timeline-card, .team-item, .flip-inner, .flip-front, .flip-back { transition: none; }
    .timeline-card:hover { transform: none; }
    .nav-links a:not(.btn)::after { transition: none; }
    .menu-close:active { transform: none; }
}
