/* ============ Design tokens ============ */
:root {
  color-scheme: light;
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --text: #1A1A1A;
  --muted: #6B6B6B;
  --hairline: #E5E2DD;
  --accent: #256D66;

  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --container: 68rem;
  --section: clamp(4rem, 10vw, 8rem);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1C1D1F;
  --surface: #242628;
  --text: #ECEAE6;
  --muted: #9A9A96;
  --hairline: #34363A;
  --accent: #5FB3AB;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1C1D1F;
    --surface: #242628;
    --text: #ECEAE6;
    --muted: #9A9A96;
    --hairline: #34363A;
    --accent: #5FB3AB;
  }
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }

p { margin: 0 0 1rem; max-width: 65ch; }
ul { padding-left: 1.25rem; }

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

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  body { transition: background-color 0.2s ease, color 0.2s ease; }
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

section { padding-block: var(--section); }

/* ============ Header / nav ============ */
.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.site-header { border-bottom: 1px solid var(--hairline); }

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.25rem;
}

.brand { font-family: var(--font-display); font-weight: 700; text-decoration: none; color: var(--text); }

.site-nav { display: flex; align-items: center; gap: clamp(0.75rem, 3vw, 1.5rem); }
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav .lang-switch { color: var(--muted); }

/* hover tono-su-tono col glow: testo in gradiente accent → accent+testo */
.site-nav a:hover,
.contact-links a:not(.btn):hover {
  background-image: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--text)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-decoration-color: var(--accent);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Components ============ */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hero .lead {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  color: var(--muted);
  max-width: 44ch;
}

.hero .location { color: var(--muted); font-size: 1rem; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
}
.portrait {
  width: clamp(9rem, 18vw, 13rem);
  border-radius: 20px;
  border: 1px solid var(--hairline);
}
@media (max-width: 640px) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; width: 7rem; }
}

/* full-bleed: hairline e glow a tutta viewport, il testo resta in colonna */
.project-card {
  border-top: 1px solid var(--hairline);
  padding-block: 2rem;
}
.project-card .container { display: grid; gap: 0.5rem; }
.project-card:last-of-type { border-bottom: 1px solid var(--hairline); }
.project-card h3 { margin: 0; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card h3 a:hover { color: var(--accent); }
.project-card .label { color: var(--muted); font-size: 0.9375rem; }

/* Luce che segue il mouse su tutta la pagina: layer fisso a tutta viewport,
   mai tagliato; appare al primo movimento (classe .glow dal listener) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: radial-gradient(
      20rem circle at var(--mx, 50%) var(--my, 50%),
      color-mix(in srgb, var(--accent) 8%, transparent),
      transparent 65%
    );
  }
  body.glow::after { opacity: 1; }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
}
.btn:hover {
  background-image: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--text)));
}

.contact-links { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }

.site-footer { border-top: 1px solid var(--hairline); }
.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 2.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer .fineprint {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.875rem;
}

/* ============ Case study ============ */
.case-study h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.case-study .meta { color: var(--muted); margin-bottom: 2rem; }
.case-study section { padding-block: clamp(1.5rem, 4vw, 3rem); }
.case-study .back { display: inline-block; margin-bottom: 2rem; }
.note {
  border-top: 1px solid var(--hairline);
  padding-top: 1.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
}
figure { margin: 2rem 0; }
figcaption { color: var(--muted); font-size: 0.9375rem; margin-top: 0.5rem; }

.figure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}
.figure-grid figure { margin: 0; }
@media (max-width: 640px) {
  .figure-grid { grid-template-columns: 1fr; }
}

/* ============ Timeline ============ */
/* full-bleed come le project card: hairline a tutta viewport, testo in colonna */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  padding-block: 0.75rem;
  border-top: 1px solid var(--hairline);
}
.timeline li:last-child { border-bottom: 1px solid var(--hairline); }
.timeline li .container {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
}
.timeline .period { color: var(--muted); font-size: 0.9375rem; }
@media (max-width: 480px) {
  .timeline li .container { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ============ Scroll reveal ============ */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  html.js figure.reveal,
  html.js .figure-grid.reveal { transform: translateY(12px) scale(0.97); }
  html.js .project-card.reveal:nth-of-type(2) { transition-delay: 100ms; }
  html.js .reveal.is-visible { opacity: 1; transform: none; }
}

/* ============ Case study figures ============ */
.case-study figure img { border: 1px solid var(--hairline); border-radius: 4px; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .case-study figure img { transition: transform 0.4s ease; }
  .case-study figure:hover img { transform: scale(1.02); }
}

/* screenshot per tema: stessa logica dei token colore */
.img-dark { display: none; }
:root[data-theme="dark"] .img-light { display: none; }
:root[data-theme="dark"] .img-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .img-light { display: none; }
  :root:not([data-theme="light"]) .img-dark { display: block; }
}
