/* =========================================================
   STUDIO LEGALE PPDR - Foglio di stile principale
   Palette: oro antico #B08D57, antracite #24242A, avorio #F7F3EA
   Tipografia: Playfair Display (titoli) + Lato (testo)
   Approccio: mobile-first
   ========================================================= */

:root {
  --gold: #B08D57;
  --gold-light: #C6A15B;
  --gold-dark: #8a6c3f;
  --charcoal: #24242A;
  --charcoal-light: #3a3a40;
  --ivory: #F7F3EA;
  --white: #FFFFFF;
  --text: #2b2b2e;
  --font-title: 'Playfair Display', Georgia, serif;
  --font-body: 'Lato', 'Open Sans', sans-serif;
  --radius: 6px;
  --shadow: 0 4px 18px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--ivory);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-title);
  color: var(--charcoal);
  line-height: 1.25;
}

a { color: var(--gold-dark); text-decoration: none; }
a:hover { color: var(--gold); }

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}
.narrow { max-width: 820px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all 0.25s ease;
  cursor: pointer;
  border: 2px solid transparent;
}
.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-dark); color: var(--white); }
.btn-outline {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold-dark);
}
.btn-outline:hover { background: var(--gold); color: var(--white); }

.center-cta { text-align: center; margin-top: 40px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--charcoal);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.35);
  transition: padding 0.2s ease;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: clamp(16px, 3vw, 36px);
  padding: 22px 20px;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.brand-logo {
  height: 64px;
  width: auto;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.brand:hover .brand-logo {
  transform: scale(1.06);
  filter: drop-shadow(0 0 10px rgba(214,178,122,0.55));
}

/* Nav toggle (hamburger) */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 22px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1100;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--gold-light);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.main-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: 78%;
  max-width: 340px;
  height: 100vh;
  background: var(--charcoal);
  padding: 90px 30px 30px;
  transition: right 0.3s ease;
  overflow-y: auto;
}
.main-nav.open { right: 0; }
.main-nav ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.main-nav a {
  display: block;
  color: var(--ivory);
  padding: 12px 0;
  font-weight: 400;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.main-nav a:hover { color: var(--gold-light); }
.main-nav .nav-cta {
  color: var(--gold-light);
  font-weight: 700;
}
.main-nav .dropdown {
  list-style: none;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
}
.main-nav .dropdown a { padding: 8px 0; font-size: 0.92rem; border-bottom: none; }

/* ---------- Hero ---------- */
.hero {
  background-size: cover;
  background-position: center;
  color: var(--white);
  padding: 90px 0 70px;
  text-align: center;
}
.hero-content { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero-logo { height: 90px; width: auto; margin-bottom: 4px; }
.hero h1 {
  font-size: 2.1rem;
  color: var(--white);
}
.hero-claim {
  max-width: 620px;
  font-size: 1.05rem;
  color: var(--ivory);
}

.page-hero {
  background-size: cover;
  background-position: center;
  color: var(--white);
  padding: 60px 0;
  text-align: center;
}
.page-hero.small { padding: 44px 0; }
.page-hero h1 { color: var(--white); font-size: 1.9rem; }
.post-meta { color: var(--gold-light); margin-top: 8px; }

/* ---------- Sections ---------- */
.section { padding: 60px 0; }
.section-alt { background: var(--white); }
.section-title {
  text-align: center;
  margin-bottom: 34px;
  font-size: 1.7rem;
  position: relative;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 14px auto 0;
}
.lead { font-size: 1.1rem; color: var(--charcoal-light); }

/* ---------- Grids ---------- */
.grid-2, .grid-3, .grid-4 { display: grid; gap: 24px; grid-template-columns: 1fr; }

/* ---------- Cards ---------- */
.area-card, .post-card, .avvocato-card, .avvocato-full-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border-top: 3px solid var(--gold);
}
.area-card:hover, .post-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(0,0,0,0.18); }
.area-card h3, .area-card h2 { margin-bottom: 10px; }
.area-card p, .post-card p { color: #555; margin: 8px 0 14px; }
.link-more { color: var(--gold-dark); font-weight: 700; font-size: 0.9rem; }
.area-card.large { padding: 34px; }

.post-date { font-size: 0.8rem; color: var(--gold-dark); font-weight: 700; letter-spacing: 0.03em; }

.avvocato-card { text-align: center; }
.avvocato-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--charcoal); color: var(--gold-light);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-title); font-size: 1.3rem; font-weight: 700;
  margin: 0 auto 14px;
}
.avvocato-avatar.large { width: 90px; height: 90px; font-size: 1.7rem; }
.avvocato-ruolo { color: var(--gold-dark); font-weight: 700; font-size: 0.9rem; margin: 4px 0 10px; }
.avvocato-full-card { display: flex; gap: 20px; align-items: flex-start; }

