/* Pyragogy — Enter / immersive redirect
   "The Threshold". Stili custom, zero framework.
   Design tokens nelle :root variables · motore in app.js */

:root {
    --obsidian: #050505;
    --ai: 70, 210, 255;        /* freddo — intelligenza artificiale */
    --human: 255, 176, 120;    /* caldo — intelligenza umana */
    --ghost: 230, 235, 248;
    --reveal-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--obsidian);
    /* il caldo a sinistra, il freddo a destra: la tesi, in sottofondo.
       Serve anche da fallback no-JS. */
    background-image:
        radial-gradient(120% 95% at 8% 18%, rgba(var(--human), 0.10), transparent 52%),
        radial-gradient(120% 95% at 92% 86%, rgba(var(--ai), 0.13), transparent 50%),
        radial-gradient(100% 100% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
    color: rgba(var(--ghost), 1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Canvas rete: nitido a ogni risoluzione via devicePixelRatio (in app.js) */
#neuralCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
}

/* Grana filmica — toglie il "flat digitale", aggiunge profondità */
.grain {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.045;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Chrome editoriale agli angoli ---------- */
.frame {
    position: fixed;
    z-index: 10;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(var(--ghost), 0.55);
}
.frame.top {
    top: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px clamp(20px, 4vw, 48px);
}
.brand-logo {
    height: clamp(26px, 5.5vw, 38px);
    width: auto;
    display: block;
    opacity: 0.92;
    transition: opacity 0.3s ease;
}
.brand-logo:hover { opacity: 1; }
.frame .status { display: inline-flex; align-items: center; gap: 9px; }
.live-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgb(var(--ai));
    box-shadow: 0 0 10px rgba(var(--ai), 0.9);
    animation: livePulse 2.4s ease-in-out infinite;
}
.frame.bottom-left  { bottom: 0; left: 0;  padding: 20px clamp(20px, 4vw, 48px); }
.frame.bottom-right { bottom: 0; right: 0; padding: 20px clamp(20px, 4vw, 48px); text-align: right; }
.frame.bottom-left a,
.frame.bottom-right a { color: rgba(var(--ghost), 0.6); text-decoration: none; transition: color 0.3s ease; }
.frame.bottom-left a:hover,
.frame.bottom-right a:hover { color: rgb(var(--ai)); }

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.8); }
}

/* ---------- Palco centrale ---------- */
#stage {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: clamp(1.75rem, 4vw, 2.25rem);
    padding: 0 1.5rem;
    width: 100%;
    max-width: 48rem;
    will-change: transform;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Marchio: cornice sottile, niente glass pesante */
.logo-frame {
    width: clamp(64px, 8vw, 96px);
    height: clamp(64px, 8vw, 96px);
    border-radius: 18px;
    border: 1px solid rgba(var(--ai), 0.28);
    background: rgba(255, 255, 255, 0.015);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.02), 0 18px 60px -20px rgba(var(--ai), 0.45);
    transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.5s ease;
}
.logo-frame:hover {
    border-color: rgba(var(--ai), 0.6);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 22px 70px -18px rgba(var(--ai), 0.7);
    transform: translateY(-2px);
}
.logo-frame img { width: 100%; height: 100%; object-fit: contain; opacity: 0.92; }

/* Eyebrow mono — la tesi, dichiarata (può andare a capo su mobile) */
.eyebrow {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1.1vw, 13px);
    letter-spacing: 0.30em;
    line-height: 1.7;
    text-transform: uppercase;
    color: rgba(var(--ghost), 0.68);
    max-width: 92vw;
    margin: 0 auto;
}
.eyebrow .x { color: rgb(var(--ai)); font-weight: 600; margin: 0 0.15em; }
.eyebrow .h { color: rgb(var(--human)); }

/* Hero: Fraunces (serif organico = voce umana) contro il mono macchina */
.hero {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 380;
    font-size: clamp(34px, 6.4vw, 78px);
    line-height: 1.02;
    letter-spacing: -0.018em;
    color: rgba(var(--ghost), 0.97);
    max-width: 16ch;
    margin: 0 auto;
    text-wrap: balance;
}
.hero .warm {
    font-style: italic;
    color: rgb(var(--human));
    text-shadow: 0 0 32px rgba(var(--human), 0.35);
}
.hero .cool {
    font-style: italic;
    color: rgb(var(--ai));
    text-shadow: 0 0 32px rgba(var(--ai), 0.35);
}

/* ---------- La Soglia (Enter) ---------- */
.threshold {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 18px;
    padding: clamp(16px, 2vw, 22px) clamp(34px, 4vw, 52px);
    border: 1px solid rgba(var(--ghost), 0.22);
    border-radius: 2px;                       /* spigolo "tooled", non candy */
    background: rgba(255, 255, 255, 0.012);   /* trasparente: la rete traspare */
    color: rgba(var(--ghost), 0.95);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(15px, 1.6vw, 19px);
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    overflow: hidden;
    text-decoration: none;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: border-color 0.5s var(--reveal-ease),
                color 0.4s ease,
                box-shadow 0.6s ease,
                transform 0.5s var(--reveal-ease);
}
/* sweep di luce che attraversa la soglia all'hover */
.threshold::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(var(--ai), 0.18) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.7s var(--reveal-ease);
}
.threshold:hover,
.threshold:focus-visible {
    border-color: rgba(var(--ai), 0.75);
    box-shadow: 0 0 0 1px rgba(var(--ai), 0.25),
                0 18px 60px -24px rgba(var(--ai), 0.8),
                inset 0 0 30px -8px rgba(var(--ai), 0.25);
    transform: translateY(-2px);
    outline: none;
}
.threshold:hover::before,
.threshold:focus-visible::before { transform: translateX(120%); }
.threshold:focus-visible { box-shadow: 0 0 0 2px rgba(var(--ghost), 0.55), 0 0 0 5px rgba(var(--ai), 0.35); }
.threshold:active { transform: translateY(0) scale(0.985); }

