/* ==========================================================================
   benchaib.it · sito personale di Youssef Benchaib
   Tema scuro di default, chiaro con il pulsante (o se il sistema lo chiede)
   ========================================================================== */

@font-face { font-family: "Geist"; src: url("fonts/geist.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/geist-mono.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
    --sfondo: #0b0c0e;
    --sfondo-2: #121418;
    --sfondo-3: #191c21;
    --linea: rgba(255, 255, 255, .09);
    --linea-forte: rgba(255, 255, 255, .18);
    --testo: #ececea;
    --tenue: #9ba0a8;
    --accento: #3dabdd;          /* l'azzurro del sito precedente */
    --accento-tenue: rgba(61, 171, 221, .14);
    --ombra: 0 30px 60px -30px rgba(0, 0, 0, .7);

    --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
    --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --larghezza: 1180px;
    --raggio: 18px;
    --curva: cubic-bezier(.2, .7, .2, 1);
    color-scheme: dark;
}

/* tema chiaro: scelto col pulsante, oppure dal sistema se non si è scelto nulla */
:root[data-tema="chiaro"] {
    --sfondo: #f5f4ef;
    --sfondo-2: #ecebe4;
    --sfondo-3: #e2e0d7;
    --linea: rgba(0, 0, 0, .1);
    --linea-forte: rgba(0, 0, 0, .2);
    --testo: #141414;
    --tenue: #5c5f64;
    --accento: #0b7db3;
    --accento-tenue: rgba(11, 125, 179, .1);
    --ombra: 0 30px 60px -34px rgba(0, 0, 0, .35);
    color-scheme: light;
}
@media (prefers-color-scheme: light) {
    :root:not([data-tema]) {
        --sfondo: #f5f4ef;
        --sfondo-2: #ecebe4;
        --sfondo-3: #e2e0d7;
        --linea: rgba(0, 0, 0, .1);
        --linea-forte: rgba(0, 0, 0, .2);
        --testo: #141414;
        --tenue: #5c5f64;
        --accento: #0b7db3;
        --accento-tenue: rgba(11, 125, 179, .1);
        --ombra: 0 30px 60px -34px rgba(0, 0, 0, .35);
        color-scheme: light;
    }
}

/* lingua: si vede solo il testo della lingua scelta */
[data-lang="en"] [lang="it"],
[data-lang="it"] [lang="en"] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--sfondo);
    color: var(--testo);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color .3s ease, color .3s ease;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--accento); color: #fff; }
:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; border-radius: 4px; }

.contenitore { width: 100%; max-width: var(--larghezza); margin: 0 auto; padding: 0 32px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.salta { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--accento); color: #fff; border-radius: 8px; font-weight: 600; }
.salta:focus { top: 12px; }

.etichetta, .sezione__num, .progetto__tipo, .ruolo__date, .tappa__date {
    font-family: var(--mono);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--tenue);
}

/* ---------------------------------------------------------------- barra */

.barra {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    transition: background-color .3s ease, box-shadow .3s ease;
}
.barra.solida {
    background: color-mix(in srgb, var(--sfondo) 82%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    backdrop-filter: blur(14px) saturate(1.4);
    box-shadow: 0 1px 0 var(--linea);
}
.barra__dentro { display: flex; align-items: center; gap: 28px; height: 72px; }

.monogramma {
    font-family: var(--serif);
    font-size: 28px;
    line-height: 1;
    letter-spacing: .02em;
    text-decoration: none;
}
.monogramma span { color: var(--accento); }

.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a {
    position: relative;
    font-size: 14.5px;
    color: var(--tenue);
    text-decoration: none;
    transition: color .2s ease;
}
.nav a:hover { color: var(--testo); }
.nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -4px;
    height: 1px;
    background: var(--accento);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--curva);
}
.nav a:hover::after { transform: scaleX(1); }

