/* =========================================================================
   Simone & Camilla — tema bianco + oro con motivi floreali/marini dell'invito
   ========================================================================= */

:root {
  /* Colori dall'invito */
  --lilac:      #A48CC4;
  --viola:      #6E5A94;
  --seagreen:   #7FB086;
  --periwinkle: #5E74BE;
  --marigold:   #F0BE55;
  --coral:      #E68A48;
  --rose:       #D46A8C;

  /* Accento principale: oro (dall'invito) */
  --accent:      #C4A24B;
  --accent-deep: #B4923E;

  --gold:       #C4A24B;
  --gold-deep:  #B4923E;
  --ink:        #3A342C;
  --ink-soft:   #7A7060;

  --bg:         #ffffff;
  --surface:    #ffffff;
  --surface-2:  #F8F4EC;
  --line:       #ECE4D6;
  --shadow:     0 10px 40px -18px rgba(58, 52, 44, .28);
  --shadow-sm:  0 4px 16px -8px rgba(58, 52, 44, .25);

  --serif:  "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body:   "Nunito Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --script: "Alex Brush", "Snell Roundhand", cursive;

  --radius: 16px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background: transparent; /* il bianco di base sta su html; così la filigrana ::before resta visibile */
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
  /* Sticky footer: su pagine corte (es. Dove & quando) il footer resta in fondo */
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
body > main { flex: 1 0 auto; }

/* Filigrana di sfondo: motivo della partecipazione, ripetuto senza cuciture e
   fortemente attenuato da un velo bianco per non compromettere la leggibilità */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .88), rgba(255, 255, 255, .88)),
    url('../img/pattern-tile.jpg') top center / 760px auto repeat fixed;
}

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

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout base -------------------------------------------------------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section--tint { background: var(--surface-2); }

/* ---- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .7rem;
}
.brand { font-family: var(--script); font-size: 2rem; color: var(--accent-deep); line-height: 1; }
.nav-links { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--ink); font-size: .92rem; letter-spacing: .02em; }
.nav-links a.active { color: var(--accent-deep); }
.nav-user { display: flex; align-items: center; gap: .6rem; }
.nav-user img { width: 30px; height: 30px; border-radius: 50%; }
.nav-user .nm { font-size: .85rem; }

/* Pulsante hamburger (solo mobile) */
.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 0;
  background: transparent; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--accent-deep);
  border-radius: 2px; transition: transform .2s ease, opacity .2s ease;
}
.site-header.open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header.open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header.open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative; text-align: center;
  padding: clamp(3.5rem, 10vw, 7rem) 1rem;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(196,162,75,.10), transparent 60%);
  overflow: hidden;
}
.hero .eyebrow {
  font-size: .74rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 1.4rem;
}
.hero .names {
  font-family: var(--script); font-weight: 400;
  font-size: clamp(3.6rem, 12vw, 7rem); line-height: .9;
  color: var(--accent-deep); margin: 0; text-wrap: balance;
}
.hero .date {
  font-family: var(--serif); font-size: clamp(1.1rem, 3vw, 1.6rem);
  letter-spacing: .2em; text-transform: uppercase; margin: 1.2rem 0 0; font-weight: 500;
}
.hero .place { color: var(--ink-soft); margin-top: .3rem; font-size: 1rem; letter-spacing: .05em; }
.rule { width: 70px; height: 1px; background: var(--gold); border: 0; margin: 1.6rem auto; }

/* ---- Countdown ---------------------------------------------------------- */
.countdown { display: flex; gap: clamp(.6rem, 3vw, 1.6rem); justify-content: center; margin-top: 1.6rem; }
.cd-cell {
  min-width: 74px; padding: .9rem .6rem; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm);
}
.cd-num { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cd-lab { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); margin-top: .4rem; }

/* ---- Titoli di sezione -------------------------------------------------- */
.sposi-photo {
  width: 210px; height: 210px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 1.6rem; border: 5px solid #fff;
  box-shadow: 0 0 0 2px var(--gold), var(--shadow);
}
.sec-head { text-align: center; margin-bottom: 2.2rem; }
.sec-head .kicker { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: var(--ink-soft); }
.sec-head h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .4rem 0 0; }

