/* =========================================================
   Eros Orlando — personal site
   Palette: nebbia (mist) / inchiostro (navy ink) / rosa saline / mare
   Type:    IBM Plex Sans + Plex Sans Condensed (headlines) + Plex Mono (code only)
   ========================================================= */

@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Sans"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Condensed"; src: url("../fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --bg: #EDF1F5;        /* nebbia */
  --surface: #F8FAFC;
  --ink: #13233A;       /* inchiostro */
  --muted: #4D5D73;
  --line: #C6D0DC;
  --rose: #B23A60;      /* saline di Trapani al tramonto */
  --rose-soft: #F3DCE4;
  --sea: #1B6770;       /* link */
  --code-bg: #E2E8EF;

  --sans: "Plex Sans", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "Plex Condensed", "IBM Plex Sans Condensed", "Arial Narrow", var(--sans);
  --mono: "Plex Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.125rem;
  --step-name: clamp(3rem, 4.2vw + 1rem, 4.75rem);

  --gutter: 16px;
  --radius-s: 4px;
  --radius-m: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1B2B; --surface: #16253A; --ink: #E4E9F0; --muted: #9DABBD; --line: #2B3C53;
    --rose: #F07E9F; --rose-soft: #3A2333; --sea: #74C7CC; --code-bg: #142235;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1B2B; --surface: #16253A; --ink: #E4E9F0; --muted: #9DABBD; --line: #2B3C53;
  --rose: #F07E9F; --rose-soft: #3A2333; --sea: #74C7CC; --code-bg: #142235;
  color-scheme: dark;
}

/* ---------- lingua ---------- */
html[data-lang="it"] body [lang="en"],
html[data-lang="en"] body [lang="it"] { display: none !important; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sea); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--rose); }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }

[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--gutter); top: -100px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 10; border-radius: var(--radius-s); }
.skip:focus { top: 12px; }

/* ---------- layout ---------- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (min-width: 1024px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
    gap: 72px;
    padding: 0 48px;
  }
}

/* ---------- masthead (colonna sinistra) ---------- */
.masthead { padding: 40px 0 8px; }
@media (min-width: 1024px) {
  .masthead {
    position: sticky; top: 0; align-self: start;
    height: 100vh; max-height: 100vh;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 72px 0 48px;
  }
}

