:root {
  --accent: #5b5bd6; --accent-ink: #fff; --accent-soft: #e9e9fb;
  --bg: #f5f6f8; --surface: #fff; --border: #e2e4e9;
  --text: #16181d; --muted: #636a75; --chip: #eef0f4;
  --radius: 10px; --radius-card: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #8182f0; --accent-ink: #111214; --accent-soft: #24254a;
    --bg: #111214; --surface: #18191c; --border: #2a2c31;
    --text: #ecedef; --muted: #9ba1ab; --chip: #202226; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent: #8182f0; --accent-ink: #111214; --accent-soft: #24254a;
  --bg: #111214; --surface: #18191c; --border: #2a2c31;
  --text: #ecedef; --muted: #9ba1ab; --chip: #202226; color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* barra in alto, centrata */
.topbar {
  position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 10px 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; justify-self: start; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 50%; }
nav { display: flex; gap: 4px; }
nav a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-weight: 500; font-size: 15px; white-space: nowrap; }
nav a:hover { background: var(--chip); text-decoration: none; }
nav a.active { background: var(--accent-soft); color: var(--accent); }
.seg { justify-self: end; display: grid; grid-template-columns: repeat(3, auto); gap: 2px; padding: 3px; background: var(--chip); border-radius: var(--radius); }
.seg button {
  font: inherit; font-size: 13px; padding: 5px 10px; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; }

main { max-width: 860px; margin: 0 auto; padding: 40px 16px 56px; }
section { margin-bottom: 64px; }
h1 { font-size: 40px; line-height: 1.15; margin: 0 0 10px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 18px; font-weight: 600; text-align: center; }
p { margin: 0 0 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 22px; }

.hero { text-align: center; padding: 48px 16px 8px; }
.hero .logo { width: 132px; height: 132px; border-radius: 50%; margin: 0 auto 20px; display: block; }
.hero .lead { font-size: 19px; color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.about { max-width: 680px; margin: 28px auto 0; }
.about p:last-child { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project { display: flex; flex-direction: column; gap: 10px; }
.project h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.project p { color: var(--muted); font-size: 15px; margin: 0; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--chip); border-radius: 999px; padding: 3px 11px; font-size: 13px; color: var(--text); }
.link { font-weight: 600; font-size: 14px; }
.soon { font-size: 14px; color: var(--muted); }

.skills { display: grid; gap: 20px; text-align: center; }
.skills h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.skills .chips { justify-content: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 20px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; border: 1px solid var(--accent);
}
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--chip); filter: none; }
.contact { text-align: center; max-width: 560px; margin: 0 auto; }
footer { color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); padding-top: 20px; text-align: center; }

@media (max-width: 720px) {
  .topbar-inner { grid-template-columns: auto 1fr; padding: 8px 12px; gap: 6px; }
  .brand span { display: none; }
  nav { justify-self: end; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  nav::-webkit-scrollbar { display: none; }
  nav { gap: 0; } nav a { padding: 7px 8px; font-size: 14px; }
  .seg { display: none; }
  .grid { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  .hero { padding-top: 28px; } .hero .logo { width: 108px; height: 108px; }
  html { scroll-padding-top: 64px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
