/* ==========================================================================
   IdeeFuoriClasse — global.css
   Shared: reset, tokens, typography, header/footer, buttons, .wonky, .icon,
   tables, details/accordion, breadcrumbs, utilities.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  --paper: #FAF6EF;
  --ink: #1E1C1A;
  --ink-soft: #4A453F;
  --accent: #C0392B;
  --accent-dark: #96271C;
  --sand: #EFE6D8;
  --gold: #B9975B;

  --maxw: 800px;
  --maxw-wide: 1080px;
  --header-h: 68px;

  --font-display: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; display: block; }
ul, ol { padding-left: 1.15rem; }
table { border-collapse: collapse; width: 100%; }

/* ---------- 3. Typography ---------- */
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: .3px; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.18rem; font-family: var(--font-body); font-weight: 700; }
h4 { font-size: 1rem; font-family: var(--font-body); font-weight: 700; }
p { margin: 0 0 1.05em; }
strong { font-weight: 700; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover, a:focus { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .7rem;
}
.lead { font-size: 1.15rem; }
.muted { color: var(--ink-soft); }

/* ---------- 4. Layout ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.container-wide { width: 100%; max-width: var(--maxw-wide); margin: 0 auto; padding: 0 20px; }
main section { padding: 56px 0; scroll-margin-top: calc(var(--header-h) + 12px); }
main section.alt { background: var(--sand); }

/* ---------- 5. The "uneven border" signature ---------- */
.wonky {
  border: 2.5px solid var(--ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.wonky-alt {
  border: 2.5px solid var(--ink);
  border-radius: 15px 255px 15px 225px / 225px 15px 255px 15px;
}

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border: 2.5px solid var(--ink);
  border-radius: 18px 4px 16px 6px / 5px 14px 6px 18px;
  background: var(--accent);
  color: var(--paper);
  transition: transform .12s ease, background .12s ease;
}
.btn:hover, .btn:focus { background: var(--accent-dark); color: var(--paper); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover, .btn-ghost:focus { background: var(--sand); color: var(--ink); }
.btn-lg { padding: .95rem 1.9rem; font-size: 1.1rem; }

/* ---------- 7. Icons ---------- */
.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  vertical-align: -0.15em;
  stroke: currentColor;
}
.icon-lg { width: 30px; height: 30px; }
.icon-accent { color: var(--accent); }
.icon-gold { color: var(--gold); }

/* ---------- 8. Header & navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 2.5px solid var(--ink);
}
.site-header .container-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--accent); }
.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.05rem;
  margin: 0;
  padding: 0;
}
.nav-menu a {
  color: var(--ink);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.nav-menu a:hover, .nav-menu a:focus { color: var(--accent); border-bottom-color: var(--accent); }
.nav-menu .btn { color: var(--paper); border-bottom: 2.5px solid var(--ink); }

/* CSS-only hamburger */
#nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 6px;
  color: var(--ink);
}

@media (max-width: 900px) {
  .nav-toggle-label { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 2.5px solid var(--ink);
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
  }
  #nav-toggle:checked ~ .site-nav { max-height: 620px; }
  .nav-menu { flex-direction: column; align-items: stretch; gap: 0; padding: .5rem 20px 1.2rem; }
  .nav-menu li { border-top: 1px solid rgba(30,28,26,.15); }
  .nav-menu a { display: block; padding: .75rem 0; }
  .nav-menu .nav-cta { border-top: none; padding-top: .9rem; }
  .nav-menu .nav-cta a { display: inline-flex; }
}

/* ---------- 9. Breadcrumbs ---------- */
.breadcrumbs { font-size: .88rem; margin-bottom: 1.1rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: .45rem; color: var(--ink-soft); }
.breadcrumbs [aria-current="page"] { color: var(--ink-soft); }

/* ---------- 10. Cards & grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.card {
  background: var(--paper);
  padding: 24px 22px;
}
.card h3 { margin-top: .5rem; }
.card p:last-child { margin-bottom: 0; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: .55rem; align-items: flex-start; margin-bottom: .45rem; }
.check-list .icon { margin-top: .25rem; }

/* ---------- 11. Tables ---------- */
.table-scroll { overflow-x: auto; border: 2.5px solid var(--ink); border-radius: 6px; }
.table-scroll table { min-width: 560px; background: var(--paper); }
th, td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid rgba(30,28,26,.18); font-size: .97rem; }
thead th { background: var(--ink); color: var(--paper); font-weight: 700; }
tbody tr:nth-child(even) { background: var(--sand); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- 12. Accordion (details / summary) ---------- */
details.faq-item {
  background: var(--paper);
  padding: 4px 20px;
  margin-bottom: 14px;
}
details.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
  padding: 16px 0;
  font-weight: 700;
  font-size: 1.05rem;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item .icon-chevron { transition: transform .2s ease; }
details.faq-item[open] .icon-chevron { transform: rotate(180deg); }
details.faq-item > p, details.faq-item > ul { margin-bottom: 16px; }

/* ---------- 13. Figures & image placeholders ---------- */
.figure { margin: 0; }
.frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 18px;
  background: var(--sand);
  color: var(--ink-soft);
  font-size: .9rem;
  text-align: center;
  overflow: hidden;
}
figcaption { font-size: .88rem; color: var(--ink-soft); margin-top: .6rem; }

/* ---------- 14. CTA banner ---------- */
.cta-banner { background: var(--ink); color: var(--paper); }
.cta-banner h2 { color: var(--paper); }
.cta-banner .cta-inner { padding: 34px 26px; text-align: center; border-color: var(--paper); }
.cta-banner a:not(.btn) { color: var(--gold); }

/* ---------- 15. Footer ---------- */
.site-footer {
  background: var(--sand);
  border-top: 2.5px solid var(--ink);
  padding: 44px 0 26px;
  font-size: .95rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 26px; }
.site-footer h4 { margin-bottom: .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .4rem; }
.site-footer a { color: var(--ink); text-decoration: none; }
.site-footer a:hover, .site-footer a:focus { color: var(--accent); text-decoration: underline; }
.footer-legal {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(30,28,26,.2);
  font-size: .88rem;
  color: var(--ink-soft);
}

/* ---------- 16. Utilities ---------- */
.center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
