/* KOLOB edizioni — homepage */

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
.container { width: min(var(--w), 90vw); margin: 0 auto; }

/* ─── STARFIELD CANVAS ─── */
#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── All content above starfield ─── */
.topbar, main, .site-footer { position: relative; z-index: 1; }

/* ─── SKIP ─── */
.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--gold); color: var(--bg);
  padding: 8px 14px; font-size: 13px;
}
.skip:focus { left: 10px; z-index: 9999; }

/* ─── TOPBAR ─── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background .4s, border-color .4s;
}
.topbar.scrolled {
  background: rgba(8,9,12,.88);
  border-bottom-color: var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0;
  transition: padding .3s;
}
.topbar.scrolled .topbar__inner { padding: 14px 0; }

.brand {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none;
}
.brand__star {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  position: relative;
}
.brand__star svg { width: 44px; height: 44px; }
.brand__text {
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1;
}
.brand__text strong { color: var(--text-bright); font-weight: 600; }
.brand__text span {
  color: var(--muted);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: .08em;
}

.nav { display: flex; gap: 6px; align-items: center; }
.nav a {
  font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 8px 14px; transition: color .25s;
}
.nav a:hover { color: var(--text-bright); }
.nav a[aria-current="page"] { color: var(--text-bright); }
.nav .pill {
  border: 1px solid var(--line-bright); margin-left: 8px;
  color: var(--gold) !important; transition: all .25s;
}
.nav .pill:hover { border-color: var(--gold-dim); background: var(--gold-dim); }

.nav__toggle {
  display: none; border: 1px solid var(--line-bright);
  background: transparent; color: var(--text);
  padding: 8px 12px; font-size: 18px; cursor: pointer;
}

/* ─── HERO ─── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 900px 600px at 15% 30%, rgba(201,168,76,.05), transparent),
    radial-gradient(ellipse 700px 500px at 85% 60%, rgba(123,167,201,.03), transparent);
  pointer-events: none;
}

.hero .container { position: relative; z-index: 2; padding: 140px 0 80px; }
.hero__grid {
  display: grid; grid-template-columns: 1fr 360px;
  gap: 60px; align-items: center;
}

.hero__overline {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 28px;
}
.hero__overline i { font-size: 14px; }

.hero__novita {
  display: inline-flex; align-items: center; gap: 12px;
  max-width: 100%; margin: -8px 0 32px;
  padding: 9px 16px 9px 9px;
  border: 1px solid var(--line-bright); border-radius: 999px;
  background: var(--gold-glow);
  font-family: var(--sans); font-size: 14px; line-height: 1.35; color: var(--text);
  text-decoration: none;
  transition: border-color .3s, color .3s;
  animation: novitaIn .8s .3s both;
}
.hero__novita[hidden] { display: none; }
.hero__novita:hover { border-color: var(--gold); color: var(--text-bright); }
.hero__novita-etichetta {
  flex: none; padding: 4px 10px; border-radius: 999px;
  background: var(--gold); color: var(--bg);
  font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
}
.hero__novita i { flex: none; color: var(--gold); transition: transform .3s; }
.hero__novita:hover i { transform: translateX(3px); }
@keyframes novitaIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(46px, 5.5vw, 72px);
  font-weight: 500; line-height: 1.08;
  color: var(--text-bright); margin-bottom: 24px;
}
.hero h1 em { font-style: italic; color: var(--gold); }

.hero__lead {
  font-family: var(--serif); font-size: 21px; line-height: 1.55; color: var(--muted-light);
  max-width: 52ch; margin-bottom: 40px;
}

.hero__cta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 56px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px;
  font-family: var(--sans);
  font-size: 13px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid var(--line-bright);
  background: transparent; color: var(--text-bright);
  cursor: pointer; transition: all .3s; text-decoration: none;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn--primary { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.btn--primary:hover { background: #d4b358; border-color: #d4b358; color: var(--bg); }
.btn i { font-size: 14px; }

.hero__stats { list-style: none; display: flex; gap: 48px; }
.hero__stats li { position: relative; padding-left: 16px; }
.hero__stats li::before {
  content: ''; position: absolute; left: 0; top: 4px;
  width: 1px; height: 36px; background: var(--gold-dim);
}
.hero__stats li:first-child::before { display: none; }
.hero__stats li:first-child { padding-left: 0; }
.hero__stats strong {
  display: block; font-family: var(--serif);
  font-size: 28px; font-weight: 500; color: var(--text-bright); line-height: 1.2;
}
.hero__stats span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Hero: ritratto dei fondatori */
.hero__portrait { position: relative; margin: 0; }
.hero__portrait-foto > img {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 3; object-fit: cover;
  border: 1px solid var(--line-bright); box-shadow: var(--shadow);
}
/* Senza JS resta sopra il ritratto; durante il volo segue il lettore. */
.hero__fujot {
  position: absolute;
  z-index: 4;
  width: clamp(150px, 18vw, 230px);
  top: -70px;
  right: -20px;
  pointer-events: none;
  user-select: none;
  padding: 0; border: 0; background: none; color: inherit;
}
.js .hero__fujot { pointer-events: auto; cursor: pointer; }
.hero__fujot:focus-visible { outline: 2px dashed var(--gold); outline-offset: 6px; }
.hero__fujot[hidden] { display: none; }
.js .hero__fujot--fuga { pointer-events: none; }
.hero__fujot--fuga .hero__fujot-corpo { animation-play-state: paused; }
.hero__fujot--volo { position: fixed; top: 0; left: 0; right: auto; z-index: 90; }
.hero__fujot-corpo { display: block; position: relative; animation: fujotGalleggia 5s ease-in-out infinite; }
.hero__fujot-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.4));
}
.hero__fujot-fiamma {
  position: absolute;
  left: 47%; top: 58%; width: 7%; height: 19%;
  transform-origin: 50% 100%;
  border-radius: 80% 20% 55% 45% / 75% 65% 35% 25%;
  background: radial-gradient(ellipse at 50% 85%, #fffde1 8%, #ffe979 35%, #ffae32 65%, transparent 78%);
  filter: blur(.6px) drop-shadow(0 0 5px #ff9a26);
  mix-blend-mode: screen;
  animation: fujotFiamma .23s ease-in-out infinite alternate;
}
@keyframes fujotFiamma {
  0% { opacity: .55; transform: scale(.85, .8) skewX(-7deg); }
  55% { opacity: .95; transform: scale(1.12, 1.08) skewX(5deg); }
  100% { opacity: .7; transform: scale(.92, 1.18) skewX(-3deg); }
}
@keyframes fujotGalleggia {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(4deg); }
}

/* Il recapito: la scheda del libro che il fujot porta da Kolob (sito.js) */
.recapito {
  position: fixed; z-index: 89; right: 28px; bottom: 28px;
  width: min(400px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  background: rgba(12,13,18,.96); border: 1px solid var(--line-bright);
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(201,168,76,.08), 0 0 50px -18px var(--gold);
  opacity: 0; transform: translateY(14px);
  transition: opacity .3s, transform .3s;
}
.recapito[hidden] { display: none; }
.recapito--aperto { opacity: 1; transform: none; }
.recapito:focus { outline: none; }
.recapito__etichetta {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
  margin-bottom: 16px; padding-right: 32px;
}
.recapito__chiudi {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px;
  display: grid; place-items: center; padding: 0;
  background: none; border: 1px solid transparent; color: var(--muted-light); cursor: pointer;
  transition: color .2s, border-color .2s;
}
.recapito__chiudi:hover, .recapito__chiudi:focus-visible { color: var(--text-bright); border-color: var(--line-bright); }
.recapito__scheda { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: start; }
.recapito__copertina { display: block; box-shadow: 0 10px 24px rgba(0,0,0,.55), 0 0 0 1px var(--line); }
.recapito__copertina img { display: block; width: 100%; height: auto; }
.recapito__meta { min-width: 0; }
.recapito__meta .book__collana { margin-bottom: 6px; }
.recapito__meta h3 {
  font-family: var(--serif); font-size: 23px; font-weight: 500; line-height: 1.15;
  color: var(--text-bright); margin-bottom: 6px;
}
.recapito__meta .book__links { margin-top: 12px; }
.recapito__azioni { display: flex; align-items: center; gap: 8px 16px; margin-top: 16px; flex-wrap: wrap; }
.recapito__altro {
  flex: 1 1 auto; padding: 10px 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px solid var(--line-bright); color: var(--muted-light);
  font-family: var(--sans); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.recapito__altro:hover, .recapito__altro:focus-visible { color: var(--text-bright); border-color: var(--gold); }
/* Mandare via il fujot e richiamarlo */
.recapito__via, .fujot-via, .hero__richiama {
  font-family: var(--sans); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: color .2s, border-color .2s;
}
.recapito__via {
  padding: 10px 2px; background: none; border: 0; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-bright);
}
.recapito__via:hover, .recapito__via:focus-visible { color: var(--text-bright); }
.fujot-via {
  position: fixed; z-index: 88; left: 20px; bottom: 20px;
  padding: 8px 12px; background: rgba(12,13,18,.9); border: 1px solid var(--line-bright); color: var(--muted-light);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.fujot-via:hover, .fujot-via:focus-visible { color: var(--text-bright); border-color: var(--gold); }
.fujot-via[hidden], .hero__richiama[hidden] { display: none; }
.fujot-via i, .hero__richiama i { font-size: 11px; }
.hero__richiama {
  position: absolute; z-index: 3; top: -36px; right: 0;
  padding: 6px 0; background: none; border: 0; color: var(--gold);
}
.hero__richiama:hover, .hero__richiama:focus-visible { color: var(--text-bright); }
@media (max-width: 600px) {
  .recapito { right: 16px; bottom: 16px; padding: 18px 16px 14px; }
  .fujot-via { left: 16px; bottom: 16px; }
  .recapito__scheda { grid-template-columns: 76px 1fr; gap: 14px; }
  .recapito__meta h3 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .recapito { transition: none; transform: none; }
}
/* Easter egg: i visi cliccabili e il fumetto */
.hero__portrait-foto { position: relative; }
.hero__viso {
  position: absolute; left: var(--x); top: var(--y); width: var(--d); aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.hero__viso:focus-visible { outline: 2px dashed var(--gold); outline-offset: 2px; }
.fumetto {
  position: absolute; z-index: 3; left: var(--x); transform: translateX(-50%);
  width: max-content; max-width: min(250px, 84%);
  background: var(--text-bright); color: var(--bg);
  font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.3;
  padding: 12px 18px; border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  animation: fumettoIn .25s cubic-bezier(.2,.9,.3,1.3);
}
.fumetto[hidden] { display: none; }
/* La punta del fumetto, rivolta verso il viso */
.fumetto::after {
  content: ""; position: absolute; left: 50%; margin-left: -9px;
  border: 9px solid transparent;
}
.fumetto--sopra { bottom: calc(100% - var(--y) + var(--d) * .4); }
.fumetto--sopra::after { top: 100%; border-top-color: var(--text-bright); }
.fumetto--sotto { top: calc(var(--y) + var(--d) * .4); }
.fumetto--sotto::after { bottom: 100%; border-bottom-color: var(--text-bright); }
@keyframes fumettoIn { from { opacity: 0; transform: translateX(-50%) scale(.6); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

.hero__portrait figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  margin-top: 16px;
}
.hero__portrait-names {
  font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted-light);
}
.hero__portrait-link {
  flex-shrink: 0;
  font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold); display: inline-flex; align-items: center; gap: 6px; transition: gap .2s;
}
.hero__portrait-link:hover { gap: 10px; }
.hero__portrait-link i { font-size: 11px; }

/* ─── DIVIDER ─── */
.divider {
  width: min(var(--w), 90vw); margin: 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-bright), transparent);
}

/* ─── SECTIONS ─── */
.section { padding: 100px 0; position: relative; }

.section__label {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.section__label i { font-size: 14px; }

.section__title {
  font-family: var(--serif);
  font-size: clamp(30px, 3.5vw, 46px);
  font-weight: 500; color: var(--text-bright);
  line-height: 1.15; margin-bottom: 12px;
}

.section__desc {
  font-family: var(--serif); font-size: 20px; line-height: 1.55; color: var(--muted-light);
  max-width: 75ch; margin-bottom: 48px;
}

/* Titolo e sottotitolo nella colonna centrata di «La nostra storia» (testo allineato a sinistra) */
.section__colonna { max-width: 760px; margin-inline: auto; }
.section__colonna .section__desc { max-width: none; }

/* ═══════════════════════════════════════════
   COLLANE — Cards with dynamics
═══════════════════════════════════════════ */
.collane-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.collana {
  --collana-pad-y: 40px;
  padding: var(--collana-pad-y) 28px;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  position: relative;
  border: 1px solid rgba(255,255,255,.06);
  transform-style: preserve-3d;
  will-change: transform;
  overflow: hidden;
}

/* Luce sul bordo al passaggio nel terzo colore della collana */
.collana::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    transparent 0%,
    color-mix(in srgb, var(--card-third) 30%, transparent) 10%,
    transparent 20%,
    transparent 100%
  );
  z-index: -1;
  opacity: 0;
  transition: opacity .5s;
}
.collana:hover::before { opacity: 1; }

