/* ===== Colori e font: modifica qui per cambiare l'aspetto di tutto il sito ===== */
:root {
  color-scheme: light dark;
  --bg: #f3f5f9;       /* carta fredda */
  --ink: #0f1b33;      /* testo principale */
  --muted: #55607a;    /* testo secondario */
  --line: #d3d9e6;     /* linee sottili */
  --tint: #e6ebf6;     /* sfondo al passaggio del mouse */
  --accent: #2342d6;   /* blu cobalto */
  --sun: #ffd84d;      /* evidenziatore, da usare poco */
  --panel: #2342d6;    /* blocco in primo piano nella home */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1424; --ink: #e8ecf5; --muted: #9aa5bf; --line: #26304a;
    --tint: #161f36; --accent: #8fa3ff; --sun: #ffd84d; --panel: #2342d6;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.65 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; max-width: 62ch; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 3rem); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: .5rem 1rem; z-index: 10; }

/* Intestazione e menu */
header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 2rem; padding-block: 1.25rem; }
.brand { font: 600 1.2rem var(--serif); color: var(--ink); text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; }
nav a { color: var(--ink); text-decoration: none; padding-block: .25rem; }
nav a:hover { box-shadow: inset 0 -2px var(--accent); }
nav a[aria-current="page"] { box-shadow: inset 0 -0.45em var(--sun); color: #0f1b33; }

/* Home: apertura */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: stretch; padding-block: clamp(2.5rem, 8vw, 6rem); }
.hero h1 { font-size: clamp(2.8rem, 8vw, 5.5rem); line-height: 1.02; letter-spacing: -0.03em; margin-bottom: 1.5rem; }
.lead { font-size: 1.3rem; color: var(--muted); max-width: 34ch; }
.hero-panel { background: var(--panel); color: #fff; padding: clamp(1.5rem, 4vw, 2.5rem); display: flex; flex-direction: column; justify-content: flex-end; border-radius: 2px; }
.hero-panel p { margin: 0 0 1rem; font-size: .95rem; opacity: .85; }
.hero-panel ul { list-style: disc; margin: 0; padding-left: 1.25em; font: 600 clamp(1.5rem, 3.4vw, 2.2rem)/1.2 var(--serif); }
.hero-panel li + li { margin-top: .6rem; }
.hero-photo { display: block; align-self: center; width: 80%; max-height: 16rem; margin-bottom: 1.5rem; border-radius: 2px; object-fit: cover; object-position: center 35%; }
.btn { display: inline-block; background: var(--ink); color: var(--bg); padding: .8rem 1.5rem; text-decoration: none; border-radius: 2px; margin-right: 1.25rem; }
.btn:hover { background: var(--accent); color: #fff; }

/* Sezioni */
section { border-top: 1px solid var(--line); padding-block: clamp(2.5rem, 7vw, 4.5rem); }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem; margin-bottom: 1.5rem; }
.page-title { padding-block: clamp(2.5rem, 7vw, 5rem) 1rem; }
.page-title h1 { font-size: clamp(2.4rem, 6vw, 4rem); margin-bottom: 1rem; }

/* Righe del percorso (data a sinistra, contenuto a destra) */
.row { display: grid; grid-template-columns: 11rem 1fr; gap: .5rem 2rem; padding-block: 1.4rem; border-top: 1px solid var(--line); }
.row:last-child { border-bottom: 1px solid var(--line); }
.when { color: var(--muted); margin: 0; font-size: .95rem; }
.row h3 { margin-bottom: .15rem; }
.row .where { color: var(--muted); margin-bottom: .6rem; }
.row p:last-child { margin-bottom: 0; }

/* Progetti */
.project-entry { padding-block: 1.4rem; border-top: 1px solid var(--line); }
.project-entry:last-child { border-bottom: 1px solid var(--line); }
.project-entry h3 { margin-bottom: .5rem; }
.project-entry p:not(.tags) { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; }
.tile { display: block; border: 1px solid var(--line); border-radius: 2px; padding: 1.5rem; color: inherit; text-decoration: none; }
a.tile:hover { background: var(--tint); border-color: var(--accent); }
.tile h3 { margin-bottom: .5rem; }
.tile p { color: var(--muted); }
.tags { font-size: .9rem; color: var(--accent); margin: 0; }
.tile.empty { border-style: dashed; }

/* Contatti */
footer { border-top: 1px solid var(--line); padding-block: 3rem; }
footer h2 { margin-bottom: .75rem; }
footer .small { color: var(--muted); font-size: .9rem; margin-top: 2rem; }

@media (max-width: 48rem) {
  .hero { grid-template-columns: 1fr; }
  .hero-panel { min-height: 12rem; }
  .row { grid-template-columns: 1fr; }
}