/* ---- Home: modalità "una schermata senza scroll" ----------------------- */
/* Attiva SOLO su viewport ampie e alte (desktop/tablet in orizzontale).
   Su mobile la home scorre normalmente per evitare sovrapposizioni. */
@media (min-width: 761px) and (min-height: 640px) {
  body.home { height: 100svh; overflow: hidden; display: flex; flex-direction: column; }
  body.home .site-header { position: static; flex: 0 0 auto; }
  body.home main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
  body.home .site-footer { flex: 0 0 auto; padding: .55rem 1rem; }
  body.home .site-footer .names { font-size: 1.4rem; }
  /* I figli non si restringono (evita che l'overflow:hidden dell'hero tagli i bottoni) */
  body.home main > .hero, body.home main > .section { flex: 0 0 auto; }
  body.home .hero { padding-top: clamp(1.5rem, 5vh, 3.5rem); padding-bottom: clamp(.75rem, 3vh, 2.5rem); overflow: visible; }
  body.home .hero .eyebrow { margin-bottom: clamp(.5rem, 2vh, 1.4rem); }
  body.home .hero .names { font-size: clamp(2.6rem, 8vh, 4.8rem); }
  body.home .rule { margin-block: clamp(.7rem, 2vh, 1.6rem); }
  body.home .countdown { margin-top: clamp(.7rem, 2.2vh, 1.6rem); }
  body.home .cd-cell { padding: clamp(.5rem, 1.4vh, .9rem) .6rem; }
  body.home .section { padding-block: clamp(.6rem, 2.2vh, 1.75rem); }
  body.home .sec-head { margin-bottom: clamp(.4rem, 1.4vh, 1.2rem); }
  body.home .sposi-photo {
    width: clamp(110px, 18vh, 200px); height: clamp(110px, 18vh, 200px);
    margin-bottom: clamp(.5rem, 1.8vh, 1.4rem);
  }
}
/* Su schermi ampi ma bassi si nasconde il paragrafo per non far scrollare */
@media (min-width: 761px) and (min-height: 640px) and (max-height: 760px) {
  body.home .sposi-intro { display: none; }
}

/* ---- Card info ---------------------------------------------------------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card .card-top { height: 6px; background: linear-gradient(90deg, var(--lilac), var(--periwinkle), var(--seagreen), var(--marigold)); }
.card .card-body { padding: 1.5rem 1.6rem 1.7rem; }
.card h3 { font-family: var(--serif); font-size: 1.5rem; margin: 0 0 .3rem; }
.card .muted { color: var(--ink-soft); font-size: .95rem; }
.card .addr { margin: .6rem 0 1rem; }

/* ---- Regalo / IBAN ------------------------------------------------------ */
.gift-card .card-body { padding: 1.6rem 1.6rem 1.8rem; }
.gift-row { display: flex; flex-direction: column; gap: .15rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.gift-row:last-of-type { border-bottom: 0; }
.gift-lab { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.gift-val { font-size: 1.05rem; color: var(--ink); }
.gift-iban {
  font-family: "Cormorant Garamond", ui-monospace, monospace;
  font-size: 1.5rem; font-weight: 600; letter-spacing: .06em;
  color: var(--accent-deep); word-break: break-all;
}

/* ---- Bottoni ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: var(--body); font-weight: 700; font-size: .95rem;
  padding: .75rem 1.5rem; border-radius: 999px; border: 1.5px solid transparent;
  background: var(--accent-deep); color: #fff; transition: transform .15s ease, filter .15s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent-deep); border-color: var(--accent-deep); }
.btn.danger { background: transparent; color: #b23b3b; border-color: #d9a5a5; padding: .4rem .9rem; font-size: .85rem; }
.btn:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* ---- Form / upload ------------------------------------------------------ */
.form-narrow { max-width: 560px; margin: 0 auto; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: .35rem; }
.field textarea, .field input[type=text] {
  width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--body); font-size: 1rem; background: var(--surface); color: var(--ink);
}
.field textarea:focus, .field input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.dropzone {
  border: 2px dashed var(--lilac); border-radius: 14px; padding: 2rem 1rem;
  text-align: center; color: var(--ink-soft); background: var(--surface-2); cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.dropzone.drag { background: #f3edfb; border-color: var(--viola); }
.dropzone strong { color: var(--ink); display: block; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .5rem; margin-top: 1rem; }
.previews img { border-radius: 10px; aspect-ratio: 1; object-fit: cover; }

/* ---- Galleria (admin + le mie cose) ------------------------------------ */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); }
.gallery img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.gallery .media-video { width: 100%; aspect-ratio: 1; object-fit: cover; background: #000; display: block; }
.previews video { max-width: 100%; border-radius: 10px; }
.gallery figcaption { padding: .5rem .6rem; font-size: .8rem; color: var(--ink-soft); }
.gallery .who { font-weight: 700; color: var(--ink); }

/* ---- Commenti ----------------------------------------------------------- */
.comment { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: .8rem; box-shadow: var(--shadow-sm); }
.comment .head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.comment .avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--lilac), var(--seagreen)); }
.comment .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.comment .meta b { display: block; font-size: .9rem; }
.comment .meta small { color: var(--ink-soft); font-size: .78rem; }
.comment .body { margin: 0; }