/* Inner bg layer so ::before glow shows at border */
.collana::after {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 0;
}
.collana-ellissi::after { background-color: var(--bg-ellissi); }
.collana-kobaia::after     { background-color: var(--bg-kobaia); }
.collana-inganni::after   { background-color: var(--bg-inganni); }
.collana-god::after       { background-color: var(--bg-god); }
.collana-finisterre::after      { background-color: var(--bg-finisterre); }
.collana-asterismi::after { background-color: var(--bg-asterismi); }

/* Sfondi pieni */
.collana-ellissi { background-color: var(--bg-ellissi); }
.collana-kobaia     { background-color: var(--bg-kobaia); }
.collana-inganni   { background-color: var(--bg-inganni); }
.collana-god       { background-color: var(--bg-god); }
.collana-finisterre      { background-color: var(--bg-finisterre); }
.collana-asterismi { background-color: var(--bg-asterismi); }

/* Accenti specifici delle collane: bordi, tag e micro-luce dell'icona */
.collana-ellissi    { --card-accent: var(--accent-ellissi);    --card-third: var(--third-ellissi); }
.collana-kobaia     { --card-accent: var(--accent-kobaia);     --card-third: var(--third-kobaia); }
.collana-inganni    { --card-accent: var(--accent-inganni);    --card-third: var(--third-inganni); }
.collana-god        { --card-accent: var(--accent-god);        --card-third: var(--third-god); }
.collana-finisterre { --card-accent: var(--accent-finisterre); --card-third: var(--third-finisterre); }
.collana-asterismi  { --card-accent: var(--accent-asterismi);  --card-third: var(--third-asterismi); }
.collana { --card-border: color-mix(in srgb, var(--card-accent) 64%, transparent); }

