/* Sito vetrina competenze — foglio di stile unico, nessuna dipendenza */
:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f2eee8;
  --text: #1d1b19;
  --text-2: #57514a;
  --accent: #b4381d;
  --accent-2: #1f5f6b;
  --border: #e3ddd4;
  --ph-bg: #fff2b8;
  --ph-text: #5a4600;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161412; --surface: #201d1a; --surface-2: #2a2622; --text: #f3efe9; --text-2: #bdb4a9;
    --accent: #ff8a65; --accent-2: #7cc4cf; --border: #3a342e; --ph-bg: #4a3d00; --ph-text: #ffe680;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161412; --surface: #201d1a; --surface-2: #2a2622; --text: #f3efe9; --text-2: #bdb4a9;
  --accent: #ff8a65; --accent-2: #7cc4cf; --border: #3a342e; --ph-bg: #4a3d00; --ph-text: #ffe680;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-2); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.8rem); font-weight: 600; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 16px; }
.ph { background: var(--ph-bg); color: var(--ph-text); padding: 0 .25em; border-radius: 4px; font-style: normal; }
body.final .ph { background: none; color: inherit; padding: 0; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; color: var(--text); text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; width: 44px; height: 44px; cursor: pointer; font-size: 1.1rem; }
@media (max-width: 720px) { .nav { display: none; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 2px solid transparent; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }
:root[data-theme="dark"] .btn-primary { color: #1d1b19; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #1d1b19; } }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* Hero */
.hero { padding: clamp(32px, 5vw, 64px) 0 48px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--accent); margin-bottom: 14px; }
.hero .lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--text-2); max-width: 62ch; }
.hero-meta { display: flex; gap: 20px; flex-wrap: wrap; margin: 28px 0; color: var(--text-2); font-size: .95rem; padding: 0; list-style: none; }
.hero-meta strong { color: var(--text); display: block; font-size: 1.5rem; font-family: var(--font-head); }

