/* =========================================================
   Ilaria Ferris — sito vetrina
   Palette e tipografia coerenti con il brand (Canva)
   ========================================================= */

/* Font ospitati sul sito (niente richieste a Google).
   Solo i caratteri latini: coprono l'italiano, accenti inclusi. */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url('fonts/cormorant-garamond-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('fonts/cormorant-garamond-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('fonts/inter-normal-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Colore */
  --paper:      #F3EDE3;   /* fondo carta, caldo */
  --paper-deep: #EBE2D3;   /* sezioni alternate */
  --ink:        #2B2521;   /* testo, near-black caldo */
  --ink-soft:   #6B615A;   /* testo secondario */
  --plum:       #922B72;   /* accento (tagline della Canva) */
  --plum-dark:  #74215B;   /* hover accento */
  --line:       #D8CCB8;   /* bordi/righe sottili */
  --ok:         #3C7A4B;   /* messaggi positivi */
  --err:        #B23A3A;   /* messaggi di errore */

  /* Tipografia */
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --maxw: 1080px;
  --header-h: 72px;   /* altezza header fisso */
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* Lascia spazio sotto l'header fisso quando si salta alle ancore */
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

p { margin: 0 0 1.1em; }

/* ---------- Header FISSO ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: var(--header-h);

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;

  padding: 0 1.5rem;
  background: rgba(243, 237, 227, .88);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

/* Ombra/linea che compaiono solo dopo lo scroll (classe messa da JS) */
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 20px -14px rgba(43, 37, 33, .5);
}

/* Contenuto interno dell'header allineato alla griglia del sito */
.site-header .brand,
.site-header .site-nav { flex: 0 0 auto; }

.brand {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav { display: flex; gap: 1.6rem; }

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .95rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
.site-nav a:hover { color: var(--plum); border-color: var(--plum); }

/* Voce attiva durante lo scroll (scrollspy) */
.site-nav a.is-active {
  color: var(--plum);
  border-color: var(--plum);
}

/* Spinge il contenuto sotto l'header fisso */
main { padding-top: var(--header-h); }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 2rem auto 4.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 3.5rem;
  align-items: center;
}

.hero__role {
  font-size: .85rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 .6rem;
}

.hero__name {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(3.2rem, 8vw, 5.6rem);
  line-height: .98;
  margin: 0 0 1.4rem;
}

.hero__tagline {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.3;
  color: var(--plum);
  margin: 0 0 1.4rem;
  max-width: 30ch;
}

.hero__lead {
  color: var(--ink-soft);
  max-width: 48ch;
  margin-bottom: 2rem;
}

/* Ritratto: foto come stampa "matted", con keyline prugna sfalsata */
.hero__portrait {
  margin: 0;
  position: relative;
  isolation: isolate;
}
.hero__portrait::before {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;      /* cornice spostata in basso a destra */
  border: 1px solid var(--plum);
  border-radius: 2px;
  z-index: -1;
}
.hero__portrait img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 35%;        /* mantiene il viso ben inquadrato */
  border-radius: 2px;
  box-shadow: 0 16px 36px -24px rgba(43, 37, 33, .5);
}

/* ---------- Apertura al caricamento: solo la hero, un unico momento ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero__text > *,
  .hero__portrait {
    opacity: 0;
    animation: rise .7s cubic-bezier(.2, .7, .3, 1) forwards;
  }
  .hero__text > *:nth-child(1) { animation-delay: .05s; }
  .hero__text > *:nth-child(2) { animation-delay: .13s; }
  .hero__text > *:nth-child(3) { animation-delay: .21s; }
  .hero__text > *:nth-child(4) { animation-delay: .29s; }
  .hero__text > *:nth-child(5) { animation-delay: .37s; }
  .hero__portrait { animation-duration: .8s; animation-delay: .25s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.portrait-placeholder {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(45deg, rgba(146,43,114,.04) 0 14px, transparent 14px 28px),
    var(--paper-deep);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--display);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.4;
}

/* ---------- Sezioni ---------- */
.section { padding: 4.5rem 1.5rem; }
.section--paper { background: var(--paper-deep); }

.section__inner { max-width: var(--maxw); margin: 0 auto; }
.section__inner--narrow { max-width: 680px; }