.collana .tag {
  background: color-mix(in srgb, var(--card-accent) 16%, transparent);
}
.collana__icon img {
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)) drop-shadow(0 0 10px color-mix(in srgb, var(--card-accent) 28%, transparent));
}

/* Floating idle animation */
.collana:nth-child(1) { animation: cardFloat 6s ease-in-out infinite; }
.collana:nth-child(2) { animation: cardFloat 7s ease-in-out infinite .5s; }
.collana:nth-child(3) { animation: cardFloat 5.5s ease-in-out infinite 1s; }
.collana:nth-child(4) { animation: cardFloat 6.5s ease-in-out infinite 1.5s; }
.collana:nth-child(5) { animation: cardFloat 7.5s ease-in-out infinite .8s; }
.collana:nth-child(6) { animation: cardFloat 6s ease-in-out infinite 1.2s; }

/* Usa la proprietà `translate` (non `transform`) così l'animazione
   non sovrascrive il transform inline del tilt 3D */
@keyframes cardFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}

/* Pause floating on hover (tilt takes over) */
.collana:hover {
  animation-play-state: paused;
  box-shadow: 0 20px 50px rgba(0,0,0,.4), 0 0 30px color-mix(in srgb, var(--card-third) 8%, transparent);
  z-index: 2;
}

