/* mattrew.net — foglio di stile
   Colori come variabili: chiaro di base, scuro con il tema del sistema o con il pulsante. */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --line: #e2e0da;
  --line-strong: #c9c6bd;
  --text: #14171a;
  --muted: #59616c;
  --faint: #868d97;
  --accent: #d3301f;
  --accent-soft: rgba(211, 48, 31, 0.09);
  --header-bg: rgba(246, 246, 243, 0.85);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gutter: 24px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0e11;
    --surface: #13171c;
    --line: #222830;
    --line-strong: #343c47;
    --text: #e9edf1;
    --muted: #a0aab5;
    --faint: #6f7884;
    --accent: #ff5242;
    --accent-soft: rgba(255, 82, 66, 0.12);
    --header-bg: rgba(12, 14, 17, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0e11;
  --surface: #13171c;
  --line: #222830;
  --line-strong: #343c47;
  --text: #e9edf1;
  --muted: #a0aab5;
  --faint: #6f7884;
  --accent: #ff5242;
  --accent-soft: rgba(255, 82, 66, 0.12);
  --header-bg: rgba(12, 14, 17, 0.8);
  color-scheme: dark;
}

/* lingua: si vede solo il testo della lingua attiva */
html[lang="it"] [data-l="en"],
html[lang="en"] [data-l="it"] { display: none !important; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
p, ul, ol, dl, dd { margin: 0; padding: 0; }
a { color: inherit; }
b { font-weight: 650; }
svg { display: block; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font: 600 16px/1 var(--mono);
  flex-shrink: 0;
}
.brand-mark { width: 26px; height: 26px; }
.bm-bg { fill: var(--text); }
.bm-m { fill: none; stroke: var(--bg); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.bm-dot { fill: var(--accent); }
.brand-tld { color: var(--faint); font-weight: 400; }

.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 15px;
}
.nav a:hover { color: var(--text); }

.controls { display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--faint);
  font: 600 12px/1 var(--mono);
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
html[lang="it"] .lang-switch [data-set-lang="it"],
html[lang="en"] .lang-switch [data-set-lang="en"] { background: var(--text); color: var(--bg); }

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none !important; }
:root[data-theme="dark"] .i-sun { display: none !important; }
:root[data-theme="dark"] .i-moon { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none !important; }
  :root:not([data-theme="light"]) .i-moon { display: block !important; }
}

/* ---------- presentazione ---------- */
.hero { padding: 88px 0 64px; }

.hero h1 {
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.role {
  margin-top: 14px;
  font: clamp(0.95rem, 1.6vw, 1.05rem)/1.4 var(--mono);
  color: var(--accent);
}
.lead {
  margin-top: 16px;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  color: var(--muted);
}

/* ---------- sezioni ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section h2 {
  margin-bottom: 28px;
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 720;
}

/* esperienza */
.job {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.job h3 { font-size: clamp(1.15rem, 2.2vw, 1.35rem); font-weight: 680; }
.job-org { margin-top: 4px; font: 14px/1.4 var(--mono); color: var(--muted); }

.job-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 28px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.job-list li { font-size: 15px; line-height: 1.45; color: var(--muted); }
.job-list b {
  display: block;
  margin-bottom: 3px;
  font: 600 12px/1.3 var(--mono);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* competenze */
.skills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 28px;
}
.skills dt {
  margin-bottom: 6px;
  font: 600 12px/1.3 var(--mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.skills dd { font-size: 15px; line-height: 1.6; color: var(--muted); }

/* progetti */
.projects {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}
.projects li { padding: 18px 0; border-top: 1px solid var(--line); }
.projects h3 { font-size: 17px; font-weight: 680; }
.projects p { margin-top: 4px; font-size: 15px; line-height: 1.5; color: var(--muted); }

/* contatti */
.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
}
.contact-mail {
  font: 600 clamp(1.15rem, 3.4vw, 1.9rem)/1.2 var(--mono);
  letter-spacing: -0.02em;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  overflow-wrap: anywhere;
}
.contact-mail:hover { color: var(--accent); }
.contact-meta { font: 14px/1.4 var(--mono); color: var(--faint); }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 36px; }
.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font: 13px/1.4 var(--mono);
  color: var(--faint);
}
.footer-row a { text-decoration: none; }
.footer-row a:hover { color: var(--text); }

/* ---------- pagina 404 ---------- */
.nosignal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px 16px;
}
.bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: min(420px, 100%);
  height: 140px;
  margin: 0 auto 32px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bars span:nth-child(1) { background: #c0c0c0; }
.bars span:nth-child(2) { background: #c0c000; }
.bars span:nth-child(3) { background: #00c0c0; }
.bars span:nth-child(4) { background: #00c000; }
.bars span:nth-child(5) { background: #c000c0; }
.bars span:nth-child(6) { background: #c00000; }
.bars span:nth-child(7) { background: #0000c0; }
.nosignal h1 { font: 700 clamp(2rem, 6vw, 3rem)/1.1 var(--mono); letter-spacing: -0.03em; }
.nosignal p { margin-top: 12px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  height: 44px;
  margin-top: 28px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
}
.btn:hover { background: var(--accent); color: #fff; }

/* ---------- schermi più piccoli ---------- */
@media (max-width: 900px) {
  .nav { display: none; }
  .controls { margin-left: auto; }
  .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .job-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .hero { padding: 56px 0 48px; }

  .section { padding: 48px 0; }
  .section h2 { margin-bottom: 20px; }
  .job { padding: 20px; }
  .job-list { grid-template-columns: 1fr; gap: 14px; }
  .skills { grid-template-columns: 1fr; gap: 18px; }
  .projects { grid-template-columns: 1fr; }
  .footer-row { flex-direction: column; }
}

@media (max-width: 380px) {
  .brand-tld { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ---------- stampa ---------- */
@media print {
  :root,
  :root[data-theme="dark"],
  :root:not([data-theme="light"]) {
    --bg: #ffffff;
    --surface: #ffffff;
    --line: #d9d9d9;
    --text: #111111;
    --muted: #333333;
    --faint: #666666;
    --accent: #c2261a;
    --accent-soft: transparent;
    color-scheme: light;
  }
  @page { margin: 14mm; }
  body { font-size: 10.5pt; }
  .site-header, .footer-row a { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .hero { padding: 0 0 12pt; }
  .hero h1 { font-size: 26pt; }
  .section { padding: 12pt 0; }
  .section h2 { margin-bottom: 8pt; font-size: 15pt; }
  .job { padding: 10pt 12pt; }
  .job-list { grid-template-columns: repeat(3, 1fr); }
  .skills { grid-template-columns: repeat(4, 1fr); }
  .projects { grid-template-columns: repeat(2, 1fr); }
  .projects li { padding: 7pt 0; break-inside: avoid; }
  .contact-mail { font-size: 13pt; border: 0; }
  .site-footer { border: 0; }
  a { text-decoration: none; }
}
