/* =========================================================================
   Mattia Stigliano — portfolio
   ========================================================================= */

@font-face { font-family: "OffBit Dot Bold"; src: url(/assets/fonts/offbit-dot-bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "OffBit Dot"; src: url(/assets/fonts/offbit-dot.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OffBit"; src: url(/assets/fonts/offbit-regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url(/assets/fonts/inter-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  /* colori (dal sito originale; il grigio è scurito per il contrasto AA) */
  --ink: #1c1b1b;
  --ink-2: #2b2b2b;
  --muted: #6b6b6b;      /* 5.3:1 su bianco (era #878787, 3.5:1) */
  --line: #d2d2d2;
  --surface: #f7f7f7;
  --bg: #ffffff;
  --focus: #1c1b1b;

  /* tipografia */
  --font-dot: "OffBit Dot Bold", ui-monospace, "SF Mono", Menlo, monospace;
  --font-dot-light: "OffBit Dot", var(--font-dot);
  --font-text: "OffBit", ui-monospace, "SF Mono", Menlo, monospace;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* misure */
  --side: 350px;
  --bar: 50px;
  --pad: 20px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-dot);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: fixed; left: 8px; top: 8px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm);
  transform: translateY(-150%); transition: transform .2s var(--ease);
}
.skip-link:focus { transform: none; }

/* icone monocromatiche: <span class="icon" style="--icon:url(...)"> */
.icon {
  display: inline-block; width: 16px; height: 16px; flex: none;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

/* etichette piccole maiuscole (Inter) */
.label {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.4;
}

/* =========================================================================
   Sidebar
   ========================================================================= */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg);
  overflow-y: auto; overscroll-behavior: contain;
  z-index: 10;
}
.side-top { display: flex; flex-direction: column; }
.side-bottom { display: flex; flex-direction: column; margin-top: auto; }

.topbar {
  display: flex;
  align-items: stretch; height: var(--bar);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar__logo {
  flex: 1; min-width: 0;
  display: flex; align-items: center; padding: 0 var(--pad);
  text-decoration: none; font-size: 14px; white-space: nowrap;
}
.logo-text { letter-spacing: .02em; }
.topbar__logo img { height: 24px; width: auto; }
.topbar__clock {
  display: flex; align-items: center; padding: 0 var(--pad);
  font-size: 12px; font-variant-numeric: tabular-nums;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  text-decoration: none; color: var(--ink);
  transition: background-color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface); }
.icon-btn .icon { width: 18px; height: 18px; }
.topbar .icon-btn { width: var(--bar); height: var(--bar); border-left: 1px solid var(--line); }
.topbar__home { display: none; }
body:not(.home) .topbar__home { display: inline-flex; }
.topbar__menu .icon--close { display: none; }
.menu-open .topbar__menu .icon--open { display: none; }
.menu-open .topbar__menu .icon--close { display: inline-block; }

.intro, .menu { padding: 24px var(--pad); display: flex; flex-direction: column; gap: 14px; }
.services { font-size: 16px; line-height: 1.6; letter-spacing: .05em; color: var(--ink-2); }
.tagline { font-size: 13px; line-height: 1.3; color: var(--muted); }
.services + .tagline { margin-top: 6px; }

.menu { display: none; }
.menu-open .intro { display: none; }
.menu-open .menu { display: flex; }
.menu ul { display: flex; flex-direction: column; gap: 4px; }
.menu__main a { font-size: 16px; letter-spacing: .05em; }
.menu__works a { font-size: 16px; }
.menu a { display: inline-block; padding: 4px 0; text-decoration: none; }
.menu a:hover, .menu a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.menu .label + ul { margin-bottom: 14px; }

