:root {
    /* Fonts */
    --font-main: 'Ramabhadra', sans-serif;
    --font-secondary: 'Inter', system-ui, -apple-system, sans-serif;

    /* Colors */
    --color-primary: #9F0909;
    --color-primary-dark: #7d0606;
    --color-background: #E5E8E8;
    --color-background-card: #F7E7CE;
    --color-text: #1A1A1A;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);

    /* Scala della forma, calcolata da js/home.js */
    --s: 1;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    font-family: var(--font-main);
    color: var(--color-text);
    background:
        radial-gradient(circle at 50% 38%, rgba(159, 9, 9, 0.12), transparent 34%),
        radial-gradient(circle at 18% 70%, rgba(159, 9, 9, 0.06), transparent 24%),
        radial-gradient(circle at 82% 40%, rgba(0, 0, 0, 0.045), transparent 26%),
        linear-gradient(180deg, #faf8f5 0%, #f1eee9 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(159, 9, 9, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(159, 9, 9, 0.045) 1px, transparent 1px);
    background-size: 54px 54px;
    -webkit-mask-image: radial-gradient(circle at center, black 0%, transparent 75%);
    mask-image: radial-gradient(circle at center, black 0%, transparent 75%);
    pointer-events: none;
    z-index: 0;
}

.visible { display: block; }
.hidden { display: none; }

/* ===================== */
/* INTRO                 */
/* ===================== */

.intro-curtain {
    display: none;
}

.js .intro-curtain {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 50% 45%, #b30f0f 0%, var(--color-primary) 55%, var(--color-primary-dark) 100%);
}

.js.intro-skip .intro-curtain {
    display: none;
}

.intro-mark {
    display: flex;
    font-family: var(--font-main);
    font-size: clamp(64px, 12vw, 120px);
    line-height: 1;
    animation: introBreath 1.6s var(--ease-in-out) infinite alternate;
}

.intro-mark .filled { color: #fff; }

.intro-mark .not_filled {
    color: transparent;
    -webkit-text-stroke: 2.5px #fff;
}

@keyframes introBreath {
    from { transform: scale(0.94); opacity: 0.85; }
    to   { transform: scale(1.04); opacity: 1; }
}

/* ===================== */
/* HEADER                */
/* ===================== */

.me {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    width: 100%;
    padding: clamp(22px, 4.5vh, 44px) 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.name {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    font-weight: 400;
    font-size: clamp(44px, 7.2vw, 84px);
    line-height: 1;
}

.name .word {
    display: inline-flex;
    overflow: hidden;
    padding: 0.08em 0.02em 0;
}

.name .not_filled {
    -webkit-text-stroke-width: clamp(1.5px, 0.036em, 3px);
}

.name .ch {
    display: inline-block;
}

.role {
    margin: 0.5em 0 0;
    font-size: clamp(12px, 1.5vw, 20px);
    color: var(--color-primary);
    letter-spacing: clamp(8px, 1.9vw, 26.5px);
    padding-left: clamp(8px, 1.9vw, 26.5px);
}

.tagline {
    margin: 16px auto 0;
    max-width: 560px;
    font-family: var(--font-secondary);
    font-size: clamp(15px, 1.25vw, 17px);
    line-height: 1.5;
    color: #4a4543;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

/* ===================== */
/* BOTTONI               */
/* ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: var(--font-secondary);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.35s var(--ease-spring), box-shadow 0.3s ease, background 0.2s ease;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-primary {
    background: linear-gradient(135deg, #b10f0f 0%, var(--color-primary) 55%, #7b0606 100%);
    color: #fff;
    box-shadow: 0 12px 26px rgba(159, 9, 9, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(159, 9, 9, 0.2);
    color: var(--color-primary);
}

@media (hover: hover) {
    .btn:hover { transform: translateY(-2px); }
    .btn-primary:hover { box-shadow: 0 16px 32px rgba(159, 9, 9, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.26); }
    .btn-ghost:hover { background: #fff; box-shadow: 0 10px 24px rgba(60, 20, 20, 0.1); }
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
    outline: 3px solid rgba(159, 9, 9, 0.45);
    outline-offset: 3px;
}

.status-chip {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 28px rgba(60, 48, 48, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    font-family: var(--font-secondary);
    font-size: 13px;
    font-weight: 500;
    color: #3d3b40;
}

.status-dot {
    position: relative;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
}

.status-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--color-primary);
    animation: ping 2.2s var(--ease-out) infinite;
}

@keyframes ping {
    0%   { transform: scale(1); opacity: 0.55; }
    80%, 100% { transform: scale(3.2); opacity: 0; }
}

/* ===================== */
/* STAGE (forma + cerchi) */
/* ===================== */

.stage-wrap {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
}

.stage {
    --bw: 810px;
    --bh: 530px;
    position: relative;
    width: calc(var(--bw) * var(--s));
    height: calc(var(--bh) * var(--s));
}

.menu_container {
    position: absolute;
    left: 0;
    top: 0;
    width: 900px;
    height: 600px;
    transform-origin: 0 0;
    transform: translate(calc(-45px * var(--s)), calc(-30px * var(--s))) scale(var(--s));
}

.menu_background {
    position: absolute;
    top: 5px;
    left: 0;
    width: 900px;
    height: 600px;
    pointer-events: none;
    user-select: none;
}

.menu_item {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
}

.item_upright {
    position: absolute;
    inset: 0;
}

.my_work  { left: 150px; top: 50px; }
.dev_life { left: 50px;  top: 300px; }
.whoami   { left: 350px; top: 200px; }
.my_notes { left: 550px; top: 350px; }
.chat     { left: 650px; top: 100px; }

.inner_circle {
    position: absolute;
    left: 12.5px;
    top: 12.5px;
    width: 175px;
    height: 175px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--color-primary);
    box-shadow: -8px -10px 13.8px 0 rgba(0, 0, 0, 0.25) inset, 16px 6px 11.3px 0 rgba(0, 0, 0, 0.25) inset;
    display: flex;
    justify-content: center;
    align-items: center;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(var(--hs, 1));
    transition: transform 0.55s var(--ease-out), box-shadow 0.4s ease;
}

/* anello luminoso nel bordo della forma */
.inner_circle::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 0.35s ease, transform 0.5s var(--ease-out);
    pointer-events: none;
}

.inner_circle:focus { outline: none; }

.inner_circle:focus-visible::after {
    opacity: 1;
    transform: scale(1);
}

/* LAYER BASE (immagine) */
.img_layer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.5s var(--ease-out);
}

.folder {
    width: 70%;
    height: 70%;
    border-radius: 0;
    object-fit: contain;
}

/* LAYER HOVER (testo) */
.hover_card_text {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    background-color: var(--color-background);
    box-shadow: 5px 6px 11.3px 0 rgba(0, 0, 0, 0.25) inset, 0 0 9.7px 4px rgba(0, 0, 0, 0.25) inset;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.3s ease, transform 0.5s var(--ease-spring);
    pointer-events: none;
}

.hover_card_text > span {
    display: block;
    transform: translateY(14px);
    opacity: 0;
    transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}

.hover_card_text > span:nth-child(2) { transition-delay: 0.06s; }

@media (hover: hover) {
    .inner_circle:hover { --hs: 1.05; }

    .inner_circle:hover::after {
        opacity: 1;
        transform: scale(1);
    }

    .inner_circle:hover .img_layer {
        opacity: 0;
        transform: scale(0.7) rotate(-8deg);
    }

    .inner_circle:hover .hover_card_text,
    .inner_circle:focus-visible .hover_card_text {
        opacity: 1;
        transform: scale(1);
    }

    .inner_circle:hover .hover_card_text > span,
    .inner_circle:focus-visible .hover_card_text > span {
        transform: none;
        opacity: 1;
    }
}

.inner_circle:active { --hs: 0.96; }

/* invito "parti da qui" sul cerchio centrale, finché non si apre una sezione */
.whoami .inner_circle::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    opacity: 0;
    pointer-events: none;
}