/* Icona equidistante dal bordo superiore della scheda e dal titolo */
.collana__icon { margin-bottom: var(--collana-pad-y); width: 86px; height: 86px; }
.collana__icon img {
  width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.4));
  display: block;
}

.collana h3 {
  font-family: var(--serif); font-size: 22px; font-weight: 500;
  color: var(--card-text, #ffffff); margin-bottom: 10px;
}
/* Titolo nel font della collana (dal generatore copertine), convertito in SVG */
.collana h3 img { display: block; max-width: 100%; height: auto; }
.collana p {
  color: var(--card-text-soft, rgba(255, 255, 255, 0.88)); margin-bottom: 16px;
  font-family: var(--serif); font-size: 18px; line-height: 1.55;
}

.collana__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px; letter-spacing: .06em; padding: 4px 9px;
  border: 1px solid var(--card-border, rgba(255,255,255,.3)); color: var(--card-text, #ffffff);
  text-transform: uppercase; transition: all .25s;
}
.collana:hover .tag { border-color: var(--card-text, rgba(255,255,255,.5)); }

/* ─── CATALOGO ─── */
/* Intestazione: testo a sinistra, ultime uscite sulla mensola a destra */
.catalogo__testa {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: 32px 56px; margin-bottom: 64px;
}
.catalogo__testa .section__desc { margin-bottom: 0; }

.ultime { --mensola-h: 190px; }
.ultime__etichetta {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 14px; text-align: center;
}
.ultime__mensola {
  position: relative; display: flex; align-items: flex-end; gap: 18px;
  height: var(--mensola-h); padding: 0 22px;
}
/* il ripiano: una riga dorata con l'ombra sotto */
.ultime__mensola::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -7px; height: 7px;
  background: linear-gradient(180deg, rgba(201,168,76,.55), rgba(201,168,76,.12));
  border-radius: 1px;
  box-shadow: 0 14px 22px -6px rgba(0,0,0,.7);
}
/* la copertina sta dentro il link: l'ingresso a cascata (.stagger) muove il link, inclinazione e passaggio muovono l'immagine */
.ultime__libro {
  --book-accent: var(--gold);
  display: block; flex: none;
  height: calc(var(--mensola-h) * var(--h)); aspect-ratio: var(--r);
}
.ultime__libro img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transform-origin: 50% 100%;
  box-shadow: 0 12px 26px rgba(0,0,0,.6), 0 0 0 1px var(--line);
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s;
}
/* l'ultima del ripiano è appoggiata alla vicina */
.ultime__libro:last-child img { transform-origin: 0 100%; transform: rotate(-4deg); }
.ultime__libro:hover img, .ultime__libro:focus-visible img {
  transform: translateY(-12px);
  box-shadow: 0 24px 40px rgba(0,0,0,.65), 0 0 32px -6px var(--book-accent), 0 0 0 1px var(--book-accent);
}
/* fluttuano piano, sfasate, come le copertine del catalogo */
.ultime__libro:nth-child(1) { animation: cardFloat 6s ease-in-out infinite; }
.ultime__libro:nth-child(2) { animation: cardFloat 7s ease-in-out infinite .6s; }
.ultime__libro:nth-child(3) { animation: cardFloat 6.5s ease-in-out infinite 1.2s; }
.ultime__libro:hover { animation-play-state: paused; }
.ultime__libro:focus-visible { outline: 2px solid var(--book-accent); outline-offset: 4px; }

