/* Ubuntu Sans / Ubuntu Sans Mono (OFL-1.1), variabili, solo latin, serviti da qui:
   assets/fonts/LICENSE.txt. Se un file manca si ricade sui font di sistema. */
@font-face { font-family: "Ubuntu Sans"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("../fonts/UbuntuSans-wght.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu Sans"; font-style: italic; font-weight: 100 800; font-display: swap; src: url("../fonts/UbuntuSans-wght-Italic.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu Sans Mono"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/UbuntuSansMono-wght.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu Sans Mono"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("../fonts/UbuntuSansMono-wght-Italic.woff2") format("woff2"); }

/* About site: same look and mechanics as MultiContactForm (tokens, top bar,
   language menu, footer), with the colours of each payment method on top. */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #eef0f4;
    --text: #1a1d23;
    --muted: #555b66;
    --border: #c9ced6;
    --accent: #1f5fbf;
    --accent-text: #ffffff;
    --accent-hover: #174a96;
    --focus: #f0a400;
    --ok: #1a7f37;
    --radius: 8px;
    --glow: 0.28;
    --c-s: 72%;
    --c-l: 36%;
    --c-fg: #ffffff;
    --font: "Ubuntu Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Ubuntu Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light dark;
}

/* Dark palette: automatic (OS preference) unless light is forced, or forced dark. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #14161a;
        --surface: #1d2026;
        --surface-2: #262a32;
        --text: #e9ebef;
        --muted: #a9b0bc;
        --border: #3b414c;
        --accent: #6ea8ff;
        --accent-text: #0b1220;
        --accent-hover: #9cc3ff;
        --focus: #ffc94d;
        --ok: #4cc38a;
        --glow: 0.5;
        --c-s: 85%;
        --c-l: 66%;
        --c-fg: #0b1220;
    }
}
:root[data-theme="dark"] {
    --bg: #14161a;
    --surface: #1d2026;
    --surface-2: #262a32;
    --text: #e9ebef;
    --muted: #a9b0bc;
    --border: #3b414c;
    --accent: #6ea8ff;
    --accent-text: #0b1220;
    --accent-hover: #9cc3ff;
    --focus: #ffc94d;
    --ok: #4cc38a;
    --glow: 0.5;
    --c-s: 85%;
    --c-l: 66%;
    --c-fg: #0b1220;
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 1rem/1.55 var(--font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap {
    width: 100%;
    max-width: 42rem;
    margin: 0 auto;
    padding: 0 1rem;
}
.wrap.wide { max-width: 62rem; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

[hidden] { display: none !important; }

.skip {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 20;
    padding: .6rem 1rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.skip:focus { top: 1rem; }

/* Top bar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar .wrap { max-width: 62rem; }
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.5rem;
    flex-wrap: wrap;
}
.brand { font-weight: 600; color: inherit; text-decoration: none; }
.brand:hover, .brand:focus-visible { text-decoration: underline; }
.switches { display: flex; align-items: center; gap: .5rem; }
.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: .3rem .75rem;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.topbar-btn:hover { border-color: var(--accent); }
.icon-btn { padding: .3rem; font-size: 1.25rem; line-height: 1; text-decoration: none; }
a.topbar-btn:hover { color: var(--text); }

/* Two toggles, one shown: the one pointing to the opposite of the theme on
   screen. The device theme without data-theme, else data-theme (the saved
   choice or this visit's, see theme.js), which wins by specificity. */
.theme-switch--to-light { display: none; }
@media (prefers-color-scheme: dark) {
    .theme-switch--to-dark { display: none; }
    .theme-switch--to-light { display: inline-flex; }
}
:root[data-theme="light"] .theme-switch--to-light,
:root[data-theme="dark"] .theme-switch--to-dark { display: none; }
:root[data-theme="light"] .theme-switch--to-dark,
:root[data-theme="dark"] .theme-switch--to-light { display: inline-flex; }
.flag {
    width: 21px;
    height: 14px;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
    flex: none;
}

/* Language drop-down */
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-list {
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
    z-index: 10;
    min-width: 12rem;
    margin: 0;
    padding: .35rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.lang-option {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    min-height: 2.75rem;
    padding: .45rem .75rem;
    font: inherit;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 6px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.lang-option:hover, .lang-option:focus-visible { background: var(--bg); }
.lang-option[aria-current="true"] { color: var(--accent); font-weight: 600; }

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}


main.wrap {
    flex: 1;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

h1 { font-size: 1.75rem; line-height: 1.2; margin: .5rem 0; }
h2 { font-size: 1.35rem; line-height: 1.25; margin: 0; }

/* Hero: title and lead; with an avatar, the picture sits beside the title. */
.hero { padding-block: clamp(.5rem, 3vw, 2rem) .5rem; }
.hero h1 { font-size: clamp(1.9rem, 1.1rem + 3.4vw, 3.1rem); line-height: 1.1; margin: 0; letter-spacing: -.01em; }
.lead { margin: .75rem 0 0; max-width: 40rem; font-size: 1.1rem; color: var(--muted); }
.hero.has-avatar { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; align-items: center; }
.hero.has-avatar .lead { grid-column: 1 / -1; margin-top: .5rem; }
@media (min-width: 700px) { .hero.has-avatar .lead { grid-column: 2; margin-top: -.25rem; } }
.avatar {
    width: clamp(4.5rem, 12vw, 7rem);
    height: clamp(4.5rem, 12vw, 7rem);
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border);
}

.notice {
    margin: 1rem 0 0;
    padding: .75rem .9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 6px;
}

main section { padding-top: 2.25rem; }
.prose p { margin: .6rem 0 0; max-width: 40rem; color: var(--muted); font-size: 1.05rem; }

/* Colour of a card or button: only its own dot and button take it. */
.c-red    { --h: 8; }
.c-orange { --h: 30; }
.c-yellow { --h: 46; }
.c-green  { --h: 150; }
.c-teal   { --h: 172; }
.c-cyan   { --h: 190; }
.c-blue   { --h: 212; }
.c-indigo { --h: 245; }
.c-purple { --h: 285; }
.c-pink   { --h: 330; }
.skill, .link { --c: hsl(var(--h) var(--c-s) var(--c-l)); }

ul.skills, ul.projects, ul.links { margin: 0; padding: 0; list-style: none; display: grid; gap: 1rem; }
ul.skills, ul.projects { margin-top: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.skill {
    padding: 1.1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 26px 50px -32px hsl(var(--h) 90% 60% / var(--glow));
}
.skill p { margin: .55rem 0 0; color: var(--muted); }
.name {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}
.dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--c); flex: none; }

/* A project card is a skill card that is one big link. */
ul.projects { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.project { position: relative; padding: 0; transition: border-color .15s; }
.project a { display: block; padding: 1.1rem 1.25rem; color: inherit; text-decoration: none; border-radius: 16px; }
.project:hover, .project:focus-within { border-color: var(--c); }
.project a:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.project-git { position: absolute; top: 1.15rem; right: 1.15rem; width: 1.2rem; height: 1.2rem; fill: currentColor; color: var(--muted); pointer-events: none; transition: color .15s; }
.project:hover .project-git, .project:focus-within .project-git { color: var(--c); }
.project a.has-git .name { padding-right: 1.8rem; }
.project-where { display: block; margin-top: .7rem; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: .55rem 1rem;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    color: var(--c-fg);
    background: var(--c, var(--accent));
    border: 2px solid var(--c, var(--accent));
    border-radius: 8px;
}
.btn:hover { color: var(--c-fg); filter: brightness(1.08); }
.error-card .btn { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

.cta p { margin: .5rem 0 1rem; max-width: 40rem; color: var(--muted); font-size: 1.05rem; }
.cta-btn { width: fit-content; min-width: 12rem; color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.cta-btn:hover { color: var(--accent-text); }

ul.links { margin-top: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: .75rem; }

.footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .875rem;
}
.footer p { margin: .9rem 0; }
.footer-inner { padding-top: .4rem; padding-bottom: .4rem; }
.footer-inner > p { margin: .5rem 0; }

.footer-inner { max-width: 62rem; }
.footer a { color: inherit; }
.footer a:hover, .footer a:focus-visible { color: var(--text); }

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    .hero h1 { font-size: 1.9rem; }
    .topbar-inner { gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Error pages (app/views/error.php): the card, and on a 403 or 404 the
   footer right under it, the two centred together. */
.error-body { align-items: center; justify-content: center; padding: 1.25rem; }
.error-card {
    width: 100%;
    max-width: 25rem;
    margin: 0 auto;
    padding: 2.25rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}
.error-brand { display: block; width: fit-content; margin: 0 auto; font-size: 1.4rem; font-weight: 700; color: inherit; text-decoration: none; }
.error-body .footer { border-top: 0; text-align: center; }
.error-code { margin: 1.1rem 0 0; font-size: 3.5rem; font-weight: 700; line-height: 1; color: var(--muted); opacity: .35; letter-spacing: .05em; }
.error-title { margin: .4rem 0 .6rem; font-size: 1.15rem; }
.error-card .hint { margin: 0 0 .9rem; }
.request-url {
    padding: .5rem .65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow-wrap: anywhere;
    font-family: var(--font-mono);
    font-size: .8rem;
}
.error-card .btn { display: flex; margin-top: 1.4rem; }

/* Privacy page */
.legal { line-height: 1.65; }
.legal h1 { margin-bottom: .5rem; }
.legal h2 { margin: 1.9rem 0 .5rem; }
.legal ul { padding-left: 1.25rem; }
.controller-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: .25rem 1.25rem;
    margin: 1.25rem 0;
}
.controller-box h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; margin: 1rem 0 .5rem; }
.controller-box p { color: var(--muted); margin: 0 0 1rem; }
.state-present { color: var(--ok); font-weight: 600; }
.state-absent { color: var(--muted); }
.table-wrap { overflow-x: auto; }
.cookie-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cookie-table th, .cookie-table td { padding: .55rem .5rem; text-align: left; vertical-align: top; }
.cookie-table thead th { border-bottom: 1px solid var(--border); }
.cookie-table tbody { border-bottom: 1px solid var(--border); }
.cookie-table tbody th { font-weight: 400; word-break: break-all; }
.cookie-desc td { padding-top: 0; color: var(--muted); }