.comandi { display: flex; gap: 8px; }
.comando {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 38px;
    padding: 0 13px;
    border: 1px solid var(--linea-forte);
    border-radius: 999px;
    background: transparent;
    color: var(--tenue);
    font: 500 12.5px/1 var(--mono);
    letter-spacing: .06em;
    cursor: pointer;
    transition: border-color .2s ease, color .2s ease;
}
.comando:hover { border-color: var(--testo); color: var(--testo); }
.comando__sep { opacity: .4; }
[data-lang="en"] .comando__voce[data-voce="en"],
[data-lang="it"] .comando__voce[data-voce="it"] { color: var(--testo); }
.comando--tondo { width: 38px; padding: 0; justify-content: center; }
.comando svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------------------------------------------------------------- bottoni */

.azioni { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid var(--linea-forte);
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease, transform .25s var(--curva);
}
.btn:hover { border-color: var(--testo); transform: translateY(-2px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--pieno { background: var(--testo); border-color: var(--testo); color: var(--sfondo); }
.btn--pieno:hover { background: var(--accento); border-color: var(--accento); color: #fff; }
.btn--icona { width: 48px; padding: 0; justify-content: center; }
.btn--icona svg { fill: currentColor; stroke: none; }

/* ---------------------------------------------------------------- apertura */

.apertura { position: relative; padding: 168px 0 96px; overflow: hidden; }
.apertura::before {
    /* alone azzurro dietro al nome */
    content: "";
    position: absolute;
    z-index: -1;
    top: -260px;
    left: -200px;
    width: 900px;
    height: 700px;
    background: radial-gradient(closest-side, var(--accento-tenue), transparent);
    pointer-events: none;
}
.apertura__griglia {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 64px;
    align-items: end;
}
.apertura h1 {
    margin-top: 22px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(64px, 10vw, 140px);
    line-height: .92;
    letter-spacing: -.02em;
}
.apertura h1 em { display: block; font-style: italic; color: var(--accento); }
.apertura__sotto { margin-top: 30px; max-width: 580px; color: var(--tenue); font-size: 19px; line-height: 1.6; }
.apertura__sotto a { color: var(--testo); text-decoration-color: var(--accento); text-underline-offset: 4px; }

.ritratto { position: relative; }
.ritratto img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 50% 30%;
    border-radius: var(--raggio);
    filter: grayscale(1) contrast(1.05);
    box-shadow: var(--ombra);
    transition: filter .6s ease;
}
.ritratto:hover img { filter: grayscale(0); }
.ritratto figcaption {
    position: absolute;
    left: 16px; bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(11, 12, 14, .72);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font: 500 12px/1 var(--mono);
    letter-spacing: .04em;
}
.punto { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61, 220, 132, .2); }

.numeri {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 88px;
    border-top: 1px solid var(--linea);
}
.numero { display: flex; flex-direction: column-reverse; gap: 6px; padding: 26px 24px 0 0; }
.numero + .numero { padding-left: 24px; border-left: 1px solid var(--linea); }
.numero dd { font-family: var(--serif); font-size: clamp(44px, 5vw, 64px); line-height: 1; }
.numero dd small { font-size: .55em; color: var(--accento); }
.numero dt { color: var(--tenue); font-size: 14px; line-height: 1.4; }

/* ---------------------------------------------------------------- sezioni */

.sezione { padding: 112px 0; border-top: 1px solid var(--linea); }
.sezione__griglia { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); gap: 64px; }
.sezione__testa h2 {
    margin-top: 10px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(44px, 5vw, 64px);
    line-height: 1;
    letter-spacing: -.01em;
}
.sezione__testa { align-self: start; position: sticky; top: 104px; }
.sezione__testa--larga { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr); column-gap: 64px; margin-bottom: 56px; }
.sezione__testa--larga .sezione__num, .sezione__testa--larga h2 { grid-column: 1; }
.sezione__testa--larga .sezione__intro { grid-column: 2; grid-row: 1 / 3; align-self: end; }
.sezione__num { color: var(--accento); }
.sezione__intro { color: var(--tenue); font-size: 19px; max-width: 560px; }

.prosa { display: grid; gap: 20px; color: var(--tenue); font-size: 18px; max-width: 680px; }
.prosa__grande { color: var(--testo); font-family: var(--serif); font-size: clamp(30px, 3.4vw, 42px); line-height: 1.15; }
.prosa__grande em { color: var(--accento); }