.catalog-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 56px 40px;
}
.book { --book-accent: var(--gold); display: flex; flex-direction: column; min-width: 0; }
.book--ellissi    { --book-accent: var(--accent-ellissi); }
.book--kobaia     { --book-accent: var(--accent-kobaia); }
.book--inganni    { --book-accent: var(--accent-inganni); }
.book--finisterre { --book-accent: var(--accent-finisterre); }
.book--asterismi  { --book-accent: var(--accent-asterismi); }
.book--god        { --book-accent: var(--accent-god); }

/* Fluttuazione come le schede delle collane (stesso keyframe cardFloat) */
.book:nth-child(1) { animation: cardFloat 6s ease-in-out infinite; }
.book:nth-child(2) { animation: cardFloat 7s ease-in-out infinite .5s; }
.book:nth-child(3) { animation: cardFloat 5.5s ease-in-out infinite 1s; }
.book:nth-child(4) { animation: cardFloat 6.5s ease-in-out infinite 1.5s; }
.book:nth-child(5) { animation: cardFloat 7.5s ease-in-out infinite .8s; }
.book:nth-child(6) { animation: cardFloat 6s ease-in-out infinite 1.2s; }
.book:hover { animation-play-state: paused; }

.book__cover {
  position: relative; display: block;
  /* Copertine in scala col formato reale del volume (calcolato in index.njk):
     i libri più piccoli sono più stretti e più bassi, e poggiano tutti sulla stessa base, come su uno scaffale */
  width: var(--cover-w, 100%);
  aspect-ratio: var(--cover-r, 2 / 3);
  margin-top: var(--cover-top, 0);
  padding: 0; border: 0; cursor: zoom-in;
  background: var(--bg2); overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.55), 0 0 0 1px var(--line);
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s;
}
.book__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.book__cover { cursor: pointer; }
.book__details { margin-top: 12px; font-family: var(--serif); font-size: 15px; color: var(--muted-light); line-height: 1.6; }
.book__meta .book__links { margin-top: 14px; }
/* riflesso di luce che attraversa la copertina al passaggio */
.book__cover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.14) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform .9s ease;
}
.book__cover:hover, .book__cover:focus-visible {
  transform: translateY(-8px) rotate(-.6deg);
  box-shadow: 0 30px 60px rgba(0,0,0,.6), 0 0 40px -6px var(--book-accent), 0 0 0 1px var(--book-accent);
}
.book__cover:hover::after, .book__cover:focus-visible::after { transform: translateX(100%); }
.book__cover:focus-visible { outline: 2px solid var(--book-accent); outline-offset: 4px; }