.side-cta { padding: var(--pad); border-top: 1px solid var(--line); }
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; text-decoration: none; text-align: center;
  transition: transform .15s var(--ease), background-color .15s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--ghost { box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost:hover { background: var(--surface); }

/* strumenti: striscia scorrevole */
.tools { padding: var(--pad) 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.tools .label { padding: 0 var(--pad); color: var(--ink); }
.marquee {
  display: flex; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
  display: flex; flex: none; gap: 28px; padding-right: 28px;
  animation: marquee 22s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee li { display: flex; align-items: center; gap: 6px; font-size: 16px; white-space: nowrap; }
.marquee .icon { width: 14px; height: 14px; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* Spotify: il player vero si carica solo al click */
.spotify { padding: var(--pad); border-top: 1px solid var(--line); }
.spotify__card {
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 14px 14px 18px; min-height: 80px;
}
.spotify__info { flex: 1; min-width: 0; }
.spotify__title { font-family: var(--font-ui); font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spotify__artist { font-family: var(--font-ui); font-size: 13px; color: #c9c9c9; }
.spotify__play {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.spotify__play svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.spotify__note { margin-top: 8px; font-size: 12px; color: var(--muted); }
.spotify iframe { display: block; width: 100%; height: 80px; border: 0; border-radius: 12px; }
.spotify.is-loaded .spotify__note { display: none; }

.site-footer {
  padding: 12px var(--pad) var(--pad); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.social { display: flex; gap: 8px; margin-bottom: 4px; }
.social .icon-btn { border-radius: var(--radius-sm); }
.legal { font-size: 12px; color: var(--ink-2); }
.legal a { color: var(--muted); text-underline-offset: 3px; }
.legal a:hover { color: var(--ink); }

/* =========================================================================
   Contenuto
   ========================================================================= */
.main { margin-left: var(--side); min-height: 100vh; outline: none; }

/* griglia dei lavori */
.works { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.work { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.work:nth-child(2n) { border-right: 0; }
.work__link {
  position: relative; display: block; padding: var(--pad); text-decoration: none;
}
.work__media {
  display: block; aspect-ratio: 545 / 410; overflow: hidden;
  border-radius: var(--radius); background: var(--surface);
}
.work__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.work__label {
  position: absolute; right: calc(var(--pad) + 16px); bottom: calc(var(--pad) + 16px);
  background: #fff; color: var(--ink); font-size: 13px;
  padding: 8px 14px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
@media (hover: hover) {
  .work__label { opacity: 0; transform: translateY(6px); }
  .work__link:hover .work__label, .work__link:focus-visible .work__label { opacity: 1; transform: none; }
  .work__link:hover .work__media img { transform: scale(1.02); }
}

/* barra in alto delle pagine interne */
.page-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: stretch; height: var(--bar);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.page-bar__title { flex: 1; display: flex; align-items: center; padding: 0 var(--pad); }
.page-bar .icon-btn { width: var(--bar); height: var(--bar); border-left: 1px solid var(--line); }

/* progetto: intestazione */
.project-head { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.project-info { padding: 28px var(--pad) 40px; display: flex; flex-direction: column; gap: 22px; border-right: 1px solid var(--line); }
.project-info h1 { font-size: 24px; line-height: 1.2; font-weight: 700; color: var(--ink-2); }
.project-info dl { display: flex; flex-direction: column; gap: 22px; }
.project-info dd, .prose p { font-family: var(--font-text); font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.project-info dt { margin-bottom: 6px; }
.project-cover { background: var(--ink); display: flex; align-items: center; justify-content: center; min-height: 100%; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; }

/* progetto: corpo */
.project-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.project-split > * { padding: 28px var(--pad); }
.project-split > :first-child { border-right: 1px solid var(--line); }
.project-split .media-cell { background: var(--surface); display: flex; align-items: center; justify-content: center; }
.project-split .media-cell img { max-height: 80vh; width: auto; border-radius: var(--radius); }

.prose { display: flex; flex-direction: column; gap: 14px; max-width: 62ch; }
.prose h2 { font-size: 20px; line-height: 1.25; margin-top: 10px; }
.prose h3 { font-size: 16px; }
.big { font-size: 28px; line-height: 1.2; font-weight: 700; word-break: break-word; }
.prose ul { display: flex; flex-direction: column; gap: 10px; }
.prose ul.dots li { padding-left: 1.1em; position: relative; font-family: var(--font-text); }
.prose ul.dots li::before { content: "•"; position: absolute; left: 0; }
.prose strong { display: block; font-family: var(--font-dot); font-weight: 700; color: var(--ink); }
.prose a { text-underline-offset: 4px; word-break: break-word; }

/* galleria */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery figure { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: var(--pad); display: flex; flex-direction: column; gap: 10px; }
.gallery figure:nth-child(2n) { border-right: 0; }
.gallery figure.wide { grid-column: 1 / -1; border-right: 0; }
.gallery .frame { background: var(--surface); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.gallery .frame img { width: 100%; }
.gallery .frame.tall img { width: auto; max-height: 80vh; }
.gallery figcaption { font-size: 13px; color: var(--muted); }

/* navigazione tra progetti */
.project-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-nav a {
  display: flex; align-items: center; gap: 8px; min-height: 80px; padding: 0 var(--pad);
  text-decoration: none; font-size: 16px; transition: background-color .15s var(--ease);
}
.project-nav a:hover { background: var(--surface); }
.project-nav .prev { border-right: 1px solid var(--line); }
.project-nav .next { grid-column: 2; justify-content: flex-end; }

/* about */
.about { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 80px var(--pad) 0; }
.about h1 { font-size: 40px; line-height: 1; letter-spacing: .02em; }
.about p { font-family: var(--font-text); font-size: 16px; color: var(--muted); max-width: 40ch; }
.about img { margin-top: 30px; width: 100%; max-width: 1000px; }

/* how I work */
.section { padding: 40px var(--pad); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.section h1 { font-size: 40px; line-height: 1.05; letter-spacing: .01em; word-break: break-word; }
.price { font-size: 16px; }
.price .blur {
  filter: blur(6px); transition: filter .3s var(--ease); cursor: help;
  -webkit-user-select: none; user-select: none; display: inline-block;
}
.price .blur:hover, .price .blur:focus { filter: none; }
.fine-print { font-family: var(--font-text); color: var(--muted); font-size: 14px; }
.faq { display: flex; flex-direction: column; gap: 8px; max-width: 820px; }
.faq details { background: var(--surface); border-radius: var(--radius-sm); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 14px; font-family: var(--font-ui); font-size: 14px; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; font-family: var(--font-dot); font-size: 18px; width: 14px; text-align: center; transition: transform .2s var(--ease); }
.faq details[open] summary::before { transform: rotate(45deg); }
.faq details p { padding: 0 14px 14px 38px; font-family: var(--font-text); font-size: 15px; color: var(--ink-2); max-width: 70ch; }
.package dl { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.package dt { font-size: 16px; }
.package dd { font-family: var(--font-text); color: var(--muted); }

/* 404 e pagine semplici */
.notfound { padding: 60px var(--pad); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.notfound h1 { font-size: 40px; line-height: 1.1; }
.notfound p { font-family: var(--font-text); color: var(--muted); }
.notfound .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* =========================================================================
   Mobile: una colonna; i lavori subito dopo la presentazione
   ========================================================================= */
@media (max-width: 900px) {
  body { display: flex; flex-direction: column; }
  .side { display: contents; }
  .side-top { order: 1; }
  .main { order: 2; margin-left: 0; min-height: 0; }
  .side-bottom { order: 3; margin-top: 0; border-top: 1px solid var(--line); }
  .topbar { position: sticky; top: 0; z-index: 20; }
  .side-cta { border-top: 0; }
  body:not(.home) .intro { display: none; }

  /* menu a tutto schermo */
  .menu-open { overflow: hidden; }
  .menu-open .menu {
    position: fixed; inset: var(--bar) 0 0 0; z-index: 19;
    background: var(--bg); overflow-y: auto;
  }
  .menu-open .intro { display: flex; }
  body:not(.home).menu-open .intro { display: none; }

  .works, .project-head, .project-split, .gallery { grid-template-columns: 1fr; }
  .work, .gallery figure { border-right: 0; }
  .project-info, .project-split > :first-child { border-right: 0; }
  .project-split > :first-child { border-bottom: 1px solid var(--line); }
  .project-cover { min-height: 0; }
  .page-bar { top: var(--bar); }
  .about { padding-top: 48px; }
  .section h1, .notfound h1 { font-size: 30px; }
  .project-nav a { min-height: 64px; }
}

/* riduci movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
  .marquee__track { animation: none; flex-wrap: wrap; row-gap: 10px; padding: 0 var(--pad); }
  .marquee__track[aria-hidden="true"] { display: none; }
}
.logo-avatar { width: 32px; height: 32px; border-radius: 50%; margin-right: 10px; flex: none; }

/* avviso "Email copied" */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 14px;
  padding: 12px 16px; border-radius: var(--radius-sm); max-width: calc(100vw - 32px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.legal--fine { color: var(--muted); }
