/* ---------- Panoramica: first screen over the map (name, role, CTAs, projects, contacts) ---------- */
.overview {
  position: fixed; inset: 0; z-index: 250; overflow-y: auto; overscroll-behavior: contain;
  transition: visibility 0s;
}
.map-first .overview { display: none; } /* desktop: hidden before the first paint, js/overview.js takes over */
.overview:not(.open) { visibility: hidden; pointer-events: none; transition: visibility 0s .95s; } /* after the closing circle */

/* BACKGROUND — the map, blurred and tinted, inside a circle that opens from the top and closes into the centre.
   The circle is a round element animated only with transform: scale (js/overview.js sets its size and centre).
   Transform runs on the graphics card, so the blur does not need a repaint on every frame and nothing flashes.
   Without JavaScript the layer simply covers the screen. */
.ov-bg {
  position: fixed; inset: 0; z-index: 249; pointer-events: none; /* just under the Panoramica (250) */
  background: rgba(23, 24, 27, .9); /* for browsers without color-mix (Safari before 16.2): never transparent */
  background: color-mix(in srgb, var(--bg) 88%, transparent); /* covering enough to read even where the blur fails */
  backdrop-filter: blur(28px) saturate(.75); -webkit-backdrop-filter: blur(28px) saturate(.75);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); /* a thin rim, visible only while it moves */
  will-change: transform; backface-visibility: hidden;
}

/* CONTENT — waits for the circle on the way in, leaves before it on the way out (opacity only: no repaint) */
.map-first .ov-bg { display: none; }
/* phones and touch screens: a solid background. The map's light cards sit right behind the text, and Safari on iPhone
   can drop the blur or the tint: white text over a light blur becomes invisible. Solid is always readable (and lighter). */
@media (max-width: 680px), (hover: none) and (pointer: coarse) {
  .ov-bg { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
} /* desktop: nothing over the map before js/overview.js takes over */
/* browsers that cannot blur what is behind: a solid background, so the text stays readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .ov-bg { background: var(--bg); } }
.overview > * { transition: opacity .5s ease .4s; }
.overview:not(.open) > * { opacity: 0; transition: opacity .25s ease; }
/* the pieces rise one after another, with a long soft landing (only while opening, see playEntrance).
   Never animate an element that contains the fixed buttons (.ov-close, .ov-back): a transform would unpin them. */
.overview.entering .ov-head > *, .overview.entering .ov-sec {
  animation: ov-in .8s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--d, 0) * 60ms + 420ms);
}
.ov-head > :nth-child(2) { --d: 1; } .ov-head > :nth-child(3) { --d: 2; } .ov-head > :nth-child(n+4) { --d: 3; }
.ov-sec { --d: 4; } .ov-sec + .ov-sec { --d: 5; }
@keyframes ov-in { from { opacity: 0; transform: translate3d(0, 24px, 0); } }

/* the HUD fades away behind the Panoramica (so the blur stays still) and comes back while the circle closes */
.hud { transition: opacity .45s ease .45s; }
.ov-open .hud { opacity: 0; transition: opacity .35s ease; }

@media (prefers-reduced-motion: reduce) {
  .overview, .overview > *, .hud { transition-delay: 0s !important; }
  .overview.entering .ov-head > *, .overview.entering .ov-sec { animation: none; }
}
/* list <-> project page: a short slide of the content (not of the container with the fixed back button) */
.overview.detail #ovDetailBody { animation: ov-swap .35s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes ov-swap { from { opacity: 0; transform: translateX(18px); } }
.ov-inner {
  box-sizing: border-box; width: min(1120px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 64px;
  padding: calc(72px + var(--safe-t)) max(24px, var(--safe-r)) calc(72px + var(--safe-b)) max(24px, var(--safe-l));
}
/* "Esplora la mappa": same look as the "Panoramica" button of the map (.mode-btn in hud.css), pinned in the same spot */
.overview .ov-close { position: fixed; z-index: 1; top: calc(14px + var(--safe-t)); right: max(16px, var(--safe-r)); }

/* who I am */
.ov-head { display: grid; gap: 16px; justify-items: start; }
.ov-kicker { margin: 0; font: 600 12px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--hot); }
.ov-name { overflow-wrap: break-word; margin: 0; font-family: var(--f-display); font-weight: 900; font-stretch: 125%; font-size: clamp(44px, 8.4vw, 112px); line-height: .9; text-transform: uppercase; text-wrap: balance; }
.ov-name:focus { outline: none; }
.ov-role { margin: 4px 0 0; font: 600 14px/1.3 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); }
.ov-value { margin: 0; max-width: 46ch; font-size: clamp(18px, 2vw, 22px); line-height: 1.4; }
.ov-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ov-btn {
  display: inline-flex; align-items: center; height: 46px; padding: 0 20px; border-radius: 12px; cursor: var(--cur-pointer); text-decoration: none;
  border: 1px solid var(--hud-line); background: transparent; color: var(--ink);
  font: 700 12.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
  transition: transform .18s cubic-bezier(.2,.9,.3,1.4), border-color .2s, background .2s, color .2s;
}
.ov-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ov-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.ov-btn:active { transform: scale(.96); }