/* ---------- Chi sono: foto a sinistra + titolo e testo a destra ---------- */
.about {
  display: grid;
  grid-template-columns: .62fr 1fr;
  grid-template-areas:
    "photo title"
    "photo text";
  grid-template-rows: auto 1fr;
  column-gap: 3.5rem;
  align-items: start;
}
.about__title { grid-area: title; margin-top: 0; }
.about__photo {
  grid-area: photo;
  align-self: center;
  margin: 0;
  position: relative;
  isolation: isolate;
  max-width: 340px;
}
.about__text { grid-area: text; }
/* Cornice prugna sfalsata, speculare a quella della hero (offset a sinistra) */
.about__photo::before {
  content: "";
  position: absolute;
  inset: 16px 16px -16px -16px;
  border: 1px solid var(--plum);
  border-radius: 2px;
  z-index: -1;
}
.about__photo img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 16px 36px -24px rgba(43, 37, 33, .5);
}

.section__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  line-height: 1.1;
  margin: 0 0 1.6rem;
}
.section__title::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  background: var(--plum);
  margin-top: .9rem;
}

/* ---------- Banda citazione / estratto ---------- */
.quote-band {
  background: var(--ink);
  color: var(--paper);
  padding: 4.5rem 1.5rem;
}
.quote {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}
.quote p {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.6rem, 3.5vw, 2.3rem);
  line-height: 1.35;
  margin: 0 0 1.2rem;
}
.quote cite {
  font-family: var(--body);
  font-style: normal;
  font-size: .95rem;
  letter-spacing: .04em;
  color: var(--line);
}

/* ---------- Il libro ---------- */
.book {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3rem;
  align-items: center;
}

.book__cover img,
.cover-placeholder {
  border-radius: 2px;
  box-shadow: 0 18px 40px -22px rgba(43, 37, 33, .55);
}

/* Immagine copertina reale: riempie la colonna mantenendo la sua proporzione */
.book__cover img {
  width: 100%;
  height: auto;
  display: block;
}

.cover-placeholder {
  aspect-ratio: 2 / 3;
  border: 1px solid var(--line);
  background: var(--paper);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-family: var(--display);
  font-style: italic;
  font-size: 1.3rem;
}

.book__eyebrow {
  font-size: .82rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--plum);
  margin: 0 0 .5rem;
}

.book__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
  margin: 0 0 1.1rem;
}

.book__synopsis { color: var(--ink-soft); margin-bottom: 1.8rem; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-block;
  font-family: var(--body);
  font-size: .98rem;
  font-weight: 500;
  padding: .75rem 1.6rem;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--plum);
  transition: background .18s ease, color .18s ease, opacity .18s ease;
}