/* ---------- Nav nodi ---------- */
.nodes {
    display: flex; align-items: center; justify-content: center;
    gap: clamp(20px, 4vw, 56px);
    padding-top: clamp(22px, 3vw, 36px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.node-item {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
    color: rgba(var(--ghost), 0.55);
    transition: color 0.3s ease;
}
.node-item .node-dot {
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(var(--ghost), 0.32);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

/* etichetta con swap: nome in-flow (definisce il box), "SOON" in overlay */
.node-swap { position: relative; display: inline-block; text-align: center; }
.node-swap .lbl { display: block; transition: opacity 0.36s ease, transform 0.36s var(--reveal-ease); }
.node-swap .lbl.soon {
    position: absolute; left: 50%; top: 0;
    transform: translate(-50%, 4px);
    opacity: 0; white-space: nowrap;
    color: rgb(var(--human));
}

/* --- LIVE: cliccabile, pallino bicolore decorativo, hover che accende --- */
.node-item[data-status="live"] { cursor: pointer; }
.node-item[data-status="live"]:nth-child(odd)  .node-dot { background: rgba(var(--human), 0.5); }
.node-item[data-status="live"]:nth-child(even) .node-dot { background: rgba(var(--ai), 0.5); }
.node-item[data-status="live"]:hover { color: rgba(var(--ghost), 0.95); }
.node-item[data-status="live"]:hover .node-dot { transform: scale(1.6); box-shadow: 0 0 12px currentColor; }

/* --- SOON: non cliccabile; hover rivela "SOON" + pallino ambra pulsante --- */
.node-item[data-status="soon"] { cursor: default; }
.node-item[data-status="soon"] .node-dot { background: transparent; border-color: rgba(var(--human), 0.45); }
.node-item[data-status="soon"]:hover .node-swap .lbl.name { opacity: 0; transform: translateY(-4px); }
.node-item[data-status="soon"]:hover .node-swap .lbl.soon { opacity: 1; transform: translate(-50%, 0); }
.node-item[data-status="soon"]:hover .node-dot {
    background: rgb(var(--human));
    border-color: rgb(var(--human));
    box-shadow: 0 0 12px rgba(var(--human), 0.9);
    animation: livePulse 1.4s ease-in-out infinite;
}

/* --- Nodo GitHub: icona sola, monocroma, hover che accende --- */
.node-github { color: rgba(var(--ghost), 0.55); }
.node-github .gh {
    display: block;
    transition: transform 0.35s var(--reveal-ease), color 0.3s ease, filter 0.3s ease;
}
.node-github:hover { color: rgba(var(--ghost), 0.98); }
.node-github:hover .gh {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 0 10px rgba(var(--ghost), 0.55));
}

/* --- Nodo Obliqo: wordmark (ambra), hover che accende --- */
.node-wordmark .obliqo-mark {
    display: block;
    height: 15px;
    width: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.35s var(--reveal-ease), filter 0.3s ease;
}
.node-wordmark:hover .obliqo-mark {
    opacity: 1;
    transform: translateY(-2px);
    filter: drop-shadow(0 0 10px rgba(var(--human), 0.5));
}

/* ---------- Reveal orchestrato al load ---------- */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    animation: reveal 1s var(--reveal-ease) forwards;
}
@keyframes reveal {
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Reduced motion: tutto fermo, niente coreografie ---------- */
@media (prefers-reduced-motion: reduce) {
    .reveal { animation: none; opacity: 1; transform: none; }
    .live-dot { animation: none; }
    .threshold::before { display: none; }
    #stage { transition: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .frame.bottom-left,
    .frame.bottom-right { display: none; }
    .frame.top { padding: 18px 20px; }

    /* più presenza, meno vuoto: elementi focali più grandi + gap che riempie */
    #stage { gap: clamp(1.7rem, 5.5vw, 2.4rem); padding: 0 1.4rem; }

    .logo-frame { width: 82px; height: 82px; }
    .eyebrow { letter-spacing: 0.18em; font-size: 12px; }
    .hero { font-size: clamp(38px, 10.5vw, 56px); max-width: 13ch; line-height: 1.06; }
    .threshold { font-size: 17px; padding: 17px 40px; }

    /* nav 5 nodi: wrap morbido se non sta in una riga */
    .nodes { flex-wrap: wrap; gap: 20px 26px; padding-top: 30px; }
}

/* schermi molto stretti (≤380px) */
@media (max-width: 380px) {
    .hero { max-width: 12ch; }
    .nodes { gap: 18px 20px; }
    .frame .status { font-size: 10px; }
}
