@font-face { font-family: 'Be Vietnam Pro'; font-weight: 400; font-display: swap; src: url('/assets/fonts/BeVietnamPro-400-latin.woff2') format('woff2'); }
@font-face { font-family: 'Be Vietnam Pro'; font-weight: 500; font-display: swap; src: url('/assets/fonts/BeVietnamPro-500-latin.woff2') format('woff2'); }

:root {
  --surface: #fffdfc;
  --surface-muted: #faf4eb;
  --surface-sand: #f5e9d7;
  --primary: #66574d;
  --secondary: #3e3633;
  --secondary-hover: #302a27;
  --ink: #5c4232;
  --ink-heading: #5c483b;
  --ink-nav: #806b5d;
  --accent: #e68c7c;
  --accent-strong: #e35f4a;
  --border: #d0c7c3;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  --section: 64px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
@media (min-width: 640px) { :root { --gutter: 30px; } }
@media (min-width: 1100px) { :root { --section: 110px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--surface); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, canvas { display: block; max-width: 100%; }
a { color: inherit; }
em { font-style: normal; color: var(--accent-strong); }
h1, h2, h3 { margin: 0 0 20px; color: var(--ink-heading); font-weight: 500; letter-spacing: -.04em; }
p { margin: 0 0 20px; }
:focus-visible { outline: 2px dotted var(--ink-heading); outline-offset: 3px; }
::selection { background: var(--primary); color: #fff; }
.skip { position: absolute; left: 10px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--secondary); color: #fff; }
.skip:focus { top: 10px; }

.wrap { width: 100%; max-width: calc(1200px + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--section) 0; }
.eyebrow { margin: 0 0 16px; font-size: 13px; letter-spacing: .02em; color: var(--ink-nav); }
.dot { display: inline-block; width: 10px; height: 10px; margin-right: 10px; vertical-align: 0; border-radius: 50%; background: var(--accent-strong); }

/* Testata */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 253, 252, .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid rgba(208, 199, 195, .45); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink-heading); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--secondary); color: #fff; font-weight: 500; font-size: 16px; transform: perspective(200px) rotateY(-14deg); }
.brand-name { font-weight: 500; letter-spacing: -.02em; }
.brand-name span { color: var(--ink-nav); font-weight: 400; }
.top-link { font-size: 14px; text-decoration: none; color: var(--ink-nav); white-space: nowrap; }
.top-link:hover { color: var(--accent-strong); }

/* Pulsanti */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; min-height: 46px; font: inherit; font-size: 15px; text-decoration: none; border: 1px solid var(--border); background: rgba(255, 255, 255, .5); color: var(--ink-heading); transition: .2s ease; transition-property: background-color, border-color, transform; }
.btn:hover { border-color: #b4a69f; transform: translateY(-2px); }
.btn-dark { background: var(--secondary); border-color: transparent; color: #fff; }
.btn-dark:hover { background: var(--secondary-hover); }

/* Hero guidato dallo scroll: la sezione è alta, il contenuto resta fermo e --p va da 0 a 1 */
.hero { --p: 0; position: relative; height: 290vh; background: radial-gradient(120% 90% at 80% 40%, var(--surface-sand) 0%, var(--surface-muted) 38%, var(--surface) 72%); }
.hero-sticky { position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100svh - 64px); overflow: hidden; display: flex; align-items: center; }
.hero-in { position: relative; z-index: 1; display: grid; gap: 0; align-items: center; height: 100%; grid-template-rows: minmax(0, 1fr) auto; pointer-events: none; }
.hero-in a, .hero-in button { pointer-events: auto; }
.hero-text { position: relative; grid-row: 2; padding-bottom: 24px; }
.hero h1 { font-size: clamp(38px, 6.2vw, 84px); line-height: 1.03; letter-spacing: -.05em; max-width: 13ch; margin-bottom: 18px; }
.h1-a { display: inline; }
.h1-b > span, .h1-b em > span { display: inline-block; opacity: clamp(0, calc((var(--p) - var(--s)) * 9), 1); transform: translateY(calc((1 - clamp(0, calc((var(--p) - var(--s)) * 9), 1)) * .5em)) rotateX(calc((1 - clamp(0, calc((var(--p) - var(--s)) * 9), 1)) * -70deg)); transform-origin: 50% 100%; }
.h1-b { perspective: 600px; }
.h1-b > span:nth-child(1) { --s: .56; }
.h1-b > span:nth-child(2) { --s: .59; }
.h1-b em > span:nth-child(1) { --s: .62; }
.h1-b em > span:nth-child(2) { --s: .65; }
.h1-b > span:last-child { --s: .78; }
.hero-more { opacity: clamp(0, calc((var(--p) - .74) * 7), 1); transform: translateY(calc((1 - clamp(0, calc((var(--p) - .74) * 7), 1)) * 24px)); }
.hero-more.is-off { visibility: hidden; }
.lead { font-size: clamp(16px, 1.6vw, 20px); font-weight: 500; line-height: 1.5; color: var(--ink-heading); max-width: 36ch; margin-bottom: 24px; }
.hint { position: absolute; left: 0; bottom: 24px; margin: 0; font-size: 13px; color: var(--ink-nav); display: flex; align-items: center; gap: 10px; opacity: clamp(0, calc(1 - var(--p) * 8), 1); pointer-events: none; }
.hint-dot { width: 18px; height: 28px; border: 1.5px solid var(--ink-nav); border-radius: 10px; position: relative; }
.hint-dot::after { content: ''; position: absolute; left: 50%; top: 5px; width: 4px; height: 6px; margin-left: -2px; border-radius: 2px; background: var(--accent-strong); animation: hint 1.6s var(--ease) infinite; }
@keyframes hint { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(9px); opacity: 0; } 100% { opacity: 0; } }
.stage { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.stage canvas { width: 100%; height: 100%; }
.cap { position: absolute; left: 0; top: 0; margin: 0; white-space: nowrap; transform: translate(-50%, 0); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-nav); pointer-events: none; }
.cap.is-in { animation: cap .7s var(--ease); }
@keyframes cap { from { opacity: 0; letter-spacing: .3em; } }
@media (max-width: 959px) {
  .hero { height: 250vh; }
  .hero-in { grid-template-rows: minmax(0, 1fr) auto; }
  .hero-text { padding-bottom: 20px; }
  .hero h1 { font-size: clamp(34px, 9.4vw, 52px); margin-bottom: 14px; }
  .lead { font-size: 15.5px; margin-bottom: 16px; }
  .hero-more { position: absolute; left: 0; right: 0; top: 100%; }
  .hero-text { transform: translateY(calc(clamp(0, calc((var(--p) - .74) * 7), 1) * -1 * (var(--more-h, 215px) + 6px))); }
  .hint { bottom: auto; top: 100%; margin-top: -6px; }
  .hero-text .eyebrow { opacity: clamp(0, calc(1 - (var(--p) - .74) * 8), 1); }
}
@media (min-width: 960px) {
  .hero-in { grid-template-columns: 1fr 1.1fr; grid-template-rows: none; gap: 40px; }
  .hero-text { grid-row: auto; }
  .hero-text { padding-bottom: 0; min-height: 420px; display: flex; flex-direction: column; justify-content: center; }
  .hint { bottom: -40px; }
}

