@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400..800;1,14..32,400..800&display=swap');

/* ============================================================
   Alberto Broggi — personal site
   Iteration 4 — simple & precise
   One typeface (Inter), strict black & white chrome,
   photos large and in color, soft radii, consistent spacing.
   Skeleton: two-column spreads with sticky № labels.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96.
   ============================================================ */

:root {
  --paper: #ffffff;
  --paper-soft: #f5f5f3;
  --ink: #101010;
  --muted: #6f6f6a;
  --hairline: #e6e6e1;
  --hairline-dark: #2c2c2a;
  --maxw: 1280px;
  --r: 14px;
  --r-lg: 20px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { font-family: var(--sans); line-height: 1.05; }
h1 { font-weight: 700; letter-spacing: -0.045em; font-size: clamp(3.2rem, 9.5vw, 7.5rem); margin: 0; }
h2 { font-weight: 650; letter-spacing: -0.03em; font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 1rem; }
h3 { font-weight: 600; letter-spacing: -0.015em; font-size: 1.2rem; margin: 0 0 .3rem; }

::selection { background: var(--ink); color: var(--paper); }

img, video { border-radius: var(--r); }

/* ---------- Topbar (brand + nav, sticky) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .container {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding-top: 16px; padding-bottom: 16px;
}
.topbar .brand {
  font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; white-space: nowrap;
}
.topbar .brand:hover { text-decoration: none; color: var(--muted); }
.topnav { display: flex; gap: 4px; overflow-x: auto; font-size: .82rem; font-weight: 500; }
.topnav a {
  color: var(--muted); white-space: nowrap;
  padding: 6px 12px; border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.topnav a:hover { color: var(--ink); background: var(--paper-soft); text-decoration: none; }
.topbar .loc {
  font-size: .72rem; font-weight: 500; color: var(--muted);
  letter-spacing: .04em; white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero { border-bottom: 1px solid var(--hairline); padding: 80px 0 0; }
.eyebrow {
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); margin: 0 0 24px;
}
.hero h1 { max-width: 12ch; }
.hero h1 em { font-style: normal; color: var(--muted); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 64px;
  align-items: end;
  margin-top: 64px;
  padding-bottom: 64px;
}
.tagline {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 550; letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 30ch;
  line-height: 1.3;
}
.lead { color: var(--muted); margin: 0; max-width: 58ch; font-size: 1.02rem; }
.lead strong { font-weight: 600; color: var(--ink); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: .92rem; letter-spacing: -0.01em;
  padding: 13px 26px; cursor: pointer;
  border: 1px solid var(--ink); border-radius: 999px;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  text-decoration: none; background: transparent; color: var(--ink);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: #2a2a28; }
.btn--ghost { border-color: var(--hairline); }
.btn--ghost:hover { border-color: var(--ink); }

.portrait { margin: 0; }
.portrait img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
  border-radius: var(--r-lg);
}
.portrait figcaption { font-size: .78rem; color: var(--muted); margin-top: 12px; font-weight: 500; }

.meta {
  list-style: none; margin: 0; padding: 20px 0;
  border-top: 1px solid var(--hairline);
  color: var(--muted); font-size: .88rem; font-weight: 500;
  display: flex; flex-wrap: wrap; gap: 8px 32px;
}
.meta a { color: var(--ink); font-weight: 600; }

/* ---------- Section skeleton: № label left, content right ---------- */
.section { border-bottom: 1px solid var(--hairline); padding: 96px 0; }
.sec {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 32px 64px;
  align-items: start;
}
.sec-side {
  position: sticky; top: 88px;
  display: flex; flex-direction: column; gap: 2px;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  border-top: 2px solid var(--ink); padding-top: 12px;
}
.sec-side .no { color: var(--muted); }
.sec-side .lbl { color: var(--ink); }

.section-lead { color: var(--muted); max-width: 620px; margin: 0 0 48px; font-size: 1.05rem; }
.section-lead strong { color: var(--ink); font-weight: 600; }

/* ---------- Services ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.card {
  background: var(--paper-soft); border-radius: var(--r);
  padding: 28px 28px 32px;
  transition: background .18s ease;
}
.card:hover { background: #efefeb; }
.card .num {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: block; margin-bottom: 16px;
}
.card h3 { font-size: 1.18rem; }
.card p { margin: .35rem 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- Timeline (numbered index, rows → modal) ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li { margin: 0; }
.tl-group {
  font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); padding: 0 0 12px 12px;
}
li + .tl-group { padding-top: 40px; }
.tl-card--now {
  border: 1.5px solid var(--ink); border-radius: var(--r);
  background: var(--paper);
  padding: 22px 20px; margin-bottom: 10px;
}
.tl-card--now:hover { background: var(--paper-soft); border-radius: var(--r); }
.tl-card--now .when { color: var(--ink); }
.tl-card {
  width: 100%; text-align: left; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  padding: 24px 12px;
  display: flex; align-items: baseline; gap: 24px;
  font-family: inherit; color: inherit;
  transition: background .15s ease;
}
.tl-card:hover { background: var(--paper-soft); border-radius: var(--r); }
.tl-card .idx {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 30px;
}
.tl-card .role { flex: 1 1 auto; min-width: 0; }
.tl-card .role h3 { margin: 0 0 4px; font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
.tl-card .role p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.tl-card .when {
  font-size: .8rem; color: var(--muted); font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto; white-space: nowrap;
}
.tl-card .arrow {
  font-size: 1.1rem; line-height: 1; color: var(--muted);
  flex: 0 0 auto; align-self: center;
  transition: transform .18s ease, color .18s ease;
}
.tl-card:hover .arrow { transform: translateX(5px); color: var(--ink); }

/* ---------- Skills ---------- */
.subhead {
  margin: 56px 0 16px;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 600;
}
.skills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.skills li {
  background: var(--paper-soft); border-radius: 999px;
  padding: 6px 16px; font-size: .85rem; font-weight: 500; color: var(--ink);
}

/* ---------- Projects (asymmetric spread) ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 56px 32px;
}
.feature { display: flex; flex-direction: column; grid-column: span 2; }
.feature--full { grid-column: span 6; }
.feature--half { grid-column: span 3; }

.feature__media {
  aspect-ratio: 4 / 3; background: var(--paper-soft); overflow: hidden;
  border-radius: var(--r-lg);
}
.feature--full .feature__media { aspect-ratio: 21 / 9; }
.feature--half .feature__media { aspect-ratio: 3 / 2; }
.feature__media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 0;
  transition: transform .55s ease;
}
.feature:hover .feature__media img { transform: scale(1.03); }
.feature__body { padding: 18px 4px 0; }
.feature__body .role {
  font-size: .74rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); display: block; margin-bottom: 8px;
}
.feature__body h3 { font-size: 1.35rem; }
.feature--full .feature__body h3, .feature--half .feature__body h3 { font-size: 1.6rem; }
.feature__body p { color: var(--muted); margin: .35rem 0 .9rem; font-size: .95rem; max-width: 52ch; }
.feature__body .link { font-size: .9rem; font-weight: 600; }
.feature__body .link::after { content: " ↗"; color: var(--muted); }
.feature__body .link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Hobbies (masonry, uniform gutters) ---------- */
.masonry { columns: 3 280px; column-gap: 24px; }
.m-item { break-inside: avoid; margin: 0 0 24px; display: block; }
.m-item figure, figure.m-item { margin: 0; }
.m-item img, .m-item video { width: 100%; display: block; background: #000; }
.m-item img { cursor: zoom-in; }
.m-cap { padding: 12px 4px 20px; }
.m-cap h3 { font-size: 1.05rem; margin: 0 0 .2rem; }
.m-cap p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.m-cap p strong { color: var(--ink); font-weight: 600; }
.m-cap a { font-weight: 600; color: var(--ink); }
.m-cap a::after { content: " ↗"; color: var(--muted); }
.m-cap a:hover { text-decoration: underline; text-underline-offset: 3px; }

.m-item--text {
  background: var(--ink); color: var(--paper);
  border-radius: var(--r);
  padding: 28px 28px 32px;
}
.m-item--text .tag {
  font-size: .7rem; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: #9b9b94; display: block; margin-bottom: 12px;
}
.m-item--text h3 { color: var(--paper); font-size: 1.3rem; margin: 0 0 .35rem; }
.m-item--text p { color: #b9b9b2; font-size: .9rem; margin: 0; }
.m-item--text a { color: var(--paper); font-weight: 600; }
.m-item--text a::after { content: " ↗"; color: #9b9b94; }
.m-item--text a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Companies (consulting cards) ---------- */
.company-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px 24px;
  margin-bottom: 40px;
}
.company { display: flex; flex-direction: column; }
.company__media {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--r-lg); background: var(--paper-soft);
}
.company__media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 0;
  transition: transform .55s ease;
}
.company:hover .company__media img { transform: scale(1.03); }
.company__body { padding: 16px 4px 0; }
.company__body h3 { font-size: 1.3rem; }
.company__body p { color: var(--muted); margin: .35rem 0 .8rem; font-size: .92rem; }
.company__body p strong { color: var(--ink); font-weight: 600; }
.company__body .link { font-size: .88rem; font-weight: 600; overflow-wrap: anywhere; }
.company__body .link::after { content: " ↗"; color: var(--muted); }
.company__body .link:hover { text-decoration: underline; text-underline-offset: 4px; }
.more { color: var(--muted); font-size: .95rem; max-width: 720px; }
.more a { font-weight: 600; color: var(--ink); }
.more a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Contact (black band) ---------- */
.contact { background: var(--ink); color: var(--paper); border-bottom: none; }
.contact .sec-side { border-top-color: var(--paper); }
.contact .sec-side .no { color: #8c8c86; }
.contact .sec-side .lbl { color: var(--paper); }
.contact h2 { color: var(--paper); font-size: clamp(2.4rem, 5.5vw, 4.2rem); font-weight: 700; letter-spacing: -0.04em; }
.contact p { color: #b9b9b2; max-width: 600px; }
.big-mail {
  display: inline-block; margin: 32px 0 0;
  font-weight: 650; letter-spacing: -0.03em;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem); line-height: 1.15;
  color: var(--paper);
  border-bottom: 2px solid #555;
  padding-bottom: 6px;
  transition: border-color .18s ease;
  overflow-wrap: anywhere;
}
.big-mail:hover { text-decoration: none; border-color: var(--paper); }
.contact-lines { font-size: .9rem; margin-top: 36px; font-weight: 600; }
.contact-lines a { color: var(--paper); }
.contact-lines a:hover { text-decoration: none; color: #b9b9b2; }

footer { padding: 0 0 44px; font-size: .8rem; background: var(--ink); color: #8c8c86; }
footer .container {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  border-top: 1px solid var(--hairline-dark); padding-top: 24px;
  font-weight: 500;
}
footer p { margin: 0; }

/* ---------- Modal ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto;
}
.modal__backdrop { position: fixed; inset: 0; background: rgba(16,16,16,0.55); animation: fade .2s ease; }
.modal__panel {
  position: relative; z-index: 1; width: 100%; max-width: 720px;
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  padding: 48px 48px 44px; animation: pop .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px); } }
.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border: 0; border-radius: 999px;
  background: var(--paper-soft); cursor: pointer; font-size: 1.25rem; line-height: 1; color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.modal__close:hover { background: var(--ink); color: var(--paper); }

.modal__panel .when {
  font-size: .76rem; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em;
}
.modal__panel h2 { margin: .5rem 0 .15rem; font-size: clamp(1.6rem, 3.2vw, 2.2rem); }
.modal__panel .sub { font-size: 1rem; font-weight: 500; color: var(--muted); margin: 0 0 1.5rem; }
.modal__panel h4 {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin: 1.8rem 0 .6rem; font-weight: 600;
  border-top: 1px solid var(--hairline); padding-top: 1rem;
}
.modal__panel p { margin: 0 0 .8rem; color: var(--ink); }
.modal__panel ul { margin: 0 0 .8rem; padding-left: 1.15rem; }
.modal__panel ul li { margin-bottom: .35rem; }
.modal__panel .skills { margin-top: .4rem; }
.modal__panel .ext { display: inline-block; margin-top: 1.2rem; font-size: .92rem; font-weight: 600; }
.modal__panel .ext::after { content: " ↗"; color: var(--muted); }
.modal__panel .ext:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Lightbox (expanded hobby photos) ---------- */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 110;
  display: flex; align-items: center; justify-content: center;
  padding: 5vh 5vw;
  background: rgba(16,16,16,0.92);
  animation: fade .2s ease;
  cursor: zoom-out;
}
.lightbox__fig {
  margin: 0; cursor: default;
  display: flex; flex-direction: column; align-items: center;
  max-width: 1100px; max-height: 90vh;
}
.lightbox__fig img {
  max-width: 100%; max-height: 78vh; width: auto; height: auto;
  object-fit: contain; border-radius: var(--r); background: #000;
  animation: pop .22s cubic-bezier(.2,.8,.2,1);
}
.lightbox__cap { padding: 16px 4px 0; max-width: 680px; text-align: center; }
.lightbox__cap h3 { color: var(--paper); font-size: 1.15rem; margin: 0 0 .25rem; }
.lightbox__cap p { color: #c9c9c4; font-size: .9rem; margin: 0; line-height: 1.55; }
.lightbox__cap p strong { color: var(--paper); font-weight: 600; }
.lightbox__cap a { color: var(--paper); font-weight: 600; }
.lightbox__cap a::after { content: " ↗"; color: #9b9b94; }
.lightbox__cap a:hover { text-decoration: underline; text-underline-offset: 3px; }
.lightbox__close {
  position: fixed; top: 18px; right: 18px;
  width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,0.14); color: var(--paper);
  cursor: pointer; font-size: 1.5rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lightbox__close:hover { background: rgba(255,255,255,0.28); }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); gap: 44px 24px; }
  .feature { grid-column: span 1; }
  .feature--full, .feature--half { grid-column: span 2; }
  .feature--full .feature__media { aspect-ratio: 16 / 9; }
  .company-grid { grid-template-columns: 1fr; gap: 36px; }
  .topbar .loc { display: none; }
}
@media (max-width: 900px) {
  .sec { grid-template-columns: 1fr; gap: 28px; }
  .sec-side { position: static; flex-direction: row; gap: 12px; align-items: baseline; }
  .hero-grid { grid-template-columns: 1fr; gap: 44px; }
  .portrait { max-width: 380px; }
}
@media (max-width: 680px) {
  .hero { padding-top: 48px; }
  .hero-grid { margin-top: 40px; padding-bottom: 48px; }
  .section { padding: 64px 0; }
  .masonry { columns: 2 150px; column-gap: 14px; }
  .m-item { margin-bottom: 14px; }
  .m-cap { padding: 8px 2px 14px; }
  .m-cap h3 { font-size: .95rem; }
  .m-cap p { font-size: .8rem; }
  .tl-card { flex-wrap: wrap; gap: 6px 14px; padding: 18px 10px; }
  .tl-card .idx { flex-basis: 100%; }
  .tl-card .role { flex-basis: 100%; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature, .feature--full, .feature--half { grid-column: span 1; }
  .feature--full .feature__media { aspect-ratio: 3 / 2; }
  .tl-card--now { padding: 18px 16px; }
  .modal__panel { padding: 36px 24px 30px; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 9px; }
  .topnav a:nth-child(n+5) { display: none; }
}