/* ---- Flash / avvisi ----------------------------------------------------- */
.flash { border-radius: 12px; padding: .9rem 1.2rem; margin-bottom: 1rem; font-size: .95rem; }
.flash.success { background: #eef7ef; border: 1px solid #bfe0c4; color: #2f6b3a; }
.flash.error   { background: #fbeeee; border: 1px solid #e6bcbc; color: #9e3838; }
.flash.info    { background: #f2f0fb; border: 1px solid #cfc7ec; color: #574a86; }

/* ---- Privacy note ------------------------------------------------------- */
.privacy-note {
  display: flex; gap: .7rem; align-items: flex-start; max-width: 620px; margin: 1.4rem auto 0;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: .9rem 1.1rem; font-size: .88rem; color: var(--ink-soft);
}

/* ---- Login -------------------------------------------------------------- */
.login-wrap { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 2rem 1rem; }
.login-card { max-width: 440px; }
.login-card h1 { font-family: var(--script); color: var(--accent-deep); font-size: 3.4rem; margin: 0 0 .5rem; }
.g-btn-holder { display: flex; justify-content: center; margin-top: 1.6rem; }

/* ---- Tabelle admin ------------------------------------------------------ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem; text-align: center; box-shadow: var(--shadow-sm); }
.stat .n { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; }
.stat .l { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.tabs { display: flex; gap: .5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; flex-wrap: wrap; }
.tabs a { padding: .6rem 1.1rem; border-radius: 10px 10px 0 0; color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.tabs a.active { color: var(--accent-deep); background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.admin { background: #f6edd6; color: var(--gold-deep); }
.badge.guest { background: #eef1f8; color: var(--periwinkle); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { text-align: center; padding: .5rem 1rem; color: var(--ink-soft); font-size: .82rem; line-height: 1.35; border-top: 1px solid var(--line); background: #fff; }
.site-footer .names { font-family: var(--script); font-size: 1.35rem; line-height: 1.2; color: var(--accent-deep); }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 760px) {
  .nav { flex-wrap: wrap; align-items: center; gap: .4rem; }
  .brand { font-size: 2rem; }
  .nav-toggle { display: flex; margin-left: auto; }
  /* Menu a tendina: nascosto finché non si apre */
  .nav-links {
    display: none; width: 100%; flex-direction: column; align-items: stretch;
    gap: 0; margin-top: .4rem; border-top: 1px solid var(--line); flex-wrap: nowrap;
  }
  .site-header.open .nav-links { display: flex; }
  .nav-links a {
    padding: .85rem .4rem; font-size: 1rem; border-bottom: 1px solid var(--line);
  }
  .nav-user {
    width: 100%; justify-content: flex-start; gap: .6rem;
    padding: .75rem .4rem 0; margin-top: .2rem;
  }
  .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .countdown { flex-wrap: wrap; }
  .cd-cell { min-width: 62px; flex: 1 1 40%; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

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