.switches { display: flex; gap: 4px; margin-bottom: 40px; }
.switch {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  min-width: 40px; height: 32px; padding: 0 10px; border-radius: var(--radius-s);
  font-size: var(--step--1); font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.switch[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.switch:hover { border-color: var(--ink); color: var(--ink); }
.switch[aria-pressed="true"]:hover { color: var(--bg); }
.switch--theme { margin-left: 8px; }

.name {
  font-family: var(--cond);
  font-weight: 600;
  font-size: var(--step-name);
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.name a { color: var(--ink); text-decoration: none; }
.name a:hover { color: var(--ink); }

.role {
  margin: 20px 0 0;
  font-size: var(--step-1);
  font-weight: 500;
  line-height: 1.35;
  max-width: 22ch;
}
.lede { margin: 16px 0 0; color: var(--muted); max-width: 36ch; }

.toc { display: none; }
@media (min-width: 1024px) {
  .toc { display: block; margin-top: 48px; }
  .toc ul { list-style: none; }
  .toc a {
    display: flex; align-items: center; gap: 14px;
    padding: 7px 0;
    color: var(--muted); text-decoration: none;
    font-size: var(--step--1); font-weight: 500;
  }
  .toc a::before {
    content: ""; height: 1px; width: 28px; background: currentColor;
    transition: width .2s ease, background-color .2s ease;
  }
  .toc a:hover, .toc a.is-active { color: var(--ink); }
  .toc a.is-active::before { width: 56px; background: var(--rose); height: 2px; }
}

.masthead__bottom { margin-top: 28px; }
.links { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: var(--step--1); font-weight: 500; }
.links a, .linkish { color: var(--ink); }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em;
}
.linkish:hover { color: var(--rose); }
.where { margin: 12px 0 0; font-size: var(--step--1); color: var(--muted); }

/* ---------- contenuto (colonna destra) ---------- */
.content { padding: 24px 0 64px; min-width: 0; }
@media (min-width: 1024px) { .content { padding: 72px 0 64px; } }

.section { padding: 40px 0 48px; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; padding-top: 8px; }
.section__title {
  font-family: var(--cond);
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 20px;
}
.section__intro { color: var(--muted); max-width: 62ch; }

.prose { max-width: 64ch; }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Dal canale al core (l'elemento memorabile) ---------- */
.flow {
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.flow__end {
  font-size: var(--step--1); color: var(--muted); font-weight: 500;
  padding-left: 22px; position: relative;
}
.flow__end::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 9px; height: 9px;
  transform: translateY(-50%); border-radius: 50%; border: 2px solid var(--muted);
}
.flow__layers { list-style: none; position: relative; margin: 10px 0; }
.flow__layers::before {
  content: ""; position: absolute; left: 8px; top: -10px; bottom: -10px; width: 2px; background: var(--line);
}
.flow__layers li { position: relative; padding: 4px 0 4px 26px; }
.layer {
  width: 100%;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  text-align: left; cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  transition: border-color .15s ease, background-color .15s ease;
}
.layer::before {
  content: ""; position: absolute; left: 4px; top: 50%; width: 10px; height: 10px;
  transform: translateY(-50%); border-radius: 50%; background: var(--bg); border: 2px solid var(--line);
}
.layer__name { font-family: var(--cond); font-weight: 600; font-size: var(--step-1); }
.layer__sub { font-size: var(--step--1); color: var(--muted); }
.layer:hover { border-color: var(--ink); }
.layer[aria-pressed="true"] { border-color: var(--rose); background: var(--rose-soft); }
.layer[aria-pressed="true"]::before { background: var(--rose); border-color: var(--rose); }
.layer[aria-pressed="true"] .layer__sub { color: var(--ink); }

@media (min-width: 640px) {
  .flow { grid-template-columns: 1fr 1fr; grid-template-areas: "start end" "layers layers"; row-gap: 8px; }
  .flow__end { padding: 0; }
  .flow__end::before { display: none; }
  .flow__end--start { grid-area: start; }
  .flow__end--end { grid-area: end; text-align: right; }
  .flow__end--start::after { content: " \2192"; }
  .flow__end--end::before { content: "\2192\00a0"; display: inline; position: static; border: 0; width: auto; height: auto; transform: none; }
  .flow__layers {
    grid-area: layers;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0;
  }
  .flow__layers::before { left: 0; right: 0; top: 50%; bottom: auto; width: auto; height: 2px; }
  .flow__layers li { padding: 0; display: flex; }
  .layer {
    flex: 1; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 14px 12px; min-height: 84px; justify-content: center;
  }
  .layer__sub { font-size: 0.8125rem; line-height: 1.35; }
  .layer::before { display: none; }
  .layer[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--rose); }
}

.flow-panel {
  margin-top: 20px;
  padding: 24px 0 0;
  border-top: 2px solid var(--rose);
  max-width: 64ch;
}
.layer-detail h3 { font-family: var(--cond); font-size: var(--step-2); font-weight: 600; margin-bottom: 10px; }
.layer-detail .stack {
  font-family: var(--mono); font-size: 0.875rem; line-height: 1.6;
  background: var(--code-bg); padding: 10px 12px; border-radius: var(--radius-s);
}
.where-done { margin: 0; font-size: var(--step--1); color: var(--muted); }
.layer-detail.is-entering { animation: detail-in .28s ease-out; }
@keyframes detail-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- esperienza ---------- */
.jobs { list-style: none; }
.job {
  display: grid; grid-template-columns: 1fr; gap: 4px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 24px;
}
.job:first-child { padding-top: 0; }
.job:last-child { border-bottom: 0; }
@media (min-width: 720px) { .job { grid-template-columns: 9.5rem 1fr; gap: 24px; } }
.job__when { margin: 3px 0 0; font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.job__title { font-size: var(--step-1); font-weight: 600; line-height: 1.3; margin-bottom: 10px; }
.job__org { display: block; font-weight: 400; color: var(--muted); font-size: var(--step-0); }
.job ul { list-style: none; max-width: 62ch; }
.job ul li { position: relative; padding-left: 18px; margin-bottom: 6px; }
.job ul li::before { content: ""; position: absolute; left: 0; top: 0.75em; width: 8px; height: 1px; background: var(--muted); }
.tags { margin: 12px 0 0; font-size: var(--step--1); color: var(--muted); }
.job:target { background: linear-gradient(90deg, var(--rose-soft), transparent 70%); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: var(--radius-s); }

/* ---------- formazione ---------- */
.edu { list-style: none; }
.edu li { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.edu li:first-child { padding-top: 0; }
@media (min-width: 720px) { .edu li { grid-template-columns: 9.5rem 1fr; gap: 24px; } }
.edu__when { margin: 2px 0 0; font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.edu h3 { font-size: var(--step-0); font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
.edu li p:last-child { margin: 0; color: var(--muted); }
.languages { margin: 20px 0 0; color: var(--muted); }

/* ---------- oltre la banca ---------- */
.topics { display: grid; gap: 28px; margin-top: 28px; }
@media (min-width: 720px) { .topics { grid-template-columns: 1fr 1fr; gap: 32px 40px; } }
.topic h3 { font-size: var(--step-1); font-weight: 600; margin-bottom: 8px; }
.topic p { margin: 0; }

.config { margin: 40px 0 0; }
.config figcaption { font-size: var(--step--1); color: var(--muted); margin-bottom: 8px; }
.config pre {
  margin: 0; overflow-x: auto;
  background: var(--code-bg); border-left: 3px solid var(--sea);
  padding: 18px 20px; border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font: 400 0.875rem/1.7 var(--mono);
  tab-size: 2;
}
.config .k { color: var(--sea); }

/* ---------- adesso ---------- */
.now { margin: 24px 0 0; }
.now div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 720px) { .now div { grid-template-columns: 9.5rem 1fr; gap: 24px; } }
.now dt { font-weight: 600; }
.now dd { margin: 0; max-width: 60ch; }

/* ---------- contatti ---------- */
.contact__text { max-width: 58ch; font-size: var(--step-1); line-height: 1.5; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.button {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-s); border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg);
  font-weight: 500; text-decoration: none; cursor: pointer; font-size: var(--step-0);
}
.button:hover { background: var(--rose); border-color: var(--rose); color: #fff; }
.button--quiet { background: transparent; color: var(--ink); }
.button--quiet:hover { background: transparent; color: var(--rose); border-color: var(--rose); }

.footer { padding-top: 32px; border-top: 1px solid var(--line); font-size: var(--step--1); color: var(--muted); }
.footer p { margin: 0 0 4px; }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: grid; place-content: center; padding: 32px var(--gutter); max-width: 40rem; margin: 0 auto; }
.notfound h1 { font-family: var(--cond); font-size: var(--step-name); line-height: 1; margin-bottom: 16px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- stampa: il sito diventa un CV ---------- */
@media print {
  @page { size: A4; margin: 16mm 16mm 18mm; }
  :root { --bg: #fff; --surface: #fff; --ink: #111827; --muted: #4B5563; --line: #D1D5DB; --rose: #9F2F52; --sea: #1B6770; --code-bg: #F3F4F6; }
  body { font-size: 10pt; line-height: 1.45; background: #fff; }
  .shell { display: block; max-width: none; padding: 0; }
  .masthead { position: static; height: auto; padding: 0 0 10pt; border-bottom: 1.5pt solid var(--ink); }
  .switches, .toc, .linkish, .skip, .section__intro, #architettura, .config, #adesso, .contact__actions, .contact__text, .footer, .where-done { display: none !important; }
  .name { font-size: 26pt; }
  .name br { display: none; }
  .role { font-size: 12pt; max-width: none; margin-top: 4pt; }
  .lede { max-width: none; margin-top: 4pt; }
  .masthead__bottom { margin-top: 6pt; }
  .links a[href*="TODO"] { display: none; }
  .links a::after { content: " (" attr(href) ")"; color: var(--muted); font-weight: 400; }
  .links a[href^="#"]::after { content: ""; }
  .links a.js-mail::after { content: ": " attr(data-addr); }
  #contatti { display: none !important; }
  .content { padding: 0; }
  .section { padding: 12pt 0 4pt; border-top: 0; break-inside: auto; }
  .section__title { font-size: 14pt; margin-bottom: 6pt; border-bottom: 0.75pt solid var(--line); padding-bottom: 2pt; }
  .job, .edu li { padding: 6pt 0; break-inside: avoid; grid-template-columns: 7.5rem 1fr; gap: 12pt; display: grid; }
  .job__title { font-size: 11pt; margin-bottom: 3pt; }
  .job__org { display: inline; font-size: 11pt; }
  .job__org::before { content: "— "; }
  .topics { grid-template-columns: 1fr 1fr; gap: 8pt 16pt; margin-top: 6pt; }
  .topic h3, .edu h3 { font-size: 10.5pt; margin-bottom: 2pt; }
  .section--contact .section__title { display: none; }
  a { color: inherit; text-decoration: none; }
}
