/* ==========================================================================
   Colori: cambia questi valori per cambiare l'aspetto di tutto il sito.
   ========================================================================== */
:root {
  --paper: #f7f8fa;
  --tint: #eaeef3;
  --ink: #14212e;
  --muted: #566275;
  --line: #d3dae5;
  --accent: #a4505d;
  --on-accent: #ffffff;
  --header-bg: rgba(247, 248, 250, 0.86);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --measure: 36rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1620;
    --tint: #131e2b;
    --ink: #eaeff5;
    --muted: #9aa8bb;
    --line: #26354a;
    --accent: #f0a6ae;
    --on-accent: #0e1620;
    --header-bg: rgba(14, 22, 32, 0.86);
  }
}

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
}

::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3 { text-wrap: balance; }

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: min(calc(100% - 3rem), 66rem);
  margin-inline: auto;
}

.section { padding: clamp(4.5rem, 10vw, 8rem) 0; scroll-margin-top: 3rem; }

.section-title {
  margin: 0 0 1.5rem;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ---------- Menu in alto ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.site-header.on-hero {
  background: linear-gradient(rgba(9, 18, 29, 0.55), rgba(9, 18, 29, 0));
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-color: transparent;
  color: #fff;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 2rem;
  padding: 1rem 0;
}

.brand {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-header nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.6rem; }

.site-header nav a {
  font-size: 1rem;
  opacity: 0.75;
  text-decoration: none;
  transition: opacity 0.2s;
}

.site-header nav a:hover,
.site-header nav a.active { opacity: 1; }

.site-header nav a.active {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

.site-header.on-hero nav a.active { text-decoration-color: #fff; }

/* ---------- Apertura con la foto ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #0f1b28;
  color: #fff;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 40%;
  transform-origin: 72% 50%;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9, 18, 29, 0.86) 0%, rgba(9, 18, 29, 0.38) 45%, rgba(9, 18, 29, 0.22) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 8rem 0 clamp(3rem, 8vw, 5.5rem);
}

.hero h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(3.4rem, 12vw, 9.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero blockquote {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(1.3rem, 2.8vw, 2.1rem);
  font-style: italic;
  line-height: 1.3;
  text-wrap: balance;
}

.hero blockquote p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .hero-img { animation: settle 2.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero h1 { animation: rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both; }
  .hero blockquote { animation: rise 1s cubic-bezier(0.2, 0.7, 0.2, 1) 0.4s both; }
}

@keyframes settle { from { transform: scale(1.08); } to { transform: scale(1); } }

@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Who am I ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 2.5rem clamp(2.5rem, 7vw, 6rem);
  align-items: center;
}

.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 0.75rem;
  object-fit: cover;
  object-position: 100% 50%;
}

.bio {
  max-width: var(--measure);
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  line-height: 1.45;
  text-wrap: pretty;
}

/* ---------- Education ---------- */
.band { background: var(--tint); }

.edu-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1.5rem clamp(2.5rem, 7vw, 6rem);
  align-items: start;
}

.edu-grid .section-title { margin: 0; }

.edu { padding: 0.35rem 0 0 1.5rem; border-left: 2px solid var(--accent); }

.edu-years {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.edu h3 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  font-weight: 400;
  line-height: 1.3;
}

.edu p { margin: 0; color: var(--muted); }

/* ---------- Contact me ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 2.5rem clamp(2.5rem, 7vw, 6rem);
  align-items: start;
}

.contact-intro p { max-width: 22rem; margin: 0 0 1.5rem; color: var(--muted); }

.contact-mail {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.form { display: grid; gap: 1.5rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.field label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  transition: border-color 0.2s;
}

.field textarea { min-height: 8rem; resize: vertical; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }

.btn {
  padding: 0.95rem 2.25rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.btn:hover { background: var(--accent); color: var(--on-accent); }

.form-note { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Piè di pagina ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer p { margin: 0; }

/* ---------- Overlay "sito in manutenzione" ---------- */
.maintenance {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  background: #0f1b28;
  color: #fff;
  overflow: hidden;
}

.maintenance-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.4;
}

.maintenance::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(9, 18, 29, 0.75), rgba(9, 18, 29, 0.92));
}

.maintenance-box {
  position: relative;
  z-index: 1;
  max-width: 32rem;
}

.maintenance-eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.maintenance-box h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.25rem, 7vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.maintenance-box p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.15rem;
  line-height: 1.6;
}

.maintenance[hidden] { display: none; }

/* quando l'overlay è attivo, blocca lo scroll della pagina sotto */
.has-maintenance { overflow: hidden; height: 100%; }

/* ---------- Comparsa delle sezioni allo scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { transition: none !important; }
}

/* ---------- Schermi piccoli ---------- */
@media (max-width: 52rem) {
  .about-grid,
  .edu-grid,
  .contact-grid { grid-template-columns: 1fr; }
  .portrait { max-width: 20rem; }
}

@media (max-width: 36rem) {
  .field-row { grid-template-columns: 1fr; }
  .hero-img { object-position: 78% 40%; }
}