/* esperienza */
.ruolo { padding-bottom: 40px; }
.ruolo + .ruolo { padding-top: 32px; border-top: 1px solid var(--linea); }
.ruolo__testa { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.ruolo h3 { font-size: 24px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.ruolo h3 a { color: var(--accento); text-decoration: none; font-weight: 400; }
.ruolo__titolo { margin-top: 4px; color: var(--tenue); font-size: 15.5px; }
.ruolo__date { flex: none; text-align: right; line-height: 1.6; }
.ruolo__punti { display: grid; gap: 12px; margin-top: 24px; }
.ruolo__punti li { position: relative; padding-left: 22px; color: var(--tenue); }
.ruolo__punti li::before { content: ""; position: absolute; left: 0; top: .72em; width: 10px; height: 1px; background: var(--accento); }
.ruolo__punti strong { color: var(--testo); font-weight: 600; }
.ruolo--piccolo h3 { font-size: 19px; }
.ruolo--piccolo > p { margin-top: 12px; color: var(--tenue); font-size: 15.5px; }

/* progetti */
.progetti { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.progetto {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--linea);
    border-radius: var(--raggio);
    background: var(--sfondo-2);
    overflow: hidden;
    transition: border-color .3s ease, transform .4s var(--curva);
}
.progetto:hover { border-color: var(--linea-forte); transform: translateY(-4px); }
.progetto--grande { grid-column: span 2; }
.progetto__foto { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--sfondo-3); border-bottom: 1px solid var(--linea); }
.progetto__foto img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .8s var(--curva); }
.progetto:hover .progetto__foto img { transform: scale(1.03); }
.progetto__testo { display: grid; gap: 10px; align-content: start; padding: 24px 24px 28px; }
.progetto h3 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; }
.progetto h3 a { text-decoration: none; }
.progetto h3 a:hover { color: var(--accento); }
.progetto__testo > p:not(.progetto__tipo) { color: var(--tenue); font-size: 15px; line-height: 1.6; }
.progetto__tipo { color: var(--accento); }
.progetto--scritto h3 { font-family: var(--serif); font-size: 25px; font-weight: 400; letter-spacing: 0; line-height: 1.15; }
.link-pdf {
    justify-self: start;
    margin-top: 6px;
    padding: 6px 12px;
    border: 1px solid var(--linea-forte);
    border-radius: 999px;
    font: 500 12px/1.2 var(--mono);
    letter-spacing: .05em;
    text-decoration: none;
    transition: border-color .2s ease, color .2s ease;
}
.link-pdf:hover { border-color: var(--accento); color: var(--accento); }

