/* =========================================================
   Luca Antonini — antoniniluca.it
   Palette sobria, un solo accento. Light + dark.
   ========================================================= */

:root {
  --bg:        #fbfbfa;
  --bg-panel:  #ffffff;
  --bg-subtle: #f2f2f0;
  --text:      #1b1b1a;
  --text-dim:  #5c5c58;
  --text-mute: #8a8a84;
  --line:      #e2e2de;
  --line-soft: #ecebe7;
  --accent:    #0f6d68;
  --accent-dim:#0f6d6812;
  --accent-txt:#0b5551;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 60rem;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #121413;
    --bg-panel:  #1a1d1c;
    --bg-subtle: #1f2322;
    --text:      #e8e8e4;
    --text-dim:  #a6a8a3;
    --text-mute: #7b7e79;
    --line:      #2b2f2e;
    --line-soft: #232625;
    --accent:    #4ec9bf;
    --accent-dim:#4ec9bf14;
    --accent-txt:#6fd8cf;
  }
}

:root[data-theme="dark"] {
  --bg:        #121413;
  --bg-panel:  #1a1d1c;
  --bg-subtle: #1f2322;
  --text:      #e8e8e4;
  --text-dim:  #a6a8a3;
  --text-mute: #7b7e79;
  --line:      #2b2f2e;
  --line-soft: #232625;
  --accent:    #4ec9bf;
  --accent-dim:#4ec9bf14;
  --accent-txt:#6fd8cf;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.5rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

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

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 3.5rem;
}
.topbar__name {
  font-weight: 600; text-decoration: none; letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar__nav {
  display: flex; gap: 1.1rem; margin-inline-start: auto;
  font-size: .875rem;
}
.topbar__nav a {
  color: var(--text-dim); text-decoration: none;
  padding: .2rem 0; border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.topbar__nav a:hover { color: var(--text); border-bottom-color: var(--accent); }
.topbar__nav a.is-active { color: var(--text); border-bottom-color: var(--accent); }

.topbar__tools { display: flex; align-items: center; gap: .5rem; margin-inline-start: auto; }
.topbar__nav + .topbar__tools { margin-inline-start: 0; }

.langswitch {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.langswitch button {
  font: 600 .72rem/1 var(--mono); letter-spacing: .04em;
  padding: .42rem .5rem; border: 0; background: transparent; color: var(--text-mute);
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.langswitch button:hover { color: var(--text); }
.langswitch button[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .langswitch button[aria-pressed="true"] { color: #0d1211; }
}
:root[data-theme="dark"] .langswitch button[aria-pressed="true"] { color: #0d1211; }

.iconbtn {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--text-dim); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.iconbtn:hover { color: var(--text); border-color: var(--text-mute); }
.ico-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ico-sun  { display: none; }
  :root:not([data-theme="light"]) .ico-moon { display: block; }
}
:root[data-theme="dark"] .ico-sun  { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }
:root[data-theme="light"] .ico-sun { display: block; }
:root[data-theme="light"] .ico-moon { display: none; }

/* =========================================================
   Hero
   ========================================================= */
.hero { padding: 5rem 1.5rem 3.5rem; }

.eyebrow {
  font: 500 .75rem/1 var(--mono);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-txt);
  margin-bottom: 1.1rem;
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.25rem);
  letter-spacing: -0.035em;
  margin-bottom: 1.1rem;
}

.hero__lead {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-dim);
  max-width: 34em;
  line-height: 1.55;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  font: 500 .9rem/1 var(--font);
  padding: .72rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-txt); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--primary { color: #0d1211; }
}
:root[data-theme="dark"] .btn--primary { color: #0d1211; }
.btn--ghost { border-color: var(--line); color: var(--text-dim); background: transparent; }
.btn--ghost:hover { border-color: var(--text-mute); color: var(--text); }

/* =========================================================
   Sections
   ========================================================= */
.section { padding-block: 3.25rem; border-top: 1px solid var(--line-soft); }
.section:first-of-type { border-top: 0; }

.section__title {
  display: flex; align-items: baseline; gap: .85rem;
  font-size: 1.05rem;
  letter-spacing: .01em;
  margin-bottom: 2rem;
}
.section__num {
  font: 500 .78rem/1 var(--mono);
  color: var(--accent-txt);
  letter-spacing: .06em;
}

.prose { color: var(--text-dim); max-width: 42em; }
.prose em { color: var(--text); font-style: normal; font-weight: 500; }

/* =========================================================
   Timeline entries
   ========================================================= */
.timeline { display: flex; flex-direction: column; gap: 2.5rem; }

.entry { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.5rem; }

.entry__date {
  font: 500 .78rem/1.5 var(--mono);
  color: var(--text-mute);
  letter-spacing: .01em;
  padding-top: .2rem;
  white-space: nowrap;
}

.entry__body { position: relative; padding-left: 1.5rem; border-left: 1px solid var(--line); }
.entry__body::before {
  content: ""; position: absolute; left: -4.5px; top: .55rem;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}

.entry__role { font-size: 1.12rem; margin-bottom: .2rem; }
.entry__org { color: var(--text); font-weight: 500; font-size: .95rem; margin-bottom: .55rem; }
.entry__client { font-size: .875rem; color: var(--text-dim); margin-bottom: .85rem; }
.entry__summary { color: var(--text-dim); margin-bottom: .9rem; max-width: 44em; }

.sep { color: var(--text-mute); margin-inline: .15rem; }

.label {
  display: inline-block;
  font: 500 .68rem/1 var(--mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
  margin-right: .5rem;
}

.entry__list { display: flex; flex-direction: column; gap: .5rem; max-width: 44em; }
.entry__list li {
  position: relative; padding-left: 1.15rem;
  color: var(--text-dim); font-size: .95rem;
}
.entry__list li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 5px; height: 1px; background: var(--accent);
}
.entry__list strong { color: var(--text); font-weight: 600; }

/* ---------- tags ---------- */
.stack { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: 1.1rem; }
.stack .label { margin-right: .25rem; }
.tag {
  font: 500 .75rem/1 var(--mono);
  padding: .35rem .55rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--text-dim);
  white-space: nowrap;
}
.stack--lg { margin-top: 0; }

/* =========================================================
   Project cards
   ========================================================= */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: 1.25rem; }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color .15s ease;
}
.card:hover { border-color: var(--text-mute); }
.card__title { font-size: 1.1rem; margin-bottom: .15rem; }
.card__org { font: 500 .78rem/1 var(--mono); color: var(--text-mute); margin-bottom: .9rem; }
.card__body { color: var(--text-dim); font-size: .95rem; }
.card__link {
  display: inline-flex; align-items: center; gap: .35rem;
  margin-top: 1.2rem;
  font-size: .875rem; font-weight: 500;
  color: var(--accent-txt); text-decoration: none;
  border-bottom: 1px solid transparent;
}
.card__link:hover { border-bottom-color: currentColor; }

