/* Amedeo Carraro — site styles. No build step, no external fonts. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #15181c;
  --muted: #5d6570;
  --line: #e4e1d9;
  --accent: #0f5f59;
  --accent-soft: #e2efec;
  --on-accent: #ffffff;
  --accent-2: #2f6fd6;
  --shadow: 0 14px 32px -20px rgba(20, 40, 50, .45);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101316;
    --surface: #171b20;
    --ink: #e9ecef;
    --muted: #9aa3ad;
    --line: #272d35;
    --accent: #5fd0c4;
    --accent-soft: #15302d;
    --on-accent: #06211f;
    --accent-2: #8ab4ff;
    --shadow: 0 16px 36px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101316;
  --surface: #171b20;
  --ink: #e9ecef;
  --muted: #9aa3ad;
  --line: #272d35;
  --accent: #5fd0c4;
  --accent-soft: #15302d;
  --on-accent: #06211f;
  --accent-2: #8ab4ff;
  --shadow: 0 16px 36px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  overflow-x: clip; /* the hero background is wider than the page */
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 22px; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
@media (min-width: 641px) {
  .site-header {
    position: sticky; top: 0; z-index: 30;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: saturate(1.3) blur(12px); backdrop-filter: saturate(1.3) blur(12px);
  }
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 14px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .01em; margin-right: auto; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: 7px; font-size: 15px;
  transition: color .2s ease, background-color .2s ease;
}
.site-nav a span { font: 12px var(--mono); margin-right: 5px; opacity: .8; }
.site-nav a:hover { color: var(--ink); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* ---------- hero / page titles ---------- */
.hero {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 26px 40px; align-items: center; align-content: center;
  min-height: min(76vh, 620px); padding: 64px 0 40px;
}
.hero-text { min-width: 0; }
.eyebrow { font: 13px var(--mono); color: var(--accent); margin: 0 0 10px; letter-spacing: .02em; }
h1 { font-size: clamp(34px, 6.4vw, 50px); line-height: 1.05; letter-spacing: -.02em; margin: 0 0 16px; }
.hero h1 { font-size: clamp(40px, 8vw, 62px); margin-bottom: 18px; }
.statement { font-size: clamp(21px, 3.5vw, 27px); line-height: 1.28; font-weight: 650; letter-spacing: -.012em; margin: 0 0 12px; max-width: 26ch; }
.statement em {
  font-style: normal; color: var(--accent);
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lead { font-size: 17px; line-height: 1.6; margin: 0 0 22px; max-width: 56ch; color: var(--muted); }
.portrait-ring { position: relative; width: 176px; height: 176px; border-radius: 50%; flex: none; }
.portrait-ring::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-2), var(--accent-soft), var(--accent)); animation: turn 16s linear infinite;
}
.portrait-ring::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; background: var(--bg); }
.portrait { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.links a {
  display: inline-block; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 600;
  transition: transform .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.links a:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.links a.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.links a.primary:hover { filter: brightness(1.08); color: var(--on-accent); }

.page-title { position: relative; isolation: isolate; padding: 58px 0 18px; }
.page-title h1 { font-size: clamp(30px, 5.4vw, 42px); margin-bottom: 12px; }
.page-title p { color: var(--muted); margin: 0; max-width: 62ch; }

/* ---------- sections ---------- */
section.block { padding: 30px 0 6px; }
h2 {
  font: 600 13px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
h3 { font-size: 19px; line-height: 1.3; margin: 0; }
h4 { font-size: 15.5px; margin: 0 0 3px; }
p { margin: 0 0 12px; }
ul { margin: 0 0 12px; padding-left: 20px; }
li { margin-bottom: 6px; }

/* timeline-like entries: date column + content */
.entry { position: relative; display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 6px 26px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.entry::before {
  content: ""; position: absolute; left: 157px; top: 35px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.entry::after { content: ""; position: absolute; left: 160.5px; top: 54px; bottom: 6px; width: 1px; background: var(--line); }
.entry:last-child { border-bottom: 0; }
.when { font: 13px/1.5 var(--mono); color: var(--muted); padding-top: 4px; }
.when span { display: block; }
.org { color: var(--muted); margin: 2px 0 12px; }
.org a { color: inherit; }
@media (max-width: 640px) {
  .site-nav { order: 3; width: 100%; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 22px 0; }
  .entry::before, .entry::after { display: none; }
  .when span { display: inline; }
  .when span::before { content: " · "; }
  .hero { grid-template-columns: minmax(0, 1fr); min-height: 0; padding: 40px 0 30px; }
  .portrait-ring { order: -1; width: 104px; height: 104px; }
}

/* systems inside a role */
.systems { display: grid; gap: 10px; margin: 16px 0 4px; }
.system { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; }
.system, .project { position: relative; display: grid; grid-template-columns: 132px minmax(0, 1fr); column-gap: 18px; align-items: start; transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.system > *, .project > * { grid-column: 2; position: relative; z-index: 1; }
.system > .fig, .project > .fig { grid-column: 1; grid-row: 1 / span 6; }
.system:hover, .project:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
/* a soft light that follows the pointer; site.js sets --mx and --my */
.system::after, .project::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s ease;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%);
}
.system:hover::after, .project:hover::after { opacity: 1; }
.system h4 { display: flex; gap: 10px; align-items: baseline; }
.system h4::before { content: attr(data-n); font: 12px var(--mono); color: var(--accent); }
.system p { margin: 0 0 8px; }
.status { font: 500 11px var(--mono); color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; animation: pulse 1.8s ease-in-out infinite; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 8px 0 0; padding: 0; }
.tags li { font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; margin: 0; background: var(--bg); }

/* projects */
.project { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px 14px; margin-top: 14px; }
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 6px; }
.project-head h3 { margin-right: auto; }
.project-head a { font: 13px var(--mono); white-space: nowrap; }
.context { font: 13px var(--mono); color: var(--muted); margin: 0 0 8px; }
.result { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 10px 0; }

/* definition-style rows (education, certifications, skills) */
.rows { margin: 0; }
.rows > div { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 4px 26px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.rows > div:last-child { border-bottom: 0; }
.rows dt { font: 13px/1.5 var(--mono); color: var(--muted); padding-top: 3px; }
.rows dd { margin: 0; }
.rows dd p:last-child, .rows dd ul:last-child { margin-bottom: 0; }
.rows strong { font-weight: 650; }
@media (max-width: 640px) { .rows > div { grid-template-columns: minmax(0, 1fr); } }

.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.note { color: var(--muted); font-size: 14.5px; padding: 18px 0 0; }

/* ---------- hero background, numbers, figures ---------- */
/* soft colours drifting behind the top of each page, as wide as the window */
.band-bg {
  position: absolute; z-index: -1; top: 0; bottom: 0; left: calc(50% - 50vw); width: 100vw; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent);
}
.band-bg::before {
  content: ""; position: absolute; inset: 0; opacity: .55;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 42%, transparent) 1px, transparent 1.2px); background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(90% 100% at 30% 0%, #000, transparent 75%); mask-image: radial-gradient(90% 100% at 30% 0%, #000, transparent 75%);
}
.band-bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .2; animation: drift 24s ease-in-out infinite alternate; }
.band-bg i:nth-child(1) { width: 440px; height: 440px; left: 6%; top: -230px; background: var(--accent); }
.band-bg i:nth-child(2) { width: 380px; height: 380px; right: 4%; top: -60px; background: var(--accent-2); animation-duration: 30s; animation-delay: -8s; }
.band-bg i:nth-child(3) { width: 320px; height: 320px; left: 42%; top: 46%; background: var(--accent); opacity: .12; animation-duration: 36s; animation-delay: -14s; }

.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 6px 0 0; padding: 0; list-style: none; }
.stats li {
  margin: 0; padding: 14px 16px 13px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stats b {
  display: block; font-size: clamp(21px, 5.6vw, 30px); line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--accent);
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.stats span { display: block; margin-top: 5px; font-size: 13.5px; line-height: 1.35; color: var(--muted); }
@media (max-width: 640px) {
  .stats { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .stats li { display: flex; align-items: baseline; gap: 14px; padding: 11px 14px; }
  .stats b { flex: none; min-width: 92px; font-size: 22px; }
  .stats span { margin: 0; }
}

/* small drawings next to each system and project; classes: s line, k thick line,
   d faint detail, f tinted shape, p neutral shape, a solid mark, box dashed outline */
.fig {
  margin: 2px 0 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; color: var(--accent);
  background: radial-gradient(130% 110% at 0% 0%, var(--accent-soft), transparent 72%), var(--bg);
}
.fig svg { display: block; width: 100%; height: auto; }
.fig .s { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.fig .k { stroke-width: 6; }
.fig .d { fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.fig .f { fill: var(--accent-soft); stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.fig .p { fill: var(--surface); stroke: color-mix(in srgb, var(--muted) 55%, var(--line)); stroke-width: 1.3; stroke-linejoin: round; }
.fig .a { fill: currentColor; }
.fig .box { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 4 3.5; stroke-linecap: round; }
/* site.js adds "draw" once it has measured the lines, then "in" when the drawing is on screen */
.fig.draw .s { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.2s ease .1s; }
.fig.draw.in .s { stroke-dashoffset: 0; }
.fig.draw .d, .fig.draw .f, .fig.draw .p, .fig.draw .a, .fig.draw .box { opacity: 0; transition: opacity .7s ease .35s; }
.fig.draw.in .f, .fig.draw.in .p, .fig.draw.in .a, .fig.draw.in .box { opacity: 1; }
.fig.draw.in .d { opacity: .5; }
.fig .wave rect { transform-box: fill-box; transform-origin: 50% 50%; animation: wave 1.5s ease-in-out infinite; }
.fig .wave rect:nth-child(2n) { animation-delay: -.5s; }
.fig .wave rect:nth-child(3n) { animation-delay: -.9s; }
.fig .leds circle { animation: pulse 1.6s ease-in-out infinite; }
.fig .leds circle:nth-child(2) { animation-delay: -.5s; }
.fig .leds circle:nth-child(3) { animation-delay: -1s; }
@media (max-width: 560px) {
  .system, .project { grid-template-columns: minmax(0, 1fr); }
  .system > *, .project > * { grid-column: 1; }
  .system > .fig, .project > .fig { grid-row: auto; height: 112px; margin-bottom: 10px; }
  .fig svg { width: auto; height: 100%; margin: 0 auto; }
}

/* ---------- movement ---------- */
.progress { position: fixed; z-index: 35; top: 0; left: 0; right: 0; height: 2px; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
/* site.js gives "reveal" to what is still below the window, then "in" when it comes up */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.hero-text > *, .portrait-ring, .stats li, .page-title > :not(.band-bg) { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.hero-text > :nth-child(2) { animation-delay: .06s; }
.hero-text > :nth-child(3) { animation-delay: .12s; }
.hero-text > :nth-child(4) { animation-delay: .18s; }
.hero-text > :nth-child(5) { animation-delay: .24s; }
.portrait-ring { animation-delay: .15s; }
.stats li:nth-child(1) { animation-delay: .3s; }
.stats li:nth-child(2) { animation-delay: .38s; }
.stats li:nth-child(3) { animation-delay: .46s; }
.page-title > :nth-child(3) { animation-delay: .06s; }
.page-title > :nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes drift { to { transform: translate3d(46px, 30px, 0) scale(1.14); } }
@keyframes turn { to { transform: rotate(1turn); } }
@keyframes pulse { 50% { opacity: .25; } }
@keyframes wave { 50% { transform: scaleY(.35); } }
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* on paper everything is shown, whatever the scroll position was */
@media print {
  .reveal, .fig.draw * { opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
  .progress, .band-bg { display: none; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 44px; padding: 22px 0 90px; color: var(--muted); font-size: 14px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer span:first-child { margin-right: auto; }
.site-footer a { color: inherit; }