.btn--primary { background: var(--plum); color: #fff; }
.btn--primary:hover { background: var(--plum-dark); border-color: var(--plum-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Form ---------- */
.contact__lead { color: var(--ink-soft); max-width: 52ch; margin-bottom: 2rem; }

.form { display: grid; gap: 1.3rem; max-width: 460px; }

.field { display: grid; gap: .4rem; }

.field label {
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
}

.field input {
  font-family: var(--body);
  font-size: 1rem;
  padding: .7rem .85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(146, 43, 114, .18);
}
.field input.invalid { border-color: var(--err); }

.form button { justify-self: start; margin-top: .3rem; }

/* Messaggio dopo l'invio: riquadro colorato secondo l'esito */
.form__status { margin: .3rem 0 0; font-size: .95rem; line-height: 1.5; border-radius: 6px; }
.form__status:empty { display: none; }
.form__status.is-ok   { color: #2C6B3B; background: #E3F0E6; padding: .8rem 1rem; }
.form__status.is-info { color: #74215B; background: #F4E6EF; padding: .8rem 1rem; }
.form__status.is-err  { color: #9B2C2C; background: #F8E4E2; padding: .8rem 1rem; }
.field-consent input.invalid { outline: 2px solid var(--err); outline-offset: 2px; }

/* Consenso GDPR: casella + testo affiancati */
.field-consent {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.field-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: .15rem;
  flex: 0 0 auto;
  accent-color: var(--plum);
  cursor: pointer;
}
.field-consent label {
  font-size: .9rem;
  line-height: 1.5;
  color: var(--ink-soft);
  cursor: pointer;
}
.field-consent a {
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.field-consent a:hover { color: var(--plum-dark); }

/* Honeypot: nascosto ma non con display:none (alcuni bot lo saltano) */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Social ---------- */
.socials {
  margin-top: 2.4rem;
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
}
.socials a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .95rem;
  transition: color .18s ease;
}
.social-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.socials a span {
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color .18s ease;
}
.socials a:hover { color: var(--plum); }
.socials a:hover span { border-color: var(--plum); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem;
  text-align: center;
}
.site-footer p { margin: 0; color: var(--ink-soft); font-size: .9rem; }

/* ---------- Focus visibile (accessibilità) ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}

/* ---------- Pagina legale (privacy) ---------- */
.legal .section__title { margin-bottom: 1.2rem; }
.legal__intro {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 2.5rem;
}
.legal h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  margin: 2.4rem 0 .8rem;
  color: var(--ink);
}
.legal ul {
  margin: 0 0 1.1em;
  padding-left: 1.3rem;
}
.legal li { margin-bottom: .4rem; }
.legal__updated {
  margin-top: 2.5rem;
  font-size: .9rem;
  color: var(--ink-soft);
  font-style: italic;
}
.legal__back {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.legal__back a {
  color: var(--plum);
  text-decoration: none;
  font-weight: 500;
}
.legal__back a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-bottom: 3rem;
  }
  .hero__portrait { max-width: 380px; }
  .hero__portrait::before { inset: 10px -10px -10px 10px; }
  .book { grid-template-columns: 1fr; gap: 2rem; }
  .book__cover { max-width: 260px; }

  /* Chi sono: una colonna, ordine titolo -> foto -> testo */
  .about {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "photo"
      "text";
    grid-template-rows: auto auto auto;
    row-gap: 2rem;
  }
  .about__title { margin-bottom: 0; }
  .about__photo { max-width: 380px; }
  .about__photo::before { inset: 10px 10px -10px -10px; }
}

/* ---------- Mobile: header su due righe, centrato ---------- */
@media (max-width: 560px) {
  :root {
    /* Altezza header mobile: più alto perché sta su due righe.
       Sincronizza automaticamente lo spazio sotto l'header e le ancore. */
    --header-h: 108px;
  }

  /* Chi sono: foto più piccola e centrata, con aria ai lati */
  .about__photo {
    max-width: 240px;
    margin: 0 auto;
  }

  .site-header {
    flex-direction: column;
    justify-content: center;
    gap: .55rem;
    padding: .7rem 1rem;
    text-align: center;
  }

  .brand {
    font-size: 1.35rem;
    line-height: 1;
  }

  .site-nav {
    gap: .3rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  /* Area da toccare di almeno 44 px (standard per il pollice) */
  .site-nav a {
    font-size: .92rem;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 .9rem;
    border-radius: 999px;
    border-bottom: 0;
  }
  .site-nav a:hover,
  .site-nav a.is-active { background: rgba(146, 43, 114, .1); }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .section { padding: 3.2rem 1.25rem; }
  .quote-band { padding: 3.2rem 1.25rem; }
}

/* ---------- Mobile stretto: se il nome è lungo, riduci ancora ---------- */
@media (max-width: 360px) {
  .site-nav { gap: .1rem; }
  .site-nav a { font-size: .86rem; padding: 0 .7rem; }
}

/* ---------- Motion ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Pagina 404 ---------- */
.notfound {
  max-width: 620px;
  margin: 0 auto;
  padding: 4rem 1.5rem;
  text-align: center;
  /* occupa lo spazio disponibile: il fondo pagina resta in basso */
  min-height: calc(100vh - var(--header-h) - 100px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.notfound__code {
  font-size: .95rem;
  color: var(--ink-soft);
  margin: 0 0 .6rem;
}
.notfound h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.05;
  margin: 0 0 1.2rem;
}
.notfound__testo { color: var(--ink-soft); margin: 0 auto .6rem; max-width: 46ch; }
.notfound__eco {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--plum);
  margin: 0 0 2rem;
}
.notfound__azioni { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.btn--ghost { background: transparent; color: var(--plum); }
.btn--ghost:hover { background: rgba(146, 43, 114, .08); }
