/* =========================================================
   L'Artigiano del Libro — foglio di stile principale
   Palette del marchio: nero, oro, crema
   ========================================================= */

:root {
  --paper: #fbf6ec;
  --paper-2: #f4e9d3;
  --ink: #141414;
  --ink-soft: #57514a;
  --leather: #9a6f25;      /* oro scuro: link e pulsanti su fondo chiaro */
  --leather-dark: #6f4f17;
  --gold: #d4a24c;         /* oro del biglietto da visita */
  --gold-light: #f0cd8a;   /* oro chiaro del logo */
  --burgundy: #141414;
  --white: #fffdf8;
  --line: rgba(20, 20, 20, 0.13);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Poppins", "Helvetica Neue", Arial, sans-serif;

  --max: 1180px;
  --radius: 2px;
  --shadow: 0 10px 30px rgba(20, 20, 20, 0.12);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--leather); text-decoration: none; transition: color .2s; }
a:hover { color: var(--burgundy); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.15;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 3.5vw, 2.9rem); }
h3 { font-size: 1.7rem; }

p { margin: 0 0 1.2em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }

.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}

.ornament {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--gold); margin: 1.2rem 0 2rem;
}
.ornament::before, .ornament::after {
  content: ""; width: 60px; height: 1px; background: var(--gold);
}
.ornament span { font-size: 1.1rem; }

.btn {
  display: inline-block;
  padding: 14px 34px;
  font-family: var(--sans);
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  border: 1px solid var(--leather);
  background: var(--leather);
  color: var(--white);
  cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.btn:hover { background: var(--leather-dark); border-color: var(--leather-dark); color: var(--white); }
.btn--ghost { background: transparent; color: var(--leather); }
.btn--ghost:hover { background: var(--leather); color: var(--white); }
.btn--light { background: transparent; color: var(--white); border-color: var(--gold-light); }
.btn--light:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--ink);
  color: var(--gold-light);
  font-size: .8rem;
  letter-spacing: .05em;
}
.topbar .container {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 38px; gap: 16px; flex-wrap: wrap;
}
.topbar a { color: var(--gold-light); }
.topbar a:hover { color: var(--white); }
.topbar__contacts { display: flex; gap: 22px; flex-wrap: wrap; }

/* ---------- Header / menu ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 240, 228, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.header .container {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 92px; gap: 24px;
}

.logo { display: flex; align-items: center; gap: 14px; line-height: 1; color: var(--ink); }
.logo:hover { color: var(--ink); }
.logo img { width: 68px; height: 68px; }
.logo__text { display: flex; flex-direction: column; }
.logo__name {
  font-family: var(--sans); font-size: 1rem; font-weight: 600;
  letter-spacing: .2em; text-transform: uppercase;
}
.logo__tag {
  font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: 1.25rem; color: var(--leather); margin-top: 4px;
}

.nav > ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.nav li { position: relative; }
.nav > ul > li > a {
  display: block; padding: 12px 16px;
  font-size: .82rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink);
}
.nav > ul > li > a:hover,
.nav > ul > li > a.active { color: var(--leather); }
.nav > ul > li > a.active { box-shadow: inset 0 -2px 0 var(--gold); }

.has-sub > a::after {
  content: ""; display: inline-block; margin-left: 8px; vertical-align: 3px;
  width: 6px; height: 6px;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}

.submenu {
  list-style: none; margin: 0; padding: 12px 0;
  position: absolute; top: 100%; left: 0; min-width: 260px;
  background: var(--white);
  border-top: 2px solid var(--gold);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
.has-sub:hover > .submenu,
.has-sub:focus-within > .submenu { opacity: 1; visibility: visible; transform: none; }
.submenu a {
  display: block; padding: 9px 24px;
  font-family: var(--serif); font-size: 1.12rem; color: var(--ink);
}
.submenu a:hover { background: var(--paper); color: var(--leather); }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 44px; height: 44px; padding: 10px;
}
.nav-toggle span {
  display: block; height: 2px; background: var(--ink); margin: 5px 0;
  transition: transform .25s, opacity .25s;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Immagini segnaposto (carta marmorizzata) ----------
   Sostituire con <img src="img/..."> quando ci sono le foto reali. */
