/* ==========================================================================
   pacchiana.de — stili
   Palette scura "da terminale", un colore per ogni stato dei progetti.
   Nessuna risorsa di terze parti; rispetta prefers-reduced-motion.
   ========================================================================== */

/* --- Font (self-hosted, licenza SIL OFL) --------------------------------- */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/space-grotesk-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/space-grotesk-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/space-grotesk-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

/* --- Token --------------------------------------------------------------- */

:root {
  --bg: #07090d;
  --bg-raised: #0c1017;
  --line: rgba(232, 236, 241, .08);
  --line-strong: rgba(232, 236, 241, .16);
  --text: #e8ecf1;
  --muted: #8b95a5;
  --accent: #5ee7ff;
  --live: #3ddc97;
  --rolling: #ffb547;
  --baking: #a78bfa;

  --sans: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --max: 1120px;
  --gutter: clamp(16px, 5vw, 48px);
  --radius: 16px;
  --topbar-h: 68px;
}

/* --- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* boot.js aggiunge .js: la pagina resta invisibile finché site.js non ha
   messo i testi nella lingua giusta (.is-ready). Rete di sicurezza: se
   site.js non parte, l'animazione la mostra comunque dopo 1,5 s. */
.js body {
  opacity: 0;
  animation: failsafe-show 0s 1.5s forwards;
}
.js.is-ready body {
  opacity: 1;
  animation: none;
  transition: opacity .4s ease;
}
@keyframes failsafe-show { to { opacity: 1; } }

::selection { background: rgba(94, 231, 255, .28); color: #fff; }

a { color: inherit; }

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

img, svg { display: block; max-width: 100%; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Le chiavi vuote del dizionario (es. la nota sull'Impressum in tedesco)
   non lasciano un paragrafo vuoto. */
[data-i18n]:empty { display: none; }

/* --- Sfondo: due bagliori e una griglia di punti che sfuma --------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(56rem 38rem at 88% -12%, rgba(94, 231, 255, .11), transparent 62%),
    radial-gradient(44rem 34rem at -12% 38%, rgba(167, 139, 250, .08), transparent 62%),
    var(--bg);
}
.backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(232, 236, 241, .085) 1px, transparent 0);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}

/* --- Barra in alto ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 9, 13, .72);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  min-height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark__path { color: var(--muted); }
.wordmark__cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }

.langs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: -10px; /* l'area di tocco sporge, la bandiera resta allineata */
}

.langs__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.flag {
  width: 26px;
  height: 18px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
  opacity: .45;
  filter: saturate(.55);
  transition: opacity .2s ease, filter .2s ease, box-shadow .2s ease, transform .2s ease;
}

.langs__btn:hover .flag { opacity: .85; filter: none; }

.langs__btn[aria-pressed="true"] .flag {
  opacity: 1;
  filter: none;
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 2.5px var(--accent);
}

/* --- Pagina -------------------------------------------------------------- */

.page {
  flex: 1;
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  padding: clamp(56px, 13vw, 148px) 0 clamp(40px, 7vw, 72px);
}

.eyebrow {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--accent);
}

.hero__title {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.5rem, 8.2vw, 5.4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.035em;
  overflow-wrap: break-word;
}

.hero__title em {
  font-style: normal;
  background: linear-gradient(95deg, var(--accent) 0%, var(--baking) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  margin: 28px 0 0;
  max-width: 36rem;
  font-size: clamp(1.05rem, 2.1vw, 1.2rem);
  line-height: 1.65;
  color: var(--muted);
}

.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 40px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--text);
  background: rgba(12, 16, 23, .55);
  transition: border-color .2s ease, background-color .2s ease;
}
.toc a:hover { border-color: rgba(232, 236, 241, .32); background: rgba(12, 16, 23, .9); }

/* --- Indicatori di stato: ● live  ◐ rolling out  ◌ baking ---------------- */

.status {
  flex: none;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status--live {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, .55);
  animation: pulse 2.2s ease-out infinite;
}

.status--rolling {
  border: 1.5px solid var(--rolling);
  background: linear-gradient(90deg, var(--rolling) 50%, transparent 50%);
}

