/* ==========================================================
   francescobonerba.it — v2026
   Niente framework, niente build. Solo HTML, CSS e un po' di JS.
   ========================================================== */

:root {
  --bg: #111110;
  --bg-2: #1a1a18;
  --line: #2c2b28;
  --text: #ece8df;
  --muted: #9a958a;
  --accent: #ff7a1a;       /* lo stesso arancio del CV */
  --accent-ink: #111110;
  --display: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --max: 1080px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f0e8;
  --bg-2: #ebe5d9;
  --line: #d6cfc0;
  --text: #1b1a17;
  --muted: #6b665c;
  --accent: #d95f00;
  --accent-ink: #fff;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--display);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* grana pellicola leggerissima */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* perforazioni della pellicola sui bordi (solo schermi larghi) */
@media (min-width: 1240px) {
  body::after {
    content: "";
    position: fixed; top: 0; bottom: 0; left: 18px;
    width: 14px;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, transparent 0 14px, var(--line) 14px 28px);
    border-radius: 3px;
  }
}

img { max-width: 100%; display: block; }
a { color: inherit; }
em { font-style: italic; }

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

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

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .8125rem;
}
.brand { font-weight: 600; text-decoration: none; color: var(--accent); letter-spacing: .04em; }
.topbar nav { display: flex; gap: 20px; margin-left: auto; }
.topbar nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.topbar nav a:hover { color: var(--text); }
.theme {
  background: none; border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem;
}
.theme:hover { border-color: var(--accent); }

.menu-btn {
  display: none;
  margin-left: auto;
  background: none; border: 1px solid var(--line); color: var(--text);
  font: 600 .75rem var(--mono); letter-spacing: .06em;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.menu-btn:hover { border-color: var(--accent); }

@media (max-width: 1000px) {
  .menu-btn { display: inline-block; }
  .topbar nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
  }
  .topbar nav.open { display: flex; }
  .topbar nav a { padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
  .topbar nav a:last-child { border-bottom: 0; }
}

/* ---------- layout ---------- */
main > section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) var(--gutter) 0;
}

.sec-head {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 32px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.reel, .tc, .meta, .yr, .p-yr, figcaption, .small, .pec {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .06em;
  color: var(--muted);
}
.reel { color: var(--accent); white-space: nowrap; }
h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
}

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
  min-height: calc(100svh - 64px);
  padding-top: 40px !important;
}
.hero h1 {
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  font-weight: 800;
  line-height: .9;
  letter-spacing: -.045em;
  margin: 18px 0 26px;
}
.hero h1::after { content: "."; color: var(--accent); }
.lede { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--muted); max-width: 34ch; }
.lede br { display: none; }
@media (min-width: 900px) { .lede br { display: inline; } }