.ph {
  position: relative; overflow: hidden;
  background-color: var(--leather);
  min-height: 320px;
  display: flex; align-items: flex-end;
}
.ph::after {
  content: attr(data-label);
  position: relative; z-index: 1;
  margin: 18px; padding: 6px 12px;
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--white); background: rgba(42, 34, 29, .55);
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.ph {
  background-image: url("../img/logo-nero.png"), linear-gradient(145deg, var(--ph-a), var(--ph-b));
  background-repeat: no-repeat;
  background-position: center 42%, center;
  background-size: 110px, cover;
  --ph-a: #efe4cf; --ph-b: #e2d2b3;
}
.ph:not(.has-img) { background-blend-mode: soft-light, normal; }
.ph::before {
  content: ""; position: absolute; inset: 14px; border: 1px solid rgba(154, 111, 37, .35); pointer-events: none;
}
.ph.has-img::before { display: none; }
.ph::after { background: rgba(20, 20, 20, .72); color: var(--gold-light); }
.ph--1 { --ph-a: #efe4cf; --ph-b: #e0cfae; }
.ph--2 { --ph-a: #2a2622; --ph-b: #141414; background-image: url("../img/logo-oro.png"), linear-gradient(145deg, var(--ph-a), var(--ph-b)); }
.ph--3 { --ph-a: #f3e7cc; --ph-b: #e6cf9f; }
.ph--4 { --ph-a: #e9e1d3; --ph-b: #d8ccb6; }
.ph--5 { --ph-a: #262320; --ph-b: #121212; background-image: url("../img/logo-oro.png"), linear-gradient(145deg, var(--ph-a), var(--ph-b)); }
.ph--6 { --ph-a: #f1e2c2; --ph-b: #dcc493; }
.ph--2:not(.has-img), .ph--5:not(.has-img) { background-blend-mode: normal; }
.ph--2::before, .ph--5::before { border-color: rgba(240, 205, 138, .3); }

/* ---------- Hero ---------- */
.hero {
  position: relative; color: var(--white);
  min-height: 78vh; display: flex; align-items: center;
  background-color: #0d0d0d;
  background-image:
    linear-gradient(100deg, rgba(13,13,13,.94) 0%, rgba(13,13,13,.7) 55%, rgba(13,13,13,.35) 100%),
    var(--hero-img, radial-gradient(ellipse at 78% 45%, rgba(212,162,76,.35) 0, transparent 45%));
  background-size: cover; background-position: center;
}
.hero__logo {
  position: absolute; right: 7%; top: 50%; transform: translateY(-50%);
  width: min(34vw, 420px); opacity: .9; pointer-events: none;
}
.hero.has-img .hero__logo { display: none; }
.hero h1 { color: var(--white); max-width: 14ch; }
.hero p { max-width: 52ch; font-size: 1.1rem; color: #e9dcc2; }
.hero .eyebrow { color: var(--gold-light); }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 2rem; }

.page-hero {
  padding: 110px 0 90px; text-align: center; color: var(--white);
  background-color: #0d0d0d;
  background-image:
    linear-gradient(rgba(13,13,13,.8), rgba(13,13,13,.8)),
    var(--hero-img, radial-gradient(ellipse at 50% 120%, rgba(212,162,76,.4) 0, transparent 60%));
  background-size: cover; background-position: center;
  border-bottom: 6px solid var(--gold);
}
.page-hero h1 { color: var(--white); margin-bottom: .3em; }
.page-hero p { color: #e9dcc2; max-width: 60ch; margin: 0 auto; }
.page-hero .eyebrow { color: var(--gold-light); }
.breadcrumb { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-top: 1.4rem; color: var(--gold-light); }
.breadcrumb a { color: var(--gold-light); }

/* ---------- Sezioni ---------- */
.section { padding: 110px 0; }
.section--alt { background: var(--paper-2); }
.section--dark { background: var(--ink); color: #e9dcc2; }
.section--dark h2, .section--dark h3 { color: var(--white); }
.section__head { text-align: center; max-width: 720px; margin: 0 auto 60px; }
.section__head p { color: var(--ink-soft); }
.section--dark .section__head p { color: #c8bda9; }

.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 70px; align-items: center;
}
.split--reverse .split__media { order: 2; }
.split__media .ph { min-height: 460px; box-shadow: var(--shadow); }
.split__text p { color: var(--ink-soft); }

/* card servizi home */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.card {
  background: var(--white); border: 1px solid var(--line);
  transition: transform .3s, box-shadow .3s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.card .ph { min-height: 240px; }
.card__body { padding: 28px 30px 32px; flex: 1; display: flex; flex-direction: column; }
.card__body p { color: var(--ink-soft); font-size: .97rem; flex: 1; }
.card__link {
  font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: var(--leather);
}
.card__link::after { content: " →"; }

/* lista servizi */
.service { padding: 90px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 110px; }
.service:nth-of-type(even) { background: var(--paper-2); }
.service__num {
  font-family: var(--serif); font-size: 4rem; line-height: 1; color: var(--gold-light);
  margin-bottom: .2em;
}
.service ul.features { list-style: none; padding: 0; margin: 0 0 1.8rem; }
.service ul.features li {
  padding: 6px 0 6px 28px; position: relative; color: var(--ink-soft);
}
.service ul.features li::before {
  content: "❧"; position: absolute; left: 0; color: var(--gold);
}

/* indice rapido */
.quick-index {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  padding: 26px 0; background: var(--white); border-bottom: 1px solid var(--line);
  position: sticky; top: 92px; z-index: 20;
}
.quick-index a {
  font-size: .76rem; letter-spacing: .14em; text-transform: uppercase;
  padding: 8px 16px; border: 1px solid var(--line); color: var(--ink);
}
.quick-index a:hover { border-color: var(--gold); color: var(--leather); }

/* prodotti */
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 32px; }
.product { scroll-margin-top: 120px; }
.product .ph { min-height: 340px; transition: transform .4s; }
.product__media { overflow: hidden; margin-bottom: 22px; }
.product:hover .ph { transform: scale(1.04); }
.product h3 { margin-bottom: .3em; }
.product p { color: var(--ink-soft); font-size: .97rem; }
.product__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1rem; padding: 0; list-style: none; }
.product__tags li {
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px; background: var(--paper-2); color: var(--leather);
}

/* valori / numeri */
.values { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; text-align: center; }
.value__icon { font-size: 2rem; color: var(--gold); margin-bottom: .5rem; }
.value h4 { font-size: 1.4rem; margin-bottom: .3em; }
.value p { font-size: .95rem; color: var(--ink-soft); }
.section--dark .value p { color: #c8bda9; }

/* timeline storia */
.timeline { position: relative; max-width: 900px; margin: 0 auto; }
.timeline::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--gold);
}
.tl-item { position: relative; width: 50%; padding: 0 50px 60px; }
.tl-item:nth-child(odd) { left: 0; text-align: right; }
.tl-item:nth-child(even) { left: 50%; }
.tl-item::before {
  content: ""; position: absolute; top: 10px; width: 13px; height: 13px;
  background: var(--paper); border: 2px solid var(--gold); border-radius: 50%;
}
.tl-item:nth-child(odd)::before { right: -7px; }
.tl-item:nth-child(even)::before { left: -7px; }
.tl-year { font-family: var(--serif); font-size: 2.4rem; color: var(--leather); line-height: 1; }
.tl-item p { color: var(--ink-soft); }

blockquote.quote {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.35; text-align: center; max-width: 820px; margin: 0 auto; color: var(--white);
}
blockquote.quote cite {
  display: block; margin-top: 1.4rem; font-family: var(--sans); font-style: normal;
  font-size: .8rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-light);
}

/* CTA */
.cta { text-align: center; }
.cta p { max-width: 600px; margin: 0 auto 2rem; color: var(--ink-soft); }

/* ---------- Contatti ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 70px; }
.contact-info dl { margin: 0; }
.contact-info dt {
  font-size: .75rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
  margin-top: 1.6rem;
}
.contact-info dd { margin: .3rem 0 0; font-family: var(--serif); font-size: 1.35rem; }
.hours { width: 100%; border-collapse: collapse; margin-top: .4rem; font-size: .97rem; }
.hours td { padding: 6px 0; border-bottom: 1px dotted var(--line); }
.hours td:last-child { text-align: right; color: var(--ink-soft); }

.form { background: var(--white); padding: 44px; border: 1px solid var(--line); }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { margin-bottom: 20px; }
.field label {
  display: block; font-size: .74rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s, background .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); background: var(--white);
}
.field textarea { min-height: 150px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; color: var(--ink-soft); margin-bottom: 24px; }
.check input { margin-top: 5px; }
.form__msg { margin-top: 16px; font-size: .95rem; color: var(--leather); }

.map {
  margin-top: 0; min-height: 380px; border: 0; width: 100%; display: block;
  filter: sepia(.35) saturate(.8);
}

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #c8bda9; padding: 80px 0 0; font-size: .95rem; }
.footer h4 {
  font-family: var(--sans); font-size: .76rem; letter-spacing: .24em; text-transform: uppercase;
  color: var(--gold-light); margin-bottom: 1.2rem;
}
.footer a { color: #c8bda9; }
.footer a:hover { color: var(--white); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 50px; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: .45rem; }
.footer .logo__name { color: var(--white); }
.footer__bottom {
  margin-top: 60px; padding: 24px 0; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .82rem;
}

/* ---------- Animazioni ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .cards, .products { grid-template-columns: repeat(2, 1fr); }
  .values { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .split { gap: 44px; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 92px 0 0 0; background: var(--paper);
    overflow-y: auto; padding: 20px 24px 40px;
    transform: translateX(100%); transition: transform .3s ease;
  }
  .nav-open .nav { transform: none; }
  .nav > ul { flex-direction: column; gap: 0; }
  .nav > ul > li { border-bottom: 1px solid var(--line); }
  .nav > ul > li > a { padding: 16px 0; font-size: .9rem; }
  .nav > ul > li > a.active { box-shadow: none; color: var(--leather); }
  .submenu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; background: transparent; padding: 0 0 12px 14px;
    display: none;
  }
  .has-sub.open > .submenu { display: block; }
  .has-sub:hover > .submenu { display: none; }
  .has-sub.open:hover > .submenu { display: block; }
  .submenu a { padding: 7px 0; }

  .split, .contact-grid { grid-template-columns: 1fr; }
  .split--reverse .split__media { order: 0; }
  .split__media .ph { min-height: 320px; }
  .quick-index { position: static; }

  .timeline::before { left: 8px; }
  .tl-item, .tl-item:nth-child(odd), .tl-item:nth-child(even) {
    width: 100%; left: 0; text-align: left; padding: 0 0 46px 40px;
  }
  .tl-item:nth-child(odd)::before, .tl-item:nth-child(even)::before { left: 2px; right: auto; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .section { padding: 72px 0; }
  .service { padding: 64px 0; }
  .cards, .products, .values, .footer__grid, .form__row { grid-template-columns: 1fr; }
  .form { padding: 28px 20px; }
  .topbar__hide-sm { display: none; }
  .header .container { min-height: 76px; }
  .nav { inset: 76px 0 0 0; }
  .logo__name { font-size: 1.6rem; }
  .hero { min-height: 70vh; }
}

/* ---------- Aggiunte: foto reali, galleria, modulo ---------- */
.ph.has-img { background: var(--paper-2); }
.ph.has-img::after { display: none; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.gallery figure { margin: 0; background: var(--white); border: 1px solid var(--line); }
.gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity .2s; }
.gallery a:hover img { opacity: .85; }
.gallery figcaption { padding: 10px 14px; font-size: .88rem; color: var(--ink-soft); }

.product { color: inherit; display: block; }
a.product:hover h3 { color: var(--leather); }

.footer__logo { width: 120px; height: 120px; margin-bottom: 1.2rem; }
.footer__social { display: flex; gap: 18px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__intro { color: var(--ink-soft); font-size: .95rem; }
.field small { text-transform: none; letter-spacing: 0; }
.field.has-error input, .field.has-error textarea { border-color: #b3261e; background: #fff7f6; }
.field__error, .check + .field__error { display: block; color: #b3261e; font-size: .85rem; margin-top: 6px; }
.check.has-error { color: #b3261e; }
.check + .field__error { margin: -16px 0 20px; }
.alert { padding: 14px 18px; margin-bottom: 22px; font-size: .95rem; border-left: 3px solid; }
.alert--error { background: #fff3f2; border-color: #b3261e; color: #7c1d17; }
.form--done { text-align: center; }

.prose { max-width: 780px; }
.prose h3 { margin-top: 2rem; font-size: 1.5rem; }
.prose p { color: var(--ink-soft); }

.section--dark .ornament::before, .section--dark .ornament::after { background: var(--gold); }
.cta h2 { margin-bottom: .6em; }

@media (max-width: 900px) {
  .hero__logo { display: none; }
}
