/* ==========================================================================
   Portfolio Daniele Capoferri — stile unico per tutte le pagine
   Valori presi 1:1 dal file Figma "Portfolio" (node 4238:6123)
   ========================================================================== */

:root {
  --ink: #2a2a2a;        /* titoli, nav attiva */
  --text: #3f3f48;       /* testo corrente */
  --muted: #71717c;      /* date, meta, "Insight 0X" */
  --soft: #9f9fa9;
  --link: #006de4;       /* link blu */
  --link-hover: #0087d7; /* link blu all'hover */
  --surface: #f7f7f7;    /* sfondo visual / video */
  --pill: #27272a;       /* bottoni tondi header case study */
  --pill-ink: #f4f4f5;
  --rule-blue: #006de4;  /* barra insight */
  --rule-grey: #babab8;  /* barra nota pre-approval */
  --error: #b42318;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: "Satoshi", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 26px;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { display: block; max-width: 100%; }
h1, h2, h3, p, blockquote { font-size: inherit; font-weight: inherit; line-height: inherit; }
strong { font-weight: 700; }
em { font-style: italic; font-weight: 500; }
button { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

/* Manina su tutti gli elementi interattivi */
a[href], button, label[for], [role="tab"], .carousel { cursor: pointer; }
a:not([href]) { cursor: default; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }

.link { color: var(--link); transition: color .15s ease; }
a.link[href]:hover { color: var(--link-hover); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Layout pagina (Main Content 640, padding 48/20) ---------- */
.page {
  width: 640px;
  max-width: 100%;
  margin: 0 auto;
  padding: 48px 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.page--case { gap: 32px; padding-bottom: 112px; }

.stack    { display: flex; flex-direction: column; gap: 16px; }
.stack-24 { display: flex; flex-direction: column; gap: 24px; }
.stack-32 { display: flex; flex-direction: column; gap: 32px; }
.stack-48 { display: flex; flex-direction: column; gap: 48px; }

/* ---------- Nav Home / About ---------- */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  line-height: 26px;
  font-weight: 400;
}
.topnav a { font-weight: 400; color: var(--text); }
.topnav a[aria-current="page"] { font-weight: 700; color: var(--ink); cursor: default; }
.navlink { background: none; border: 0; padding: 0; font-weight: 400; color: var(--text); line-height: 26px; }
.navlink:hover,
.topnav a[href]:not([aria-current]):hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.topnav .sep { font-weight: 300; font-size: 14px; color: var(--text); }

/* ---------- Profilo ---------- */
.profile { display: flex; align-items: center; gap: 20px; height: 84px; }
.profile__avatar {
  width: 64px; height: 64px; flex: none;
  border-radius: 50%; object-fit: cover; background: var(--surface);
}
.profile__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile__name { font-weight: 700; line-height: 24px; color: var(--ink); }
.profile__role { line-height: 24px; color: var(--text); }

/* ---------- Home: card progetti ---------- */
.projects { padding-top: 48px; display: flex; flex-direction: column; gap: 40px; }
.card {
  display: block;
  position: relative;
  border-radius: 25px;
  overflow: hidden;
  aspect-ratio: 600 / 420;
  background: var(--surface);
}
.card img { width: 100%; height: 100%; object-fit: cover; }
.more { padding-top: 24px; }

/* ---------- About ---------- */
.cv-block { padding-top: 48px; display: flex; flex-direction: column; gap: 16px; }
.h-small { font-size: 16px; line-height: 24px; font-weight: 700; color: var(--ink); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.row--26 { line-height: 26px; }
.row--24 { line-height: 24px; }
.row .sep { font-weight: 300; font-size: 14px; }
.meta { font-size: 14px; line-height: 20px; color: var(--muted); white-space: nowrap; }
.entry-sub { font-size: 14px; line-height: 20px; color: var(--muted); }
.contact { display: flex; justify-content: space-between; align-items: center; gap: 16px; line-height: 24px; color: var(--text); }
.contact svg { flex: none; color: var(--link); transition: color .15s ease; }
.contact[href]:hover svg { color: var(--link-hover); }

/* ---------- Case study: header ---------- */
.case-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; height: 40px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--link); line-height: 26px; transition: color .15s ease; }
.back:hover { color: var(--link-hover); }
.pills { display: flex; align-items: center; gap: 12px; }
.pill {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pill); color: var(--pill-ink);
  font-size: 12px; line-height: 24px; font-weight: 700;
}
.pill { border: 0; padding: 0; transition: background .15s ease; }
.pill[href]:hover, button.pill:hover { background: #3a3a3e; }

/* ---------- Case study: tipografia ---------- */
.case-title { font-size: 24px; line-height: 34px; font-weight: 700; color: var(--ink); }
.lede { line-height: 22px; }
.h2 { font-size: 20px; line-height: 28px; font-weight: 700; color: var(--ink); }
.case ol, .case ul { padding-left: 24px; }
.ink { color: var(--ink); }
.small-muted { font-size: 14px; color: var(--muted); }

/* ---------- Visual & video ---------- */
.media { padding: 24px 0 20px; }
.media--16 { padding: 16px 0; }
.media--stack { padding: 24px 0 41px; display: flex; flex-direction: column; gap: 16px; }
.frame {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.frame--25 { border-radius: 25px; }
.frame img, .frame video { width: 100%; height: 100%; object-fit: cover; }
.pair { display: flex; gap: 12px; }
.pair > .frame { flex: 1 1 0; min-width: 0; }

/* Etichetta mostrata finché il video non è caricato */
.frame__placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 20px; line-height: 28px; font-weight: 700; color: var(--ink);
  pointer-events: none;
}
.frame.is-ready .frame__placeholder { display: none; }
.frame video { position: absolute; inset: 0; }

/* ---------- Insight / note con barra laterale ---------- */
.insights { padding-top: 16px; display: flex; flex-direction: column; gap: 28px; }
.quote { position: relative; padding: 0 12px; margin: -8px 0; }
.quote::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; background: var(--rule-blue);
}
.quote--note { font-size: 14px; margin: -3px 0; }
.quote--note::before { top: 3px; bottom: 3px; background: var(--rule-grey); }

/* ---------- Accordion ---------- */
.accordion__trigger {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer;
  line-height: 26px; color: var(--ink); text-align: left;
}
.accordion__trigger svg { transition: transform .2s ease; flex: none; }
.accordion__trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.accordion__panel { padding-top: 8px; }
.accordion__panel--media { padding-top: 0; }
.accordion__panel[hidden] { display: none; }

/* ---------- Carosello (indicatore stile "stories" come in Figma) ---------- */
.carousel { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.carousel__track { display: flex; height: 100%; transition: transform .5s cubic-bezier(.4, 0, .2, 1); }
.carousel__slide { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.carousel__dots {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px;
  height: 20px; padding: 0 8px; border-radius: 10px;
  background: rgba(0, 0, 0, .36);
}
.carousel__dot {
  position: relative; width: 6px; height: 6px; padding: 0; border: 0; border-radius: 3px;
  background: rgba(255, 255, 255, .62); overflow: hidden;
  transition: width .3s ease;
}
.carousel__dot::after { content: ""; position: absolute; inset: -7px -4px; } /* area di click più comoda */
.carousel__dot.is-active { width: 24px; }
.carousel__dot span {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: #fff; border-radius: 3px;
}
.carousel__dot.is-active span { animation: carousel-progress var(--carousel-time, 6s) linear forwards; }
.carousel.is-paused .carousel__dot.is-active span { animation-play-state: paused; }
.carousel.is-static .carousel__dot.is-active span { animation: none; width: 100%; }
@keyframes carousel-progress { from { width: 0; } to { width: 100%; } }

/* ---------- Blocchi centrati ---------- */
.divein { padding: 80px 0; text-align: center; line-height: 24px; color: var(--ink); }
.thanks { padding: 40px 0; text-align: center; line-height: 24px; color: var(--ink); }

/* ---------- Pagina password ---------- */
.gate { display: flex; flex-direction: column; gap: 16px; max-width: 420px; }
.gate form { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.gate label { font-size: 14px; line-height: 20px; color: var(--muted); }
.gate input {
  height: 44px; padding: 0 14px;
  border: 1px solid #d4d4d8; border-radius: 12px;
  font: inherit; color: var(--ink); background: #fff;
}
.gate input:focus-visible { outline: 2px solid var(--link); outline-offset: 0; border-color: transparent; }
.gate button {
  align-self: flex-start; height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--pill); color: var(--pill-ink); font-weight: 700;
}
.gate button:hover { background: #3a3a3e; }
.gate__error { color: var(--error); font-size: 14px; line-height: 20px; }

/* ---------- Conferma "Email copied" ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 10;
  transform: translate(-50%, 8px);
  padding: 8px 16px; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink);
  font-size: 14px; line-height: 20px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .pair { flex-direction: column; }
  .row { flex-wrap: wrap; row-gap: 0; }
  .topnav .label-long { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .carousel__dot.is-active span { animation: none; width: 100%; }
}