/* Skill grid */
section { padding: 48px 0; }
.section-head { max-width: 68ch; margin-bottom: 28px; }
.section-head p { color: var(--text-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; list-style: none; padding: 0; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative; transition: transform .15s ease; }
.card:hover { transform: translateY(-2px); }
.card .icon { font-size: 1.8rem; line-height: 1; }
.card .cat { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); font-weight: 700; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card p { color: var(--text-2); margin: 0; }
.level { display: flex; gap: 4px; margin-top: auto; padding-top: 8px; }
.level span { width: 22px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.level span.on { background: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.tags li { font-size: .82rem; background: var(--surface-2); color: var(--text-2); padding: 4px 10px; border-radius: 999px; }

/* Skill page */
.crumbs { font-size: .9rem; color: var(--text-2); padding-top: 24px; }
.crumbs a { color: var(--text-2); display: inline-block; padding: 10px 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.evidence .shot { aspect-ratio: 16/10; object-fit: cover; object-position: top; border-radius: 10px; border: 1px solid var(--border); width: 100%; }
.skill-hero { padding: 24px 0 8px; }
.skill-hero .icon { font-size: 3rem; }
.layout { display: grid; grid-template-columns: 240px 1fr; gap: 48px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; gap: 0; } .toc { position: static !important; } }
.toc { position: sticky; top: 88px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.toc h2 { font-size: 1rem; font-family: var(--font-body); text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li { margin: 4px 0; }
.block { padding: 28px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 80px; }
.block:last-child { border-bottom: 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--border); }
.timeline li { position: relative; padding: 0 0 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 6px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.timeline .when { font-weight: 700; display: block; }
.checks { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.checks li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 12px 40px; position: relative; }
.checks li::before { content: "✓"; position: absolute; left: 14px; color: var(--accent); font-weight: 800; }
.evidence { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 18px; list-style: none; padding: 0; }
.evidence .media { aspect-ratio: 16/10; background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 12px, var(--surface) 12px, var(--surface) 24px); border-radius: 10px; display: grid; place-items: center; color: var(--text-2); font-size: .9rem; text-align: center; padding: 12px; border: 1px dashed var(--border); }
.cta-box { background: var(--text); color: var(--bg); border-radius: var(--radius); padding: clamp(28px, 5vw, 48px); margin: 48px 0; }
.cta-box h2 { color: var(--bg); }
.cta-box p { color: color-mix(in srgb, var(--bg) 80%, transparent); }
.cta-box .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px 0; }

/* Contact & footer */
.contact-list { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.contact-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.contact-list span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--text-2); font-size: .9rem; }

@media print {
  .site-header, .theme-toggle, .toc, .cta-box .btn-row, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .checks li { box-shadow: none; }
}

.card .ctxline { margin-top: auto; padding-top: 8px; font-size: .85rem; font-weight: 600; color: var(--accent); }

/* ---- v3: storytelling, numeri, lavori, video, grafici ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; list-style: none; padding: 0; margin: 28px 0; }
.stats li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; color: var(--text-2); font-size: .92rem; line-height: 1.4; }
.stats strong { display: block; font-family: var(--font-head); font-size: 2rem; color: var(--text); line-height: 1.1; margin-bottom: 4px; }
.story { max-width: 70ch; font-size: 1.08rem; }
.story p:first-of-type::first-letter { font-family: var(--font-head); font-size: 3.1em; float: left; line-height: .9; padding: 4px 8px 0 0; color: var(--accent); }
.outlets { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 16px 0 0; }
.outlets a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; }
.outlets a:hover { border-color: var(--accent); }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 18px; list-style: none; padding: 0; margin: 0; }
.work { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); position: relative; display: flex; flex-direction: column; }
.work img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.work .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.work h3 { margin: 0; }
.work h3 a { color: var(--text); text-decoration: none; }
.work h3 a::after { content: ""; position: absolute; inset: 0; }
.work p { margin: 0; color: var(--text-2); }
.nav .dd { position: relative; }
.videos { display: grid; gap: 28px; list-style: none; padding: 0; }
.video-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
@media (max-width: 820px) { .video-card { grid-template-columns: 1fr; } }
.video-card video, .video-card .embed { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 10px; border: 0; display: block; }
.video-card h2 { font-size: 1.4rem; margin-bottom: .3em; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0 0; font-size: .95rem; }
.meta-list dt { font-weight: 700; color: var(--text-2); }
.meta-list dd { margin: 0; }
.chip { display: inline-block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.bars { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; max-width: 760px; }
.bars li { display: grid; grid-template-columns: minmax(120px, 230px) 1fr; gap: 12px; align-items: center; }
.bars .lab { font-size: .95rem; }
.bars .track { display: flex; align-items: center; gap: 8px; }
.bars .bar { height: 14px; background: var(--accent-2); border-radius: 0 4px 4px 0; min-width: 2px; }
.bars .val { font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bars li:hover .bar { filter: brightness(1.15); }
@media (max-width: 560px) { .bars li { grid-template-columns: 1fr; gap: 2px; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; list-style: none; padding: 0; margin: 16px 0; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.gallery img { width: 100%; aspect-ratio: 16/10; object-fit: cover; object-position: top; }
.gallery figcaption { padding: 8px 12px; font-size: .88rem; color: var(--text-2); }
.gallery a { display: block; }
.case { padding: 40px 0; border-top: 1px solid var(--border); scroll-margin-top: 80px; }
.case:first-of-type { border-top: 0; }
.quote { border-left: 4px solid var(--accent); background: var(--surface); padding: 16px 20px; border-radius: 0 10px 10px 0; margin: 16px 0; }
.quote p:last-child { margin-bottom: 0; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: .95rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
details.more { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; margin: 8px 0; }
details.more summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.pending { border: 1px dashed var(--border); border-radius: 10px; padding: 14px; color: var(--text-2); font-size: .92rem; }
body.final .pending { display: none; }

.work-num { aspect-ratio: 16/10; display: grid; place-items: center; background: var(--surface-2); font-family: var(--font-head); font-size: clamp(3rem, 8vw, 4.5rem); color: var(--accent); }

/* progetti con storytelling e schermate */
.project { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 28px 0; border-top: 1px solid var(--border); }
.project-flip .project-text { order: 2; }
.project h3 { font-size: 1.35rem; margin: 0 0 4px; }
.project .lead-sm { color: var(--text-2); font-size: 1.02rem; margin: 0 0 12px; }
.project .ai-note { background: var(--surface-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.project .result { font-weight: 500; }
.project-shots { display: grid; gap: 12px; }
.project-shots.phones { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.project-shots figure { margin: 0; }
.project-shots img { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.project-shots .shot-phone img { aspect-ratio: 591 / 1280; object-fit: cover; border-radius: 16px; }
.project-shots figcaption { font-size: .85rem; color: var(--text-2); margin-top: 6px; }
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; gap: 16px; }
  .project-flip .project-text { order: 0; }
  .project-shots.phones { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}
.project-shots .shot-desktop img { width: auto; max-width: 100%; max-height: 480px; margin: 0 auto; }

/* Home per aree */
.quick-title { font-size: 1.25rem; margin: 28px 0 12px; }
.area-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; list-style: none; padding: 0; margin: 0 0 24px; }
.area-tile { display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 44px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.area-tile:hover, .area-tile:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.area-tile .icon { font-size: 1.6rem; }
.area-tile strong { font-family: var(--font-head); font-size: 1.15rem; }
.area-tile span:last-child { color: var(--text-2); font-size: .92rem; }
section.area { scroll-margin-top: 72px; }
.area-works { margin: 32px 0 14px; }

/* Video prima/dopo */
.method { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 8px 0 32px; }
.method h2 { font-size: 1.5rem; }
.method-list { columns: 2 300px; column-gap: 32px; padding-left: 1.3em; margin: 0 0 18px; }
.method-list li { margin-bottom: 8px; break-inside: avoid; }
.jump a { text-decoration: none; color: inherit; display: inline-block; min-height: 24px; }
.ba-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.ba-head h2 { font-size: 1.45rem; margin: .3em 0; }
.ba-head p { color: var(--text-2); max-width: 75ch; }
.ba-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 820px) { .ba-grid { grid-template-columns: 1fr; } }
.ba-col { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--bg); }
.ba-dopo { border: 2px solid var(--accent); }
.ba-col video, .ba-col .embed { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 10px; border: 0; display: block; }
.ba-label { font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.ba-tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.ba-dopo .ba-tag { background: var(--accent); color: #fff; border-color: var(--accent); }
.ba-prompt { margin: 12px 0; font-size: .95rem; padding: 10px 12px; border-left: 3px solid var(--border); background: var(--surface); border-radius: 0 8px 8px 0; }
.ba-prompt span { display: block; font-size: .85rem; color: var(--text-2); }
.ba-sub { font-weight: 600; margin: 14px 0 6px; font-size: 1rem; font-family: inherit; }
.ba-list { padding-left: 0; list-style: none; margin: 0 0 10px; }
.ba-list li { padding-left: 1.6em; position: relative; margin-bottom: 6px; }
.ba-minus li::before { content: "✕"; position: absolute; left: 0; color: var(--text-2); }
.ba-plus li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.ba-tech { font-size: .85rem; color: var(--text-2); margin: 0; }
.refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; list-style: none; padding: 0; margin: 0; }
.refs img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.ba-more { margin-top: 16px; }
.ba-more summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Menu da smartphone: riga scorrevole sotto il nome */
@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; gap: 0 12px; }
  .nav { display: flex; flex-wrap: nowrap; order: 3; width: 100%; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; min-height: 44px; display: flex; align-items: center; }
}
:root[data-theme="dark"] .ba-dopo .ba-tag { color: #1d1b19; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ba-dopo .ba-tag { color: #1d1b19; } }
.ba-more summary::before { content: "▸"; margin-right: 8px; transition: transform .15s; }
.ba-more[open] summary::before { transform: rotate(90deg); }