/* grafico astratto del monitor prezzi */
.progetto__foto--grafico { display: grid; place-items: center; }
.progetto__foto--grafico svg { width: 100%; height: 100%; }
.grafico__righe rect { fill: var(--linea-forte); opacity: .6; }
.grafico__noi { fill: var(--accento); }
.grafico__punto { fill: #3ddc84; animation: lampeggia 2.4s ease-in-out infinite; }
@keyframes lampeggia { 50% { opacity: .25; } }

/* formazione */
.percorso { position: relative; display: grid; gap: 0; }
.percorso::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 1px; background: var(--linea-forte); }
.tappa { position: relative; padding: 0 0 36px 40px; }
.tappa::before {
    content: "";
    position: absolute;
    left: 0; top: 6px;
    width: 11px; height: 11px;
    border-radius: 50%;
    background: var(--sfondo);
    border: 1.5px solid var(--accento);
}
.tappa:first-child::before { background: var(--accento); }
.tappa h3 { margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.tappa p:not(.tappa__date) { margin-top: 4px; color: var(--tenue); }

/* competenze */
.competenze { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 40px; }
.gruppo h3 { font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--tenue); }
.pillole { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pillole li { padding: 7px 14px; border: 1px solid var(--linea-forte); border-radius: 999px; font-size: 14.5px; }
.gruppo--lingue { grid-column: 1 / -1; }
.lingue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.lingue div { padding: 16px 18px; border: 1px solid var(--linea); border-radius: 14px; background: var(--sfondo-2); }
.lingue dt { font-weight: 600; }
.lingue dd { color: var(--tenue); font-size: 14px; }

/* contatti */
.contatti { padding: 120px 0 128px; border-top: 1px solid var(--linea); }
.contatti__titolo {
    margin-top: 14px;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(72px, 13vw, 180px);
    line-height: .9;
    letter-spacing: -.02em;
}
.contatti__titolo em { color: var(--accento); }
.contatti__testo { margin-top: 26px; color: var(--tenue); font-size: 19px; }
.contatti__link { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 38px; }
.contatti__email {
    font-family: var(--serif);
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.1;
    text-decoration: underline;
    text-decoration-color: var(--accento);
    text-decoration-thickness: 1px;
    text-underline-offset: 8px;
    overflow-wrap: anywhere;
    transition: color .2s ease;
}
.contatti__email:hover { color: var(--accento); }

.piede { padding: 28px 0 36px; border-top: 1px solid var(--linea); color: var(--tenue); font-size: 14px; }
.piede__dentro { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.piede a { text-decoration: none; }
.piede a:hover { color: var(--testo); }

/* ---------------------------------------------------------------- comparsa */

.js .rivela { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--curva) var(--ritardo, 0s), transform .8s var(--curva) var(--ritardo, 0s); }
.js .rivela.visibile { opacity: 1; transform: none; }
.js .progetto.rivela.visibile { transition: opacity .8s var(--curva) var(--ritardo, 0s), transform .4s var(--curva), border-color .3s ease; }

/* ---------------------------------------------------------------- schermi piccoli */

@media (max-width: 1000px) {
    .nav { display: none; }
    .comandi { margin-left: auto; }
    .apertura__griglia { grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; }
    .progetti { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sezione__griglia, .sezione__testa--larga { grid-template-columns: 1fr; gap: 28px; }
    .sezione__testa { position: static; }
    .sezione__testa--larga .sezione__intro { grid-column: 1; grid-row: auto; margin-top: 18px; }
    .numeri { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .numero:nth-child(3) { padding-left: 0; border-left: 0; }
}

@media (max-width: 700px) {
    body { font-size: 16px; }
    .contenitore { padding: 0 16px; }
    .barra__dentro { height: 62px; }
    .apertura { padding: 112px 0 64px; }
    .apertura__griglia { grid-template-columns: 1fr; gap: 36px; }
    .ritratto { max-width: 300px; }
    .apertura__sotto { font-size: 17px; }
    .numeri { margin-top: 56px; }
    .numero { padding: 20px 12px 18px 0; }
    .numero + .numero { padding-left: 14px; }
    .numero:nth-child(3) { padding-left: 0; }
    .numero:nth-child(n+3) { border-top: 1px solid var(--linea); }
    .sezione { padding: 80px 0; }
    .progetti { grid-template-columns: 1fr; }
    .progetto--grande { grid-column: auto; }
    .ruolo__testa { flex-direction: column; gap: 8px; }
    .ruolo__date { text-align: left; }
    .competenze { grid-template-columns: 1fr; }
    .lingue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .contatti { padding: 88px 0 96px; }
    .btn { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
    .js .rivela { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- entrata dell'apertura (al posto della vecchia animazione iniziale) */

@keyframes entra { from { opacity: 0; transform: translateY(26px); } }
.apertura__testo > *, .ritratto { animation: entra 1s var(--curva) both; }
.apertura__testo > :nth-child(2) { animation-delay: .08s; }
.apertura__testo > :nth-child(3), .apertura__testo > :nth-child(4) { animation-delay: .18s; }
.apertura__testo > :nth-child(5) { animation-delay: .28s; }
.ritratto { animation-delay: .22s; }

/* tesi: larga due colonne sugli schermi grandi, così la griglia dei progetti non lascia buchi */
.progetto--largo { grid-column: span 2; }
@media (max-width: 1000px) { .progetto--largo { grid-column: auto; } }
