/* Landing Stefano Colla — direzione "Scheda tecnica".
   Un solo file: font, token, base, layout, componenti.
   Contrasti WCAG (testo su --bg): chiaro / scuro, calcolati sui valori qui sotto. */

/* ---------- Font (self-hosted, SIL OFL; i percorsi li riscrive il build con l'hash) ---------- */

@font-face {
  font-family: "IBM Plex Sans Variable";
  src: url("/assets/ibm-plex-sans-latin-wght.e2291e842c.woff2") format("woff2");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/ibm-plex-mono-latin-500.01d2854474.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* Fallback con metriche allineate: niente salti di layout al cambio di font. */
@font-face {
  font-family: "Plex Sans Fallback";
  src: local("Arial"), local("ArialMT"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 101.17%;
  ascent-override: 101.32%;
  descent-override: 27.18%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Plex Sans Fallback";
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Bold"), local("Helvetica-Bold"),
    local("Liberation Sans Bold"), local("LiberationSans-Bold");
  font-weight: 600 700;
  size-adjust: 101.17%;
  ascent-override: 101.32%;
  descent-override: 27.18%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Plex Mono Fallback";
  src: local("Courier New"), local("CourierNewPSMT"), local("Liberation Mono");
  size-adjust: 99.98%;
  ascent-override: 102.52%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

/* ---------- Token ---------- */

:root {
  color-scheme: light dark;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #0e1a2b;          /* 16,3:1 */
  --text-muted: #45556b;    /*  7,1:1 */
  --link: #1a47c2;          /*  7,2:1 */
  --accent: #1f4fd1;
  --accent-hover: #1a43b2;
  --on-accent: #ffffff;     /*  6,8:1 su --accent */
  --border: #d3dbe5;
  --focus: #c2410c;         /*  4,8:1 */

  --font-sans: "IBM Plex Sans Variable", "Plex Sans Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Plex Mono Fallback", ui-monospace, Menlo, Consolas, monospace;

  /* Scala fluida tra 360 e 1024 px. */
  --fs-label: clamp(0.8125rem, 0.7786rem + 0.1506vw, 0.875rem);
  --fs-small: clamp(0.9375rem, 0.9036rem + 0.1506vw, 1rem);
  --fs-body: clamp(1.0625rem, 1.0286rem + 0.1506vw, 1.125rem);
  --fs-h3: clamp(1.1875rem, 1.1197rem + 0.3012vw, 1.3125rem);
  --fs-role: clamp(1.125rem, 0.9895rem + 0.6024vw, 1.375rem);
  --fs-tagline: clamp(1.125rem, 1.0233rem + 0.4518vw, 1.3125rem);
  --fs-h2: clamp(1.5rem, 1.2289rem + 1.2048vw, 2rem);
  --fs-h1: clamp(2.25rem, 1.5723rem + 3.012vw, 3.5rem);

  --gutter: 20px;
  --section-pad: clamp(4rem, 2.374rem + 7.229vw, 7rem);
  --radius: 6px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1420;
    --surface: #132033;
    --text: #e6edf6;        /* 15,7:1 */
    --text-muted: #a2b1c5;  /*  8,5:1 */
    --link: #9dbdff;        /*  9,8:1 */
    --accent: #7ea8ff;
    --accent-hover: #91b5ff;
    --on-accent: #0a1220;   /*  8,0:1 su --accent */
    --border: #283a52;
    --focus: #fdba74;       /* 11,0:1 */
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  text-wrap: balance;
}

abbr[title] {
  text-decoration: none;
  cursor: help;
}

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

a:hover {
  color: var(--text);
  text-decoration-thickness: 2px;
}

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

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

.icon {
  flex: none;
}

.wrap {
  max-width: calc(1120px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Skip link e barra superiore ---------- */

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 56px;
}

.brand {
  display: inline-block;
  padding-block: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
}

.nav-list a {
  display: inline-block;
  padding-block: 12px;
  font-size: var(--fs-small);
}

/* ---------- Etichette mono ---------- */

.eyebrow,
.section-index,
.pillar-index,
.case-meta,
.sheet-title,
.sheet-list dt,
.case-fields dt,
.kv-list dt,
.skills dt,
.languages dt,
.tl-years {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ---------- Hero ---------- */

.hero {
  padding-block: 48px var(--section-pad);
}

.hero-grid {
  display: grid;
  gap: 40px;
}

.eyebrow {
  color: var(--text-muted);
}

.hero h1 {
  margin-top: 12px;
  font-size: var(--fs-h1);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.role {
  margin-top: 12px;
  font-size: var(--fs-role);
  font-weight: 500;
  line-height: 1.3;
}

.scope {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-small);
  color: var(--link);
}

.tagline {
  margin-top: 20px;
  max-width: 34ch;
  font-size: var(--fs-tagline);
  line-height: 1.45;
}

.cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: var(--fs-small);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.btn-primary {
  grid-column: 1 / -1;
  background: var(--accent);
  color: var(--on-accent);
  border: 1.5px solid var(--accent);
}

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

.btn-primary:active {
  box-shadow: inset 0 1px 0 rgb(0 0 0 / 0.25);
}

.btn-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  opacity: 0.9;
}

.btn-secondary {
  background: transparent;
  color: var(--link);
  border: 1.5px solid var(--link);
}

.btn-secondary:hover {
  background: var(--surface);
  color: var(--link);
}

.sheet {
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.sheet-title {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.sheet-list > div {
  padding-block: 14px;
}

.sheet-list > div + div {
  border-top: 1px solid var(--border);
}

.sheet-list dt {
  color: var(--text-muted);
}

.sheet-list dd {
  margin-top: 2px;
  font-size: var(--fs-small);
  line-height: 1.5;
}

/* ---------- Sezioni ---------- */

.section {
  padding-block: var(--section-pad);
  scroll-margin-top: 16px;
}

.hero + .section,
.section + .section {
  padding-top: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.section-index {
  color: var(--link);
}

.section-head h2 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.lead {
  max-width: var(--measure);
  margin-top: 16px;
  color: var(--text-muted);
}

.dash-list li {
  position: relative;
  padding-left: 1.1em;
}

.dash-list li + li {
  margin-top: 8px;
}

.dash-list li::before {
  content: "–";
  content: "–" / "";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* Cosa faccio */

.pillars {
  display: grid;
  gap: 40px;
  margin-top: 40px;
}

.pillar {
  scroll-margin-top: 16px;
}

.pillar-index {
  color: var(--link);
}

.pillar h3 {
  margin-top: 4px;
  font-size: var(--fs-h3);
}

.pillar-summary {
  max-width: var(--measure);
  margin-top: 8px;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.pillar .dash-list {
  max-width: var(--measure);
  font-size: var(--fs-small);
}

/* Casi */

.cases {
  display: grid;
  gap: 20px;
  margin-top: 40px;
}

.case {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.case-meta {
  color: var(--text-muted);
}

.case h3 {
  margin-top: 8px;
  font-size: var(--fs-h3);
}

.case-highlight {
  margin-top: 16px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  font-weight: 600;
  line-height: 1.4;
}

.case-fields {
  margin-top: 20px;
  font-size: var(--fs-small);
  line-height: 1.55;
}

.case-fields > div + div {
  margin-top: 14px;
}

.case-fields dt {
  color: var(--text-muted);
}

.case-fields dd {
  margin-top: 2px;
}

/* Competenze */

.skills {
  display: grid;
  gap: 20px;
  margin-top: 40px;
}

.skills dt,
.languages dt,
.kv-list dt {
  color: var(--text-muted);
}

.skills dd {
  margin-top: 4px;
}

.inline-list li {
  display: inline;
}

.inline-list li + li::before {
  content: " · ";
  content: " · " / "";
  color: var(--text-muted);
}

.languages {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.languages dd {
  margin-top: 4px;
}

/* Percorso e Formazione */

.timeline {
  position: relative;
  margin-top: 40px;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 4px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  position: relative;
}

.tl-item + .tl-item {
  margin-top: 40px;
}

.tl-item::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -28px;
  width: 9px;
  height: 9px;
  background: var(--accent);
}

.timeline-education .tl-item::before {
  background: var(--bg);
  border: 2px solid var(--accent);
}

.tl-years {
  color: var(--link);
}

.tl-role h3 {
  margin-top: 4px;
  font-size: var(--fs-h3);
}

.tl-org {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--fs-small);
}

.tl-body {
  margin-top: 12px;
  max-width: var(--measure);
  font-size: var(--fs-small);
}

.tl-body:empty {
  display: none;
}

.tl-body h4 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: var(--fs-small);
  font-weight: 600;
}

.tl-body h4:first-child {
  margin-top: 0;
}

.grade {
  font-weight: 600;
}

/* Oltre il lavoro e Contatti */

.kv-list {
  display: grid;
  gap: 16px;
  margin-top: 32px;
  max-width: var(--measure);
}

.kv-list dd {
  margin-top: 2px;
}

.contact-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  gap: 0;
}

.contact-list > div {
  padding-block: 12px;
}

.contact-list > div + div {
  border-top: 1px solid var(--border);
}

.contact-list a,
.cv-links a {
  display: inline-block;
  padding-block: 4px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 32px 40px;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.site-footer p + p {
  margin-top: 6px;
}

/* ---------- Breakpoint ---------- */

@media (min-width: 768px) {
  .site-header {
    display: block;
  }

  .skills {
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
  }

  .cases {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .cta {
    display: flex;
    flex-wrap: wrap;
  }

  .contact-list > div,
  .kv-list:not(.contact-list) > div {
    display: grid;
    grid-template-columns: 14ch 1fr;
    gap: 16px;
    align-items: baseline;
  }

  .contact-list dd,
  .kv-list dd {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  :root {
    --gutter: 32px;
  }

  .hero {
    padding-top: 96px;
  }

  .hero-grid {
    grid-template-columns: repeat(12, 1fr);
    gap: 32px;
  }

  .hero-main {
    grid-column: 1 / 8;
  }

  .sheet {
    grid-column: 9 / 13;
    padding: 24px;
  }

  .tagline {
    max-width: 36ch;
  }

  .pillars {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  .case {
    padding: 28px;
  }

  .case-fields > div {
    display: grid;
    grid-template-columns: 11ch 1fr;
    gap: 16px;
    align-items: baseline;
  }

  .case-fields dd {
    margin-top: 0;
  }

  .skills {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 32px;
  }

  .skills .inline-list li {
    display: block;
  }

  .skills .inline-list li + li::before {
    content: none;
  }

  .timeline {
    padding-left: 0;
  }

  /* Linea nel gap tra la colonna degli anni (2/12) e quella del ruolo. */
  .timeline::before {
    left: calc((100% - 64px) / 6 + 16px);
  }

  .tl-item {
    display: grid;
    grid-template-columns: 2fr 4fr 6fr;
    gap: 32px;
  }

  .tl-item::before {
    left: calc((100% - 64px) / 6 + 12px);
  }

  .tl-role h3 {
    margin-top: 0;
  }

  .tl-body {
    margin-top: 0;
  }

  .tl-body:empty {
    display: block;
  }
}

/* ---------- Movimento: solo se l'utente non chiede di ridurlo ---------- */

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

  a,
  .btn {
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease, text-decoration-thickness 120ms ease;
  }
}