/* =========================================================
   Skills grid
   ========================================================= */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.25rem; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
}
.panel--wide { grid-column: 1 / -1; }
.panel__title {
  font: 500 .72rem/1 var(--mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 1.1rem;
}

.levels { display: flex; flex-direction: column; gap: .95rem; }
.levels li { display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; align-items: baseline; }
.levels__name { grid-area: 1 / 1; font-size: .95rem; font-weight: 500; }
.levels__val { grid-area: 1 / 2; font: 500 .75rem/1 var(--mono); color: var(--text-mute); }
.levels__bar {
  grid-area: 2 / 1 / 3 / -1;
  display: block; height: 3px; border-radius: 2px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.levels__bar i { display: block; height: 100%; width: var(--v); background: var(--accent); border-radius: 2px; }

.bullets { display: flex; flex-direction: column; gap: .55rem; }
.bullets li { position: relative; padding-left: 1.15rem; font-size: .95rem; color: var(--text-dim); }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 5px; height: 1px; background: var(--accent);
}

/* =========================================================
   Contact + footer
   ========================================================= */
.section--contact { padding-bottom: 4rem; }

/* ---------- form ---------- */
.form { margin-top: 2rem; max-width: 40rem; display: flex; flex-direction: column; gap: 1.1rem; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label {
  font: 500 .72rem/1 var(--mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-mute);
}
.field input,
.field textarea {
  font: 400 .95rem/1.5 var(--font);
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .85rem;
  width: 100%;
  transition: border-color .15s ease, background .15s ease;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:hover, .field textarea:hover { border-color: var(--text-mute); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field.is-invalid input,
.field.is-invalid textarea { border-color: #c0392b; }
:root[data-theme="dark"] .field.is-invalid input,
:root[data-theme="dark"] .field.is-invalid textarea { border-color: #e07a6c; }
.field__error { font-size: .8rem; color: #c0392b; min-height: 0; }
:root[data-theme="dark"] .field__error { color: #e07a6c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field.is-invalid input,
  :root:not([data-theme="light"]) .field.is-invalid textarea { border-color: #e07a6c; }
  :root:not([data-theme="light"]) .field__error { color: #e07a6c; }
}

/* honeypot: fuori dallo schermo, invisibile ma non display:none */
.hp {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}

.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form__foot .btn:disabled { opacity: .55; cursor: progress; }

.form__status { font-size: .9rem; color: var(--text-dim); }
.form__status.is-ok { color: var(--accent-txt); font-weight: 500; }
.form__status.is-err { color: #c0392b; }
:root[data-theme="dark"] .form__status.is-err { color: #e07a6c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form__status.is-err { color: #e07a6c; }
}

.form__privacy { font-size: .8rem; color: var(--text-mute); max-width: 40em; }

@media (max-width: 34rem) {
  .form__row { grid-template-columns: 1fr; }
}

.footer { border-top: 1px solid var(--line-soft); padding-block: 2rem; }
.footer__inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
  font-size: .8rem; color: var(--text-mute);
}

/* =========================================================
   Reveal on scroll
   ========================================================= */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 46rem) {
  .topbar__nav { display: none; }
  .hero { padding-top: 3.5rem; }
  .entry { grid-template-columns: 1fr; gap: .6rem; }
  .entry__date { padding-top: 0; }
  .entry__body { padding-left: 1.15rem; }
}

/* =========================================================
   Print — la pagina è il CV
   ========================================================= */
@media print {
  :root {
    --bg: #fff; --bg-panel: #fff; --bg-subtle: #eee;
    --text: #000; --text-dim: #222; --text-mute: #555;
    --line: #bbb; --line-soft: #ddd;
    --accent: #000; --accent-txt: #000; --accent-dim: transparent;
  }
  .topbar, .footer__note, .hero__actions, .skip-link, .form { display: none !important; }
  body { font-size: 10.5pt; line-height: 1.45; }
  .wrap { max-width: none; padding-inline: 0; }
  .hero { padding: 0 0 1rem; }
  .hero h1 { font-size: 24pt; }
  .hero__lead { font-size: 11pt; }
  .section { padding-block: .9rem; border-top: 1px solid #ddd; }
  .section__title { margin-bottom: .8rem; break-after: avoid; }
  .entry, .card, .panel { break-inside: avoid; }
  .grid, .cards { gap: .8rem; }
  .timeline { gap: 1.1rem; }
  .card, .panel { border-color: #ccc; padding: .8rem 1rem; }
  .tag { background: none; border-color: #ccc; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a { text-decoration: none; }
  .card__link::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
}