/* sections */
.ov-sec { display: grid; gap: 18px; scroll-margin-top: 72px; }
.ov-h { margin: 0; font: 600 12px/1 var(--f-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--ink-dim); }

/* projects: same cards as the map, in a plain grid */
.ov-projects { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.ov-proj {
  display: grid; align-content: start; gap: 12px; height: 100%; box-sizing: border-box; padding: 10px; border-radius: 16px; text-decoration: none;
  background: var(--card); color: var(--card-ink); outline: 3px solid transparent; outline-offset: 3px;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), outline-color .15s, box-shadow .22s;
}
.ov-proj:hover, .ov-proj:focus-visible { transform: translateY(-4px); outline-color: var(--accent); box-shadow: 0 24px 40px -22px var(--shadow); }
.ov-thumb { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; }
.ov-thumb img, .ov-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; display: block; }
.ov-txt { display: grid; gap: 6px; padding: 0 6px 6px; }
.ov-txt small { font: 600 10.5px/1.3 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--card-dim); }
.ov-txt b { font-family: var(--f-display); font-weight: 800; font-stretch: 112%; font-size: 21px; line-height: 1.05; }
.ov-txt span { font-size: 14px; line-height: 1.45; color: color-mix(in srgb, var(--card-ink) 80%, var(--card)); }
.ov-projects li { display: grid; }

/* contacts */
.ov-links { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 10px; }
.ov-links a {
  display: inline-flex; align-items: center; height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--hud-line);
  color: var(--ink); text-decoration: none; font: 600 13px/1 var(--f-mono); transition: border-color .2s, color .2s;
}
.ov-links a:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 680px) {
  .ov-inner { gap: 48px; padding-top: calc(80px + var(--safe-t)); }
  .ov-btn { height: 44px; padding: 0 16px; }
}

/* without JavaScript: plain list of the projects */
.ov-plain { margin: 0; padding-left: 20px; display: grid; gap: 10px; max-width: 72ch; line-height: 1.5; }
.ov-plain-note { margin: 0; font-size: 14px; color: var(--ink-dim); }

/* one project inside the Panoramica: pictures left, words right */
.overview.detail .ov-inner { display: none; }
.overview:not(.detail) .ov-detail { display: none; }
.ov-detail { box-sizing: border-box; width: min(1180px, 100%); margin: 0 auto; padding: calc(84px + var(--safe-t)) max(24px, var(--safe-r)) calc(72px + var(--safe-b)) max(24px, var(--safe-l)); }
.ov-back {
  position: fixed; z-index: 1; top: calc(16px + var(--safe-t)); left: max(16px, var(--safe-l));
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; cursor: var(--cur-pointer);
  border: 1px solid var(--hud-line); background: var(--hud); color: var(--ink); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 600 11.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase;
}
.ov-back:hover { border-color: var(--accent); color: var(--accent); }
.pd-page { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 44px; align-items: start; }
.pd-media { position: sticky; top: calc(84px + var(--safe-t)); display: grid; gap: 12px; } /* stops below the pinned buttons */
.pd-page .ins-gallery { margin-top: 0; }
.pd-page .ins-title { font-size: clamp(32px, 4vw, 48px); }
.pd-page .pd-lede { font-size: 18px; }
.pd-page .ins-hero { max-height: 70vh; }
@media (max-width: 700px) {
  .pd-page { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .pd-media { position: static; }
}

/* phones: the two pinned buttons of a project page share the top edge without touching */
.ov-back .t-short { display: none; }
@media (max-width: 680px) {
  .overview .ov-close { height: 44px; padding: 0 14px; gap: 10px; font-size: 12px; }
  .ov-back { height: 44px; }
}
@media (max-width: 480px) {
  .ov-back .t-long { display: none; }
  .ov-back .t-short { display: inline; }
}
