/* ======================================================
   PAGE — struttura delle pagine interne (design, photography)
   ------------------------------------------------------
   1. Sfondo particelle
   2. Hero
   3. Fine pagina (forma delle particelle + pagina successiva)
   4. Cornice HUD per le immagini (angoli + fascio di scansione)
   ====================================================== */


/* ======================================================
   1. SFONDO PARTICELLE
   ====================================================== */
#global-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

main,
.main-footer {
    position: relative;
    z-index: 1;
}

/* Emblema in alto a sinistra, al posto del nome: la forma di fine pagina
   in piccolo (particles.js). I margini negativi non alzano la navbar,
   così le voci al centro restano alla stessa altezza della homepage */
.brand-emblem {
    position: relative;
    display: block;
    width: 56px;
    height: 56px;
    margin: -20px 0 -20px -6px;
}

.brand-emblem__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* il nome resta leggibile solo dagli screen reader */
.brand-emblem__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* senza WebGL torna il nome scritto */
.brand-emblem.is-fallback {
    width: auto;
    height: auto;
    margin: 0;
}

.brand-emblem.is-fallback .brand-emblem__canvas {
    display: none;
}

.brand-emblem.is-fallback .brand-emblem__name {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    font-weight: 500;
}


/* ======================================================
   2. HERO
   ====================================================== */
.page-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 100vh;
    padding: 8rem var(--side-safe) 7rem;
    overflow: hidden;
}

/* video di sfondo facoltativo: compare solo se il file esiste e si carica */
.page-hero__video {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
}

.page-hero.has-video .page-hero__video {
    opacity: 1;
}

.page-hero__video video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

.page-hero__video::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.25) 0 1px, transparent 1px 3px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.8));
}

.page-hero__content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 92rem;
    margin: 0 auto;
}

.page-hero__label {
    display: inline-block;
    margin-bottom: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
}

.page-hero__title {
    font-family: var(--font-helvetica);
    font-size: clamp(3rem, 7.5vw, 7.5rem);
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.page-hero__line {
    display: block;
}

.page-hero__intro {
    max-width: 44rem;
    margin-top: 3rem;
    font-family: var(--font-helvetica);
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
}

/* invito a scorrere: barra HUD in basso, allineata al contenuto
   ■ SCROLL ↓  ———●—————————————————  S01 / 05 */
.page-hero__scroll {
    position: absolute;
    left: var(--side-safe);
    right: var(--side-safe);
    bottom: 2.5rem;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 92rem;
    margin: 0 auto;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.5);
}

.page-hero__scroll-label {
    display: flex;
    align-items: center;
    gap: 0.8em;
    color: #fff;
}

.page-hero__scroll-label::before {
    content: "";
    width: 7px;
    height: 7px;
    background: var(--accent);
    animation: hud-blink 1.2s steps(1) infinite;
}

.page-hero__scroll-arrow {
    display: inline-block;
    color: var(--accent);
    animation: page-scroll-bob 1.6s ease-in-out infinite;
}

@keyframes page-scroll-bob {
    0%, 100% { transform: translateY(-2px); }
    50%      { transform: translateY(3px); }
}

/* linea con un impulso rosso che la percorre */
.page-hero__scroll-track {
    position: relative;
    flex: 1;
    height: 1px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
}

.page-hero__scroll-track i {
    position: absolute;
    top: 0;
    left: 0;
    width: 18%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent));
    animation: page-scroll-run 2.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

@keyframes page-scroll-run {
    from { transform: translateX(-100%); }
    to   { transform: translateX(560%); }
}

.page-hero__scroll-count {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .page-hero__scroll {
        gap: 1rem;
        bottom: 1.5rem;
    }

    .page-hero__scroll-count {
        display: none;
    }
}


/* ======================================================
   3. FINE PAGINA
   Le particelle si raccolgono nella forma al centro dello schermo;
   sopra l'etichetta, sotto il link alla pagina successiva
   ====================================================== */
.page-end {
    position: relative;
    height: 100vh;
    min-height: 560px;
}

.page-end__label {
    position: absolute;
    top: 14%;
    left: 50%;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.55);
    transform: translateX(-50%);
}

.page-end__link {
    position: absolute;
    bottom: 12%;
    left: 50%;
    display: flex;
    align-items: baseline;
    gap: 0.35em;
    font-family: var(--font-helvetica);
    font-size: clamp(2.5rem, 7vw, 6.5rem);
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: #fff;
    text-decoration: none;
    transform: translateX(-50%);
    transition: color 0.3s ease;
}

.page-end__kicker {
    align-self: center;
    margin-right: 0.8em;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
}

.page-end__link:hover {
    color: var(--accent);
}

.page-end__arrow {
    display: inline-block;
    transition: transform 0.6s var(--ease-out);
}

.page-end__link:hover .page-end__arrow {
    transform: translateX(0.2em);
}


/* ======================================================
   4. CORNICE HUD PER LE IMMAGINI
   <span class="frame-corners"><i></i><i></i><i></i><i></i></span>
   <span class="frame-scan"></span>  dentro un elemento con overflow: hidden
   ====================================================== */
/* il contenitore copre l'elemento: non occupa spazio nel layout (griglie comprese) */
.frame-corners {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.frame-corners i {
    position: absolute;
    z-index: 2;
    width: 14px;
    height: 14px;
    border: 0 solid var(--accent);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.5s var(--ease-out), opacity 0.2s ease;
}

.frame-corners i:nth-child(1) { top: 10px;    left: 10px;  border-top-width: 1px;    border-left-width: 1px;  transform: translate(10px, 10px); }
.frame-corners i:nth-child(2) { top: 10px;    right: 10px; border-top-width: 1px;    border-right-width: 1px; transform: translate(-10px, 10px); }
.frame-corners i:nth-child(3) { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; transform: translate(-10px, -10px); }
.frame-corners i:nth-child(4) { bottom: 10px; left: 10px;  border-bottom-width: 1px; border-left-width: 1px;  transform: translate(10px, -10px); }

:hover > .frame-corners i,
:focus-visible > .frame-corners i {
    opacity: 1;
    transform: none;
}

.frame-scan {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px 2px rgba(255, 77, 50, 0.7);
    opacity: 0;
    pointer-events: none;
}

:hover > .frame-scan {
    animation: frame-scan 0.9s var(--ease-out) forwards;
}

@keyframes frame-scan {
    0%   { top: 0;    opacity: 1; }
    85%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}


/* ======================================================
   MOVIMENTO RIDOTTO
   ====================================================== */
@media (prefers-reduced-motion: reduce) {
    .page-hero__scroll-label::before,
    .page-hero__scroll-arrow,
    .page-hero__scroll-track i,
    :hover > .frame-scan {
        animation: none;
    }
}