.book__soon {
  position: absolute; top: 14px; right: -34px; z-index: 1;
  transform: rotate(45deg); width: 130px; padding: 5px 0;
  background: var(--book-accent); color: var(--bg);
  font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

.book__meta { padding-top: 22px; }
.book__collana {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--book-accent); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.book__collana-icon { width: 22px; height: 22px; object-fit: contain; flex: none; }
.book__collana-num { color: var(--muted); }
.book__meta h3 {
  font-family: var(--serif); font-size: 24px; font-weight: 500;
  color: var(--text-bright); line-height: 1.2; margin-bottom: 4px;
}
.book__sub { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted-light); line-height: 1.4; margin-bottom: 10px; }
.book__author { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.book__desc { margin-top: 12px; font-family: var(--serif); font-size: 18px; color: var(--muted-light); line-height: 1.5; }

.book__links { display: flex; gap: 20px; flex-wrap: wrap; }
.book__links a {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); transition: color .2s; display: inline-flex; align-items: center; gap: 5px;
}
.book__links a:hover { color: var(--text-bright); }
.book__links a i { font-size: 11px; }
.catalogo-tutti { margin-top: 48px; }

/* Lightbox copertine */
.cover-lightbox {
  border: 0; padding: 0; background: transparent; max-width: none; max-height: none;
  width: 100vw; height: 100vh; margin: 0;
}
.cover-lightbox::backdrop { background: rgba(4,5,8,.88); backdrop-filter: blur(6px); }
.cover-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.cover-lightbox img {
  max-width: min(90vw, 900px); max-height: 88vh; width: auto; height: auto;
  box-shadow: var(--shadow); animation: coverIn .35s ease;
}
.cover-lightbox__close {
  position: fixed; top: 18px; right: 22px;
  background: none; border: 0; color: var(--text-bright); font-size: 28px; cursor: pointer; line-height: 1;
}
@keyframes coverIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ─── LINKS ─── */
.links-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.link-scheda {
  display: flex; flex-direction: column;
  background: var(--bg); padding: 32px 28px;
  transition: background .25s;
}
.link-scheda:hover, .link-scheda:focus-visible { background: var(--card-hover); }
.link-scheda__testa {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.link-scheda__meta {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--gold);
}
.link-scheda__icon {
  font-size: 14px; color: var(--muted);
  transition: color .25s, transform .25s;
}
.link-scheda:hover .link-scheda__icon,
.link-scheda:focus-visible .link-scheda__icon {
  color: var(--gold); transform: translate(2px, -2px);
}
.link-scheda h3 {
  font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.25;
  color: var(--text-bright); margin-bottom: 10px;
  transition: color .25s;
}
.link-scheda:hover h3, .link-scheda:focus-visible h3 { color: var(--gold); }
.link-scheda__desc {
  font-size: 14px; line-height: 1.6; color: var(--muted-light);
  margin-bottom: 18px;
}
.link-scheda__dominio {
  margin-top: auto;
  font-size: 12px; letter-spacing: .04em; color: var(--muted);
}