/* Riquadro «Chi sono», come nelle presentazioni: testo a sinistra, ritratto su cerchio a destra */
.section h2, .contact h2 { font-size: clamp(32px, 4.4vw, 58px); line-height: 1.06; }
.me { display: grid; gap: clamp(22px, 4vw, 56px); align-items: center; margin-top: 40px; padding: clamp(26px, 4vw, 54px); border-radius: 22px; background: #fff; border: 1px solid rgba(208, 199, 195, .55); box-shadow: 0 2px 4px rgba(62, 54, 51, .04), 0 18px 40px -14px rgba(62, 54, 51, .22); }
.me-count { margin: 0 0 10px; font-size: 12.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-nav); }
.me h3 { margin: 0 0 16px; font-size: clamp(27px, 1.2rem + 1.6vw, 42px); line-height: 1.1; }
.me-body { font-size: 17px; color: var(--ink); margin: 0; }
.me b { font-weight: 500; color: var(--ink-heading); }
.me-points { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }
.me-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 15.5px; }
.me-points svg { flex: none; width: 24px; height: 24px; padding: 5px; margin-top: 1px; border-radius: 8px; background: #fbe6e1; color: var(--accent-strong); }
.me-why { margin-top: 24px; padding: 18px 20px; border-radius: 14px; background: linear-gradient(135deg, #fff, #fbe6e1); border: 1px solid #f6d0c6; box-shadow: 0 1px 2px rgba(62, 54, 51, .05), 0 3px 10px rgba(62, 54, 51, .05); }
.me-why b { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: #b8452f; }
.me-why svg { width: 14px; height: 14px; }
.me-why p { margin: 0; font-size: 15.5px; color: var(--ink-heading); }
.me-actions { margin-top: 26px; }
.me-shot { margin: 0; --rx: 2deg; --ry: -7deg; transform: perspective(1100px) rotateX(var(--rx)) rotateY(var(--ry)); transform-style: preserve-3d; transition: transform .5s var(--ease); will-change: transform; }
.me-shot.is-tilting { transition: transform .08s linear; }
.me-device { position: relative; display: grid; justify-items: center; }
.me-device::before { content: ''; position: absolute; left: 50%; bottom: 0; width: min(92%, 440px); aspect-ratio: 1; translate: -50% 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #f8ece2 55%, #efd3c4 100%); box-shadow: 0 30px 60px -30px rgba(62, 54, 51, .35); }
.me-device img { position: relative; max-height: 520px; width: auto; margin: 0 auto; filter: drop-shadow(0 18px 24px rgba(62, 54, 51, .18)); transform: translateZ(30px); }
.me-shot figcaption { margin-top: 14px; text-align: center; font-size: 13px; color: var(--ink-nav); }
@media (min-width: 900px) { .me { grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); } }
@media (max-width: 899px) { .me-shot { --rx: 0deg; --ry: 0deg; } .me-device img { max-height: 420px; } }

/* Lavori: particelle che compongono un sito alla volta (sezione alta, contenuto fermo) */
.works { position: relative; height: 520vh; background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 8%, var(--surface-muted) 92%, var(--surface) 100%); }
.works-sticky { position: sticky; top: 64px; height: calc(100vh - 64px); height: calc(100svh - 64px); overflow: hidden; }
.works-stage { position: absolute; inset: 0; }
.works-stage canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.works-in { position: relative; z-index: 1; height: 100%; display: grid; align-items: end; pointer-events: none; }
.works-in a { pointer-events: auto; }
.works-text { padding-bottom: 22px; }
.works h2 { font-size: clamp(28px, 4vw, 52px); line-height: 1.06; margin-bottom: 18px; }
.site-count { margin: 0 0 6px; font-size: 13px; color: var(--ink-nav); }
.site-count [data-site-n] { color: var(--accent-strong); }
.site-now h3 { margin: 0 0 8px; font-size: clamp(24px, 2.6vw, 34px); }
.site-now p[data-site-text] { max-width: 40ch; margin-bottom: 18px; font-size: 15px; }
.site-now.is-swap > * { animation: swap .7s var(--ease) both; }
.site-now.is-swap > *:nth-child(2) { animation-delay: .05s; } .site-now.is-swap > *:nth-child(3) { animation-delay: .1s; } .site-now.is-swap > *:nth-child(4) { animation-delay: .15s; }
@keyframes swap { from { opacity: 0; transform: translateY(14px); } }
.site-list { display: none; }
@media (max-width: 959px) {
  .works { height: 460vh; }
  .works h2 { display: none; }
  .works-text { background: linear-gradient(180deg, rgba(250, 244, 235, 0), var(--surface-muted) 22%); padding-top: 30px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); }
}
@media (min-width: 960px) {
  .works-in { align-items: center; }
  .works-text { max-width: 400px; padding-bottom: 0; }
  .site-list { display: grid; gap: 2px; list-style: none; margin: 30px 0 0; padding: 0; }
  .site-list a { display: flex; gap: 12px; align-items: baseline; padding: 5px 0; font-size: 14px; text-decoration: none; color: var(--ink-nav); transition: color .3s, transform .4s var(--ease); }
  .site-list span { font-size: 11px; color: var(--muted, #c8c2b5); }
  .site-list a:hover, .site-list a[aria-current] { color: var(--ink-heading); transform: translateX(6px); }
  .site-list a[aria-current] span { color: var(--accent-strong); }
}

/* Citazione */
.quote { padding: var(--section) 0; background: var(--secondary); color: rgba(255, 255, 255, .78); overflow: hidden; }
.quote-in { display: grid; gap: 28px; }
.quote blockquote { margin: 0; }
.quote blockquote p { margin: 0 0 18px; font-size: clamp(30px, 4.6vw, 62px); line-height: 1.1; letter-spacing: -.04em; font-weight: 500; color: #fff; max-width: 20ch; }
.quote cite { font-style: normal; font-size: 14px; color: var(--accent); }
.quote-note { max-width: 46ch; font-size: 18px; margin: 0; }
@media (min-width: 960px) { .quote-in { grid-template-columns: 1.4fr 1fr; align-items: end; } }

/* Contatti */
.contact { display: grid; gap: 28px; align-items: center; padding: 34px 26px; background: linear-gradient(150deg, var(--surface-muted), var(--surface-sand)); border: 1px solid rgba(208, 199, 195, .6); box-shadow: 0 30px 60px -36px rgba(62, 54, 51, .45); transform: perspective(1400px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s var(--ease); }
.contact-list { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 10px; }
.contact-list li { display: grid; gap: 2px; }
.contact-list span { font-size: 12px; color: var(--ink-nav); text-transform: uppercase; letter-spacing: .08em; }
.contact-list a { color: var(--ink-heading); text-decoration-color: var(--accent); text-underline-offset: 3px; }
@media (min-width: 760px) {
  .contact { padding: 52px 56px; }
  .contact-text { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 56px; grid-template-areas: "eb list" "title list" "act list"; align-items: start; }
  .contact-text .eyebrow { grid-area: eb; }
  .contact-text h2 { grid-area: title; }
  .contact-text .actions { grid-area: act; }
  .contact-list { grid-area: list; align-self: center; margin: 0; gap: 18px; padding-left: 40px; border-left: 1px solid rgba(208, 199, 195, .8); }
}

/* Piede */
.foot { padding: 40px 0 48px; border-top: 1px solid rgba(208, 199, 195, .5); font-size: 14px; color: var(--ink-nav); }
.foot p { margin: 0 0 8px; max-width: 70ch; }
.foot a { color: var(--ink-heading); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.foot-small { font-size: 12px; }

/* Entrate */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal-3d { opacity: 0; transform: perspective(1200px) translateY(50px) rotateX(28deg); transform-origin: 50% 100%; transition: opacity 1s var(--ease), transform 1.1s var(--ease); }
.is-in.reveal { opacity: 1; transform: none; }
.is-in.reveal-3d { opacity: 1; transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.card.is-in { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.no-js .reveal, .no-js .reveal-3d { opacity: 1; transform: none; }
.tilt-ready { transition: transform .45s var(--ease), box-shadow .5s var(--ease) !important; }

/* Versione app su telefono e tablet: barra a schede in basso, uguale a fabiomiliucci.it (Leo al centro) */
.tabbar { display: none; }
@media (max-width: 900px) {
  :root { --tabbar: calc(66px + env(safe-area-inset-bottom)); }
  html { -webkit-tap-highlight-color: transparent; scroll-padding-top: 64px; }
  body { padding-bottom: var(--tabbar); }
  .hero-sticky, .works-sticky { height: calc(100vh - 64px - var(--tabbar)); height: calc(100svh - 64px - var(--tabbar)); }
  .tabbar { position: fixed; z-index: 120; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 253, 252, .86); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 -1px 0 rgba(92, 72, 59, .1), 0 -18px 40px -30px rgba(60, 40, 25, .45); }
  .tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0 2px; border: 0; background: none; color: var(--ink-nav); font: 500 10.5px/1.1 var(--font); letter-spacing: .01em; text-decoration: none; cursor: pointer; transition: color .25s, transform .2s var(--ease); }
  .tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
  .tab[aria-current="page"] { color: var(--secondary); }
  .tab[aria-current="page"] svg { transform: translateY(-1px) scale(1.06); stroke-width: 1.9; }
  .tab:active { transform: scale(.92); }
  .tab-orb { display: grid; place-items: center; width: 50px; height: 50px; margin-top: -24px; border-radius: 50%; background: var(--secondary); box-shadow: 0 14px 22px -12px rgba(48, 42, 39, .75), inset 0 1px 0 rgba(255, 255, 255, .18); transform: perspective(300px) rotateX(14deg); transition: transform .4s var(--ease), box-shadow .4s; }
  .tab-orb .tab-f { width: 20px; height: auto; fill: var(--surface); stroke: none; }
  .tab-orb .tab-f circle { fill: var(--accent); }
  .tab-punto:active .tab-orb { transform: perspective(300px) rotateX(0) translateY(2px); box-shadow: 0 6px 12px -8px rgba(48, 42, 39, .7); }
  .punto-fab { display: none !important; }
  @media (display-mode: standalone) { html, body { overscroll-behavior-y: none; } }
}