.status--baking {
  border: 1.5px dashed var(--baking);
  animation: spin 7s linear infinite;
}

/* --- Sezioni ------------------------------------------------------------- */

.stage {
  --c: var(--accent);
  position: relative;
  margin-top: clamp(48px, 8vw, 96px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.stage--live { --c: var(--live); }
.stage--rolling { --c: var(--rolling); }
.stage--baking { --c: var(--baking); }

/* Un segmento del colore di stato sulla riga che apre la sezione */
.stage::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 72px;
  height: 1px;
  background: var(--c);
  box-shadow: 0 0 14px var(--c);
}

.stage__head {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 18px;
  align-items: baseline;
  margin-bottom: 28px;
}

.stage__index {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.stage__title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-size: clamp(1.55rem, 3.6vw, 2.15rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.stage__title .status { width: 12px; height: 12px; }

.stage__sub {
  grid-column: 2;
  margin: 6px 0 0;
  color: var(--muted);
}

/* --- Live: slot in attesa ------------------------------------------------ */

.slot {
  padding: clamp(24px, 4vw, 36px);
  border: 1px dashed rgba(61, 220, 151, .32);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(61, 220, 151, .06), transparent 55%),
    rgba(12, 16, 23, .6);
}

.slot__cmd {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(14px, 2.4vw, 17px);
  color: var(--text);
}
.slot__prompt { color: var(--live); margin-right: 4px; }

.cursor {
  color: var(--live);
  animation: blink 1.1s steps(1) infinite;
}

.slot__note {
  margin: 10px 0 0;
  color: var(--muted);
}

/* --- Rolling out: card progetto ------------------------------------------ */

.project {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "logo body"
    "cta  cta";
  align-items: center;
  gap: 18px 20px;
  padding: clamp(20px, 3.4vw, 32px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    radial-gradient(28rem 16rem at 100% 0%, rgba(255, 181, 71, .10), transparent 70%),
    var(--bg-raised);
  text-decoration: none;
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.project:hover {
  border-color: rgba(255, 181, 71, .45);
  transform: translateY(-2px);
  box-shadow: 0 18px 50px -24px rgba(255, 181, 71, .35);
}

.project__logo {
  grid-area: logo;
  width: clamp(64px, 12vw, 96px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 18px;
}

.project__body { grid-area: body; min-width: 0; }

.project__name {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.project__tagline {
  margin: 4px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--text);
}

.project__desc {
  margin: 6px 0 0;
  font-size: .95rem;
  color: var(--muted);
}

.project__cta {
  grid-area: cta;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid rgba(255, 181, 71, .4);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--rolling);
  white-space: nowrap;
}

.project__arrow { transition: transform .25s ease; }
.project:hover .project__arrow { transform: translateX(4px); }

@media (min-width: 720px) {
  .project {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "logo body cta";
    column-gap: 28px;
  }
}

/* --- Baking: solo silhouette sfocate, nomi illeggibili -------------------- */
/* Riservatezza: le immagini sono già sfocate nel file (le versioni nitide
   restano in 00_inputs/ e non vanno pubblicate) e il nome sfocato è un testo
   finto. Nel sorgente non c'è niente da leggere. */

.oven {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(16px, 2.4vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bake {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
  background: #0b0d12; /* finché l'immagine non è caricata */
}

/* Livello immagine: separato dal testo, così si può animare da solo */
.bake::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -2;
  background: no-repeat center / cover;
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
}

/* Sfumatura piena: la silhouette si intuisce appena */
.bake::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(7, 9, 13, .35) 0%, rgba(7, 9, 13, .5) 50%, rgba(7, 9, 13, .92) 100%),
    linear-gradient(135deg, rgba(167, 139, 250, .08), transparent 60%);
}

.bake:hover::before { transform: scale(1.03); }

/* Le immagini stanno qui e non in style="": la CSP blocca gli stili inline */
.bake--1::before { background-image: url('../img/baking-1.webp'); }
.bake--2::before { background-image: url('../img/baking-2.webp'); }

.bake__content {
  position: absolute;
  inset: auto 0 0 0;
  padding: clamp(18px, 3vw, 26px);
}

.bake__name {
  margin: 0;
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -.015em;
  line-height: 1.2;
}

/* Il nome si vede come forma, non si legge */
.bake__veil {
  display: inline-block;
  filter: blur(7px);
  opacity: .75;
  user-select: none;
  -webkit-user-select: none;
}

.bake__status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 13px;
  color: #c9c1f7;
}

/* --- Footer -------------------------------------------------------------- */

.footer {
  margin-top: clamp(72px, 12vw, 140px);
  border-top: 1px solid var(--line);
}

.footer__inner {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding:
    24px max(var(--gutter), env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.footer__line { margin: 0; display: flex; flex-wrap: wrap; align-items: center; }
.footer__sep { margin: 0 10px; opacity: .6; }

/* Su schermi stretti l'email va sotto il nome: il punto non resta appeso */
@media (max-width: 480px) {
  .footer__line { flex-direction: column; align-items: flex-start; gap: 6px; }
  .footer__sep { display: none; }
}

.footer__links { display: flex; flex-wrap: wrap; gap: 4px 20px; }

.footer a {
  display: inline-block;
  padding: 10px 0; /* area di tocco più alta senza spostare il testo */
  margin: -10px 0;
  text-decoration: none;
  transition: color .2s ease;
}
.footer a:hover { color: var(--text); }

.footer__consent {
  padding: 10px 0;
  margin: -10px 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: color .2s ease;
}
.footer__consent:hover { color: var(--text); }

/* --- Banner del consenso (Google Analytics, opt-in) ---------------------- */
/* I due pulsanti hanno lo stesso peso visivo: rifiutare è facile quanto accettare */

.consent {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  padding:
    0 max(var(--gutter), env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
}

.consent__box {
  pointer-events: auto;
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 20px 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(12, 16, 23, .94);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .85);
  animation: consent-in .5s cubic-bezier(.2, .7, .2, 1) both;
}

.consent__title {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.consent__text {
  margin: 0;
  font-size: .92rem;
  line-height: 1.55;
  color: #c3cad5;
}
.consent__text a { color: var(--accent); text-underline-offset: 3px; }

.consent__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.consent__btn {
  flex: 1;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(232, 236, 241, .04);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.consent__btn:hover { border-color: var(--accent); background: rgba(94, 231, 255, .08); }

@media (min-width: 560px) {
  .consent__actions { justify-content: flex-end; }
  .consent__btn { flex: none; min-width: 140px; }
}

@keyframes consent-in {
  from { opacity: 0; transform: translateY(16px); }
}

/* --- Pagine legali ------------------------------------------------------- */

.legal {
  max-width: 46rem;
  padding: clamp(40px, 8vw, 88px) 0 0;
}

.legal__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.legal__back:hover { color: var(--text); }

.legal h1 {
  margin: 12px 0 0;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.1;
}

.legal__note {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 2px solid var(--accent);
  background: rgba(94, 231, 255, .06);
  color: var(--muted);
  font-size: .95rem;
}

.legal h2 {
  margin: 40px 0 10px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.01em;
}

.legal p, .legal li { color: #c3cad5; overflow-wrap: anywhere; }
.legal p { margin: 0 0 12px; }
.legal ul { margin: 0 0 12px; padding-left: 1.2rem; }
.legal a { color: var(--accent); text-underline-offset: 3px; }
.legal address { font-style: normal; }

.legal__stand {
  margin-top: 40px !important;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted) !important;
}

/* --- Rivelazione allo scroll (solo quando site.js è partito) ------------- */

.is-ready .reveal {
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.is-ready .reveal:not(.is-in) {
  opacity: 0;
  transform: translateY(16px);
}
.hero .reveal:nth-child(2) { transition-delay: .08s; }
.hero .reveal:nth-child(3) { transition-delay: .16s; }
.hero .reveal:nth-child(4) { transition-delay: .24s; }
.oven .reveal:nth-child(2) { transition-delay: .1s; }

/* --- Animazioni ---------------------------------------------------------- */

@keyframes blink { 50% { opacity: 0; } }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, .55); }
  70%, 100% { box-shadow: 0 0 0 9px rgba(61, 220, 151, 0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .is-ready .reveal:not(.is-in) { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