/* ─── MANOSCRITTI ─── */
.ms-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  margin-bottom: 40px;
}
.ms-panel { background: var(--bg); padding: 40px 32px; }
.ms-panel h3 {
  font-family: var(--serif); font-size: 22px; font-weight: 500;
  color: var(--text-bright); margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}
.ms-panel h3 i { font-size: 18px; color: var(--gold); }
.ms-panel ul, .ms-panel ol {
  padding-left: 20px; color: var(--muted-light);
  font-family: var(--serif); font-size: 18px; line-height: 1.6;
}
.ms-panel li + li { margin-top: 8px; }

.ms-cta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 20px; padding: 32px;
  border: 1px solid var(--line); background: var(--gold-glow);
}
.ms-cta h3 {
  font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--text-bright);
}
.ms-note { margin-top: 20px; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); }

/* ─── CHI SIAMO ─── */
.about-banner {
  position: relative; margin: 8px 0 48px;
  border: 1px solid var(--line); overflow: hidden;
}
.about-banner__open {
  display: block; width: 100%; padding: 0; border: 0;
  background: none; cursor: zoom-in;
}
.about-banner img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 55%;
}
.about-banner::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 25%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.about-banner__hint {
  position: absolute; top: 16px; right: 16px; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: rgba(8,9,12,.6); backdrop-filter: blur(6px);
  font-family: var(--sans); font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-bright); opacity: .75; transition: opacity .2s;
}
.about-banner__open:hover .about-banner__hint,
.about-banner__open:focus-visible .about-banner__hint { opacity: 1; }
.about-banner figcaption {
  position: absolute; left: 24px; bottom: 18px; z-index: 1;
  font-family: var(--serif); font-style: italic; font-size: 16px;
  color: var(--muted-light);
}

/* La storia e i suoi capitoli (Visione, Metodo), uno dopo l'altro come in un libro */
.about-story { max-width: 760px; margin-inline: auto; }
.about-story--capitolo { margin-top: 72px; }
.about-story .section__title { margin-bottom: 24px; }
.about-story p {
  font-family: var(--serif); font-size: 20px; color: var(--muted-light); line-height: 1.6;
}
.about-story p + p { margin-top: 16px; }
.about-story strong { font-weight: 600; color: var(--text-bright); }
.about-story .about-story__lead {
  font-family: var(--serif); font-size: 21px;
  color: var(--text); line-height: 1.6;
}
.about-quote {
  margin: 28px 0; padding: 4px 0 4px 24px;
  border-left: 2px solid var(--gold);
  font-family: var(--serif); font-style: italic; font-size: 21px;
  line-height: 1.55; color: var(--text-bright);
}
.about-quote cite {
  display: block; margin-top: 10px;
  font-family: var(--sans); font-style: normal; font-size: 12px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gold);
}