.is-ready:not(.has-explored) .whoami .inner_circle::before {
    animation: invite 2.6s var(--ease-out) 1s infinite;
}

@keyframes invite {
    0%   { opacity: 0.9; transform: scale(1); }
    70%, 100% { opacity: 0; transform: scale(1.22); }
}

/* TESTO */
.filled {
    color: var(--color-primary);
    line-height: 1;
}

.not_filled {
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 3px var(--color-primary);
}

.circle_label {
    display: none;
}

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

.hint {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 clamp(16px, 3vh, 28px);
    font-family: var(--font-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #5f5a57;
}

.hint-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
}

.hint-link {
    color: inherit;
    text-underline-offset: 3px;
}

.hint-link:hover { color: var(--color-primary); }

.hint-touch { display: none; }

@media (hover: none) {
    .hint-desktop { display: none; }
    .hint-touch { display: inline; }
}

/* ===================== */
/* CURSOR GLOW           */
/* ===================== */

.cursor-glow {
    position: fixed;
    left: 0;
    top: 0;
    width: 640px;
    height: 640px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(159, 9, 9, 0.09), transparent 62%);
    pointer-events: none;
    will-change: transform;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.cursor-glow.is-on { opacity: 1; }

/* ===================== */
/* STATI DI CARICAMENTO  */
/* ===================== */

.js .menu_background {
    clip-path: circle(0% at 50% 51%);
    transition: clip-path 1.2s var(--ease-out);
}

.js .inner_circle,
.js .circle_label {
    scale: 0;
    transition:
        scale 0.8s var(--ease-spring) calc(0.25s + var(--i, 0) * 0.14s),
        transform 0.55s var(--ease-out),
        box-shadow 0.4s ease;
}

.js .name .ch {
    transform: translateY(110%);
    transition: transform 0.9s var(--ease-out) calc(0.35s + var(--ci, 0) * 0.035s);
}

.js .role,
.js .tagline,
.js .hero-actions,
.js .hint,
.js .status-chip {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

.js .role { transition-delay: 0.75s; }
.js .tagline { transition-delay: 0.85s; }
.js .hero-actions { transition-delay: 0.95s; }
.js .status-chip { transition-delay: 1s; }
.js .hint { transition-delay: 1.2s; }

.js.is-revealed .menu_background { clip-path: circle(80% at 50% 51%); }
.js.is-ready .menu_background { clip-path: none; }

.js.is-revealed .inner_circle,
.js.is-revealed .circle_label { scale: 1; }

.js.is-revealed .name .ch { transform: none; }

.js.is-revealed .role,
.js.is-revealed .tagline,
.js.is-revealed .hero-actions,
.js.is-revealed .hint,
.js.is-revealed .status-chip {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }

    .cursor-glow { display: none; }
}