.term {
  margin-top: 32px;
  font-family: var(--mono);
  font-size: .9375rem;
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 16px;
}
.prompt { color: var(--accent); }
.out { color: var(--text); }
.caret {
  display: inline-block; width: .6em; height: 1.1em;
  background: var(--accent); vertical-align: text-bottom; margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-photo { position: relative; justify-self: center; width: min(100%, 380px); }
.hero-photo img {
  width: 100%; height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  filter: grayscale(1) contrast(1.05);
  transition: filter .5s;
}
.hero-photo:hover img { filter: none; }
/* angoli da mirino */
.hero-photo::before, .hero-photo::after {
  content: ""; position: absolute; width: 28px; height: 28px;
  border: 2px solid var(--accent);
}
.hero-photo::before { top: -10px; left: -10px; border-right: 0; border-bottom: 0; }
.hero-photo::after  { bottom: 22px; right: -10px; border-left: 0; border-top: 0; }
figcaption { margin-top: 10px; }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-photo { order: -1; justify-self: start; width: 180px; }
  .hero-photo::after { bottom: 22px; }
}

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .25s, border-color .25s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card h3 { font-size: 1.3rem; font-weight: 600; line-height: 1.2; }
.card p { color: var(--muted); font-size: .95rem; }
.card .org { margin-top: auto; color: var(--text); font-weight: 600; font-size: .95rem; }
.card.feat {
  grid-column: 1 / -1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.card.feat p, .card.feat .meta, .card.feat .org { color: var(--accent-ink); }
.card.feat h3 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.card.feat p:not(.meta):not(.org) { max-width: 60ch; font-size: 1.05rem; }

/* ---------- timeline & edu ---------- */
.timeline, .edu { list-style: none; }
.timeline li, .edu li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li { grid-template-columns: 170px 1fr; padding: 22px 0; }
.timeline .yr, .edu .yr { padding-top: 4px; color: var(--accent); }
.timeline h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.25; margin-bottom: 4px; }
.timeline p { color: var(--muted); font-size: .95rem; max-width: 70ch; }
.timeline .org { color: var(--text); font-size: .9rem; font-weight: 600; margin-top: 6px; }
.edu strong { font-weight: 600; }
.edu div strong { color: var(--text); }
.edu small { color: var(--muted); font-size: .875rem; }
@media (max-width: 520px) {
  .timeline li, .edu li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- press ---------- */
.sub {
  display: block;
  font: 400 .8rem/1.4 var(--mono);
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: .02em;
}
.card.feat .sub { color: var(--accent-ink); }
.press-intro { margin-bottom: 28px; display: grid; gap: 6px; }
.press-intro h3 { font-size: 1.4rem; font-weight: 600; }
.press-intro p:not(.meta) { color: var(--muted); }
.rw { color: var(--accent); font-size: .55em; vertical-align: middle; letter-spacing: -.1em; }

.press { list-style: none; border-top: 1px solid var(--line); }
.press a, .press .nolink {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr auto;
  gap: 16px; align-items: baseline;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background .2s, padding .2s;
}
.press a:hover { background: var(--bg-2); padding-left: 16px; }
.press a:hover .p-name { color: var(--accent); }
.p-name { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.02em; transition: color .2s; }
.p-desc { color: var(--muted); }
@media (max-width: 620px) {
  .press a, .press .nolink { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- shell ---------- */
.shell {
  background: #0b0b0a;
  color: #e6e1d6;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.shell-bar {
  display: flex; align-items: center;
  padding: 8px 10px;
  background: #1c1c1a;
}

/* i quattro pallini sono le tab: ognuno col suo colore (--c) */
.tabs { display: flex; gap: 2px; }
.tab {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%;
  cursor: pointer;
}
.tab::before {
  content: "";
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c);
  opacity: .45;
  transition: opacity .2s, transform .2s, box-shadow .2s;
}
.tab:hover::before { opacity: .7; transform: scale(1.15); }
.tab[aria-selected="true"]::before {
  opacity: 1;
  box-shadow: 0 0 0 3px #1c1c1a, 0 0 0 4px var(--c);
}
.tab:focus-visible { outline: 2px solid var(--c); outline-offset: 0; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.shell pre, .panel {
  padding: 20px;
  font: .875rem/1.75 var(--mono);
  min-height: 21em;
}
.panel:focus-visible { outline: 2px solid var(--c); outline-offset: -2px; }
.shell .prompt { color: var(--c, #ff7a1a); }
.shell .caret { background: var(--c, #ff7a1a); }
.dir { color: var(--c, #7cc4ff); font-weight: 600; }

/* righe in stile "ls": etichetta colorata + testo che va a capo allineato */
.ls {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 2ch;
}
.ls dt { color: var(--c); font-weight: 600; }
.ls dd { margin: 0; }
.geo {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  column-gap: 4ch;
}
.geo b { color: var(--c); font-weight: 600; margin-right: 1ch; }

@media (max-width: 520px) {
  .ls { column-gap: 1.5ch; }
  .geo { column-gap: 2ch; }
}

/* ---------- contatti ---------- */
.contact .big {
  font-size: clamp(1.6rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  max-width: 22ch;
  margin-bottom: 48px;
}
.links { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 600 .875rem var(--mono);
  text-decoration: none;
  transition: border-color .2s, background .2s;
  word-break: break-all;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }

/* ---------- footer ---------- */
.foot {
  max-width: var(--max);
  margin: clamp(72px, 10vw, 128px) auto 0;
  padding: 32px var(--gutter) 48px;
  border-top: 1px solid var(--line);
  display: grid; gap: 10px;
}
.quote { margin-bottom: 100px; min-height: 5.5em; transition: opacity .5s; }
.quote.fade { opacity: 0; }
.quote blockquote { font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--text); max-width: 60ch; line-height: 1.4; }
.quote figcaption { font-family: var(--mono); font-size: .75rem; color: var(--muted); margin-top: 8px; }
.small a { color: var(--accent); text-decoration: none; }
.small a:hover { text-decoration: underline; }
.hint { opacity: .45; }

/* ---------- entrata morbida delle sezioni ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s, transform .6s; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- easter egg: modalità 35mm ---------- */
.leader {
  position: fixed; inset: 0; z-index: 300;
  display: none; place-items: center;
  background: radial-gradient(circle, #2a2620 0 30%, #0d0c0a 70%);
  color: #f1e7d0;
  font: 800 30vmin/1 var(--display);
}
.leader::before {
  content: ""; position: absolute;
  width: 70vmin; height: 70vmin; border-radius: 50%;
  border: 3px solid #f1e7d0;
  box-shadow: 0 0 0 12px #0d0c0a, 0 0 0 15px #f1e7d0;
}
.leader::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(#f1e7d0, #f1e7d0) center/2px 100% no-repeat,
              linear-gradient(#f1e7d0, #f1e7d0) center/100% 2px no-repeat;
  opacity: .5;
}
.leader.on { display: grid; }

html.film body { filter: sepia(.55) contrast(1.1) brightness(.95); }
html.film body::before { opacity: .16; animation: flicker .15s steps(2) infinite; }
@keyframes flicker { 50% { opacity: .1; transform: translate(1px, -1px); } }

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

@media (max-width: 520px) { .panel { font-size: .75rem; padding: 16px; min-height: 26em; } }