/* ─── FOOTER ─── */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; }
.site-footer__inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.site-footer p { font-size: 13px; color: var(--muted); }
.site-footer .brand-footer {
  display: flex; align-items: center; gap: 10px;
  max-width: 100%; min-width: 0;
}
.brand-footer svg { width: 28px; height: 28px; }
/* Va a capo sui telefoni: una riga troppo lunga allargherebbe tutta la pagina */
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 20px; max-width: 100%; }
.footer-links a {
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); transition: color .2s;
}
.footer-links a:hover { color: var(--text-bright); }

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-legal {
  font-style: normal;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  letter-spacing: .02em;
}
.nowrap { white-space: nowrap; }

.footer-tech {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
}

/* ─── ANIMATIONS ─── */
.js .reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity .7s cubic-bezier(.22,1,.36,1), transform .7s cubic-bezier(.22,1,.36,1);
}
.js .reveal.visible { opacity: 1; transform: translateY(0); }

.js .stagger > * {
  opacity: 0; transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.22,1,.36,1), transform .5s cubic-bezier(.22,1,.36,1);
}
.js .stagger.visible > * { opacity: 1; transform: translateY(0); }
.stagger.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger.visible > *:nth-child(2) { transition-delay: .1s; }
.stagger.visible > *:nth-child(3) { transition-delay: .2s; }
.stagger.visible > *:nth-child(4) { transition-delay: .3s; }
.stagger.visible > *:nth-child(5) { transition-delay: .4s; }
.stagger.visible > *:nth-child(6) { transition-delay: .5s; }

/* ─── GRAIN ─── */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: .025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 180px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .hero__portrait { max-width: 360px; }
  .hero__fujot { width: 155px; top: -35px; right: -12px; }
  .hero__fujot--volo { top: 0; right: auto; }
  .hero .container { padding: 120px 0 60px; }
  .hero h1 { font-size: 38px; }
  .hero__stats { gap: 28px; }
  .hero__stats strong { font-size: 22px; }

  .collane-grid { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: 1fr; }
  .ms-grid { grid-template-columns: 1fr; }
  .about-story--capitolo { margin-top: 56px; }
  .about-story p { font-size: 19px; }
  .about-banner img { aspect-ratio: 4 / 3; }
  .about-banner figcaption { left: 16px; bottom: 12px; font-size: 14px; }
  .about-story .about-story__lead, .about-quote { font-size: 19px; }

  .catalogo__testa { grid-template-columns: 1fr; margin-bottom: 56px; }
  .ultime { --mensola-h: 160px; justify-self: start; }
  .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 44px 24px; }

  .nav__toggle { display: inline-flex; }
  .nav {
    display: none; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(8,9,12,.96);
    border-bottom: 1px solid var(--line);
    padding: 16px 5vw;
    backdrop-filter: blur(20px);
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 0; }
  .ms-cta { flex-direction: column; align-items: flex-start; }
  .site-footer__inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
}

@media (max-width: 480px) {
  .brand { gap: 10px; }
  .brand__star, .brand__star svg { width: 34px; height: 34px; }
  .brand__text { font-size: 26px; }
  .brand__text span { font-size: 17px; }
  .hero h1 { font-size: 30px; }
  .hero__stats { flex-direction: column; gap: 16px; }
  .hero__stats li { padding-left: 0; }
  .hero__stats li::before { display: none; }
  .collana, .ms-panel, .link-scheda { padding: 28px 20px; }
  .collana { --collana-pad-y: 28px; }
  .ultime { --mensola-h: 130px; }
  .ultime__mensola { gap: 12px; padding: 0 14px; }
  .catalog-grid { gap: 36px 16px; }
  .book__meta h3 { font-size: 19px; }
  .book__sub { font-size: 14px; }
  .book__soon { font-size: 9px; top: 10px; right: -38px; }
}

/* ─── ANIMAZIONI RIDOTTE (preferenza di sistema) ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal, .js .stagger > * { opacity: 1; transform: none; }
}