/* ---------- Accordion (Aree di competenza) ---------- */
.accordion { margin-top: 30px; }
.accordion-item {
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: none;
  padding: 18px 22px;
  font-family: var(--font-title);
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--charcoal);
}
.accordion-icon { color: var(--gold); font-size: 1.3rem; }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 22px;
}
.accordion-item.open .accordion-body { max-height: 400px; padding: 0 22px 20px; }
.accordion-item.open .accordion-header { border-bottom: 1px solid #eee; }
.accordion-body ul { padding-left: 20px; color: #444; }
.accordion-body li { margin-bottom: 6px; }

/* ---------- Topic list (Aree di competenza, static) ---------- */
.topic-list { margin-top: 30px; }
.topic-item {
  background: var(--white);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  padding: 22px 26px 24px;
}
.topic-item h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--charcoal);
  margin-bottom: 8px;
}
.topic-item .topic-desc { color: #555; margin-bottom: 12px; line-height: 1.6; }
.topic-item ul { padding-left: 20px; color: #444; }
.topic-item li { margin-bottom: 6px; }

/* ---------- Article ---------- */
.article-body p { margin-bottom: 16px; color: #333; }
.article-body h2 {
  font-family: var(--font-title);
  color: var(--gold-dark);
  font-size: 1.35rem;
  margin: 34px 0 12px;
}
.article-body h2:first-child { margin-top: 0; }
.article-body h3 {
  font-family: var(--font-title);
  color: var(--text);
  font-size: 1.08rem;
  margin: 22px 0 10px;
}
.article-body ul, .article-body ol { margin: 0 0 16px 22px; color: #333; }
.article-body li { margin-bottom: 8px; }
.article-body .legal-updated { color: #777; font-size: 0.88rem; margin-bottom: 28px; }
.article-body a { color: var(--gold-dark); text-decoration: underline; }
.article-body a:hover { color: var(--gold); }

/* ---------- Contact ---------- */
.contact-grid { align-items: start; }
.contact-info p { margin-bottom: 10px; }
.map-embed { margin-top: 20px; }
.contact-form .form-group { margin-bottom: 16px; }
.contact-form label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.92rem; }
.contact-form input, .contact-form textarea, .contact-form select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.contact-form input:focus, .contact-form textarea:focus, .contact-form select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.form-check { display: flex; align-items: flex-start; gap: 8px; }
.form-check input { width: auto; margin-top: 4px; }
.form-check label { font-weight: 400; font-size: 0.85rem; }
.form-row { display: flex; flex-direction: column; gap: 16px; }
.contact-alt { margin-top: 40px; padding-top: 24px; border-top: 1px solid #e6e0d4; text-align: center; }
.contact-alt p { margin-bottom: 8px; }

@media (min-width: 640px) {
  .form-row { flex-direction: row; }
  .form-row > div { flex: 1; }
}

/* Honeypot: nascosto ai browser, visibile ai bot che ignorano CSS */
.hp-field { position: absolute; left: -9999px; top: -9999px; opacity: 0; height: 0; overflow: hidden; }

.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 700; }
.alert-success { background: #e5f3e0; color: #2f6b1f; border: 1px solid #b7ddb0; }
.alert-error { background: #fbe6e6; color: #a12727; border: 1px solid #eab6b6; }

/* ---------- Footer ---------- */
.site-footer { background: var(--charcoal); color: #d8d8dc; padding: 50px 0 0; }
.footer-inner { display: grid; gap: 30px; grid-template-columns: 1fr; padding-bottom: 30px; }
.footer-logo-link { display: inline-block; margin-bottom: 12px; }
.footer-logo {
  height: 50px;
  opacity: 0.95;
  transition: transform 0.25s ease, filter 0.25s ease, opacity 0.25s ease;
}
.footer-logo-link:hover .footer-logo {
  transform: scale(1.06);
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(214,178,122,0.55));
}
.footer-col h4 { color: var(--gold-light); font-size: 1rem; margin-bottom: 14px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: #cfcfd4; }
.footer-col a:hover { color: var(--gold-light); }
.footer-email { font-size: 0.9rem; }
.footer-phone { font-size: 0.9rem; margin-top: 4px; }
.footer-phone a { color: #cfcfd4; }
.footer-phone a:hover { color: var(--gold-light); }
.contact-info .footer-phone { font-size: 1.15rem; }
.contact-info .footer-phone a { color: var(--gold-dark); font-weight: 700; }
.contact-info .footer-phone a:hover { color: var(--gold); }
.email-label { color: #999; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 18px 10px;
  font-size: 0.8rem;
  color: #999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.footer-bottom-left { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.footer-credit {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #999;
}
.footer-credit-text { align-self: flex-end; line-height: 1.2; }
.footer-credit-link {
  display: inline-flex;
  align-items: flex-end;
  align-self: flex-end;
  line-height: 0;
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.footer-credit-link:hover { opacity: 0.85; filter: drop-shadow(0 0 6px rgba(214,178,122,0.4)); }
.footer-credit-logo { height: 34px; width: auto; display: block; }
.footer-legal-links { font-size: 0.8rem; }
.footer-legal-links a { color: #999; }
.footer-legal-links a:hover { color: var(--gold-light); }

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    text-align: left;
  }
  .footer-bottom-left { align-items: flex-start; }
  .footer-credit { justify-content: flex-start; }
}

/* ---------- Admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid #ddd; text-align: left; font-size: 0.9rem; }
.link-btn { background: none; border: none; color: var(--gold-dark); cursor: pointer; text-decoration: underline; font-size: 0.9rem; }

/* =========================================================
   BREAKPOINTS - mobile-first
   ========================================================= */

/* Tablet: 768px+ */
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2.6rem; }
  .hero-claim { font-size: 1.15rem; }
  .page-hero h1 { font-size: 2.3rem; }
  .section-title { font-size: 2rem; }
}

/* Small desktop / large tablet: 1024px+ */
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .footer-inner { grid-template-columns: 2fr 1fr 1fr; }

  .nav-toggle { display: none; }
  .main-nav {
    position: static;
    width: auto;
    height: auto;
    background: none;
    padding: 0;
    overflow: visible;
    flex: 1;
  }
  .main-nav ul {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: clamp(10px, 2vw, 26px);
    width: 100%;
  }
  .main-nav li { white-space: nowrap; }
  .main-nav a { border-bottom: none; padding: 6px 0; position: relative; white-space: nowrap; }
  .main-nav a:not(.nav-cta)::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.25s ease;
  }
  .main-nav a:not(.nav-cta):hover::after { width: 100%; }
  .main-nav .nav-cta {
    border: 2px solid var(--gold-light);
    padding: 8px 18px;
    border-radius: var(--radius);
  }
  .main-nav .has-dropdown { position: relative; }
  .main-nav .dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--charcoal);
    min-width: 220px;
    padding: 10px 0;
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .main-nav .has-dropdown:hover .dropdown { display: flex; }
  .main-nav .dropdown a { padding: 10px 18px; text-align: left; width: 100%; }
}

/* Small phones: below 480px - tighten spacing */
@media (max-width: 480px) {
  .hero { padding: 60px 0 46px; }
  .hero-logo { height: 68px; }
  .section { padding: 44px 0; }
  .brand-logo { height: 50px; }
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--charcoal);
  border: 2px solid var(--gold);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 900;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--gold);
  color: var(--charcoal);
  box-shadow: 0 8px 22px rgba(0,0,0,0.45), 0 0 12px rgba(214,178,122,0.5);
}
.back-to-top svg { width: 20px; height: 20px; display: block; }

@media (min-width: 768px) {
  .back-to-top { right: 32px; bottom: 32px; width: 52px; height: 52px; }
}
