/* ==========================================================================
   MEDIA/STUDIOS — design system
   Concept: il desk di un dipartimento di sviluppo editoriale. Sfondo "ink"
   scuro come una scrivania, documenti "paper" (coverage, contratti, dossier)
   appoggiati sopra, note a margine in rosso inchiostro, timbro di validazione
   dell'Expert. Niente crema+terracotta da default, niente neon su nero.
   ========================================================================== */

:root {
  /* --- palette (6 toni nominati) --- */
  --ink: #14161c;          /* sfondo primario, scuro */
  --paper: #ece4d2;        /* superficie "documento" */
  --paper-light: #f6f1e6;  /* documento in evidenza (hero, callout) */
  --ink-text: #201d18;     /* testo su paper */
  --stamp: #b3261e;        /* accento — timbro/inchiostro rosso (su carta, contrasto 5.17:1) */
  --stamp-bright: #e04b43; /* variante per testo su ink scuro (contrasto 4.53:1, verificato) */
  --bone: #b8b19f;         /* testo secondario su ink, linee, bordi */

  /* --- toni derivati (pannelli, linee) --- */
  --panel: #1b1e26;
  --panel-line: #2a2e39;
  --bone-dim: #8b8573; /* contrasto testo 4.52:1 su --panel, verificato */
  --stamp-soft: rgba(179, 38, 30, 0.14);

  /* --- tipografia --- */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* --- layout --- */
  --container: 1120px;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --radius: 3px;
  --header-h: 76px;
}

/* --------------------------------- reset -------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
button { font: inherit; background: none; border: none; cursor: pointer; color: inherit; }
table { border-collapse: collapse; width: 100%; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3rem;
  background: var(--stamp);
  color: var(--paper-light);
  padding: 0.6em 1em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  z-index: 1000;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

/* focus visibile ovunque, doppio anello leggibile su chiaro e su scuro */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--stamp);
  border-radius: 1px;
}
.doc :focus-visible, .pillar :focus-visible, .tier :focus-visible {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--stamp);
}

/* ------------------------------- tipografia ------------------------------ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp-bright);
}
.doc .eyebrow, .pillar .eyebrow { color: var(--stamp); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--paper-light); }
.doc h1, .doc h2, .doc h3, .pillar h3, .catalog-item h3 { color: var(--ink-text); }

h1 { font-size: clamp(2.4rem, 5.2vw, 4.1rem); line-height: 1.04; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.12; }
h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); line-height: 1.25; }

.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--bone);
  max-width: 46ch;
}
.doc .lede { color: #4a4436; }

em.accent { color: var(--stamp); font-style: italic; }

/* --------------------------------- layout -------------------------------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

section {
  display: block;
  /* flow-root crea un nuovo contesto di formattazione a blocco: elimina
     qualunque possibile collasso di margini con contenuto interno,
     indipendentemente dalla causa — misura difensiva oltre al padding. */
  display: flow-root;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0;
}
/* Seconda barriera indipendente dal padding: margine esplicito e forzato
   tra sezioni consecutive. Ridondante per design — se per qualunque motivo
   il padding non producesse lo spazio visibile, questo lo garantisce comunque. */
section + section {
  margin-top: clamp(3.5rem, 8vw, 6.5rem) !important;
}
.section-tight { padding: clamp(2.5rem, 6vw, 4rem) 0; }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.cluster { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }

/* --------------------------------- header --------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20, 22, 28, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--panel-line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.logo {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--paper-light);
  font-weight: 500;
}
.logo-slash { color: var(--stamp); }

.header-controls {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2vw, 1.6rem);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.lang-switch a {
  color: var(--bone-dim);
  padding: 0.2em 0.05em;
  border-bottom: 1px solid transparent;
}
.lang-switch a:hover { color: var(--paper-light); }
.lang-switch a[aria-current="true"] {
  color: var(--paper-light);
  border-bottom-color: var(--stamp-bright);
  cursor: default;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--paper-light);
}
.nav-toggle-bar::before { transform: translateY(-6px); }
.nav-toggle-bar::after { transform: translateY(4px); }

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2vw, 1.9rem);
}
.site-nav a:not(.nav-cta) {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--bone);
  padding: 0.4em 0.1em;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:not(.nav-cta):hover { color: var(--paper-light); }
.site-nav a[aria-current="page"] {
  color: var(--paper-light);
  border-bottom-color: var(--stamp);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.75em 1.3em;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: var(--stamp); color: var(--paper-light); }
.btn-primary:hover { background: #96201a; }
.btn-ghost { border-color: var(--bone-dim); color: var(--paper-light); }
.btn-ghost:hover { border-color: var(--paper-light); }
.doc .btn-ghost, .catalog-item .btn-ghost { border-color: #b7ab8c; color: var(--ink-text); }
.doc .btn-ghost:hover, .catalog-item .btn-ghost:hover { border-color: var(--ink-text); }
.btn:active { transform: translateY(1px); }

.nav-cta { flex-shrink: 0; }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  margin-right: 0.4rem;
}
.lang-switch a { color: var(--bone); padding: 0.2em 0.05em; }
.lang-switch a:hover { color: var(--paper-light); }
.lang-switch .lang-current {
  color: var(--stamp-bright);
  font-weight: 600;
}
.lang-switch .sep { color: var(--panel-line); aria-hidden: true; }
@media (max-width: 780px) {
  .lang-switch { order: -1; margin: 0 0 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--panel-line); }
}

/* --------------------------------- hero --------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding-top: clamp(3.5rem, 9vw, 6rem);
}
.hero-copy > * + * { margin-top: 1.25rem; }
.hero-actions { margin-top: 2rem; }
.hero-figure { display: flex; justify-content: center; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
}

/* ---------------------------------- stamp --------------------------------- */
.stamp-mark {
  --size: 190px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 3px solid var(--stamp-bright);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-8deg);
  flex-shrink: 0;
}
.stamp-mark::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--stamp-bright);
  border-radius: 50%;
}
.stamp-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.7 0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0.55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.stamp-mark-text {
  font-family: var(--font-mono);
  color: var(--stamp-bright);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  line-height: 1.5;
  z-index: 1;
}
.stamp-mark-text strong { display: block; font-size: 1.05rem; letter-spacing: 0.03em; }
.stamp-mark--sm { --size: 76px; }
.stamp-mark--sm .stamp-mark-text { font-size: 0.5rem; }
.stamp-mark--sm .stamp-mark-text strong { font-size: 0.68rem; }

/* --------------------------------- paper card ----------------------------- */
.doc {
  background: var(--paper);
  color: var(--ink-text);
  border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  position: relative;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.55);
}
.doc-light { background: var(--paper-light); }
.doc-tab {
  display: inline-block;
  background: var(--stamp);
  color: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4em 0.8em;
  border-radius: 3px;
  margin-bottom: 1.1rem;
}
.doc-tilt { transform: rotate(-0.6deg); }
.doc p + p { margin-top: 1em; }

/* --------------------------------- pilastri -------------------------------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
}
.pillar {
  background: var(--paper);
  color: var(--ink-text);
  border-radius: var(--radius);
  padding: 1.6rem 1.5rem 1.8rem;
  border-top: 3px solid var(--stamp);
}
.pillar .eyebrow { margin-bottom: 0.6rem; display: block; }
.pillar h3 { margin-bottom: 0.55rem; }
.pillar p { color: #4a4436; font-size: 0.98rem; }

/* --------------------------------- marginalia ------------------------------ */
.marginalia {
  border-left: 3px solid var(--stamp);
  padding: 0.9rem 0 0.9rem 1.25rem;
  background: var(--stamp-soft);
}
.marginalia .eyebrow { margin-bottom: 0.4rem; display: block; }
.marginalia p { font-size: 0.98rem; }
.marginalia p:not(:last-child) { margin-bottom: 0.5em; }

/* --------------------------------- steps ----------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.5rem;
}
.step-num {
  font-family: var(--font-mono);
  color: var(--stamp);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.step h3 { margin: 0.5rem 0 0.5rem; }
.step p { font-size: 0.98rem; }

/* --------------------------------- ledger / tabelle ------------------------- */
.ledger-wrap { overflow-x: auto; border-radius: var(--radius); }
.ledger {
  min-width: 480px;
  background: var(--paper);
  color: var(--ink-text);
}
.ledger caption { text-align: left; padding: 0.75rem 1.25rem; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stamp); }
.ledger th, .ledger td {
  text-align: left;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid #d8cfb6;
  font-size: 0.96rem;
}
.ledger thead th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b6250;
  border-bottom: 2px solid var(--ink-text);
}
.ledger tbody tr:last-child td { border-bottom: none; }
.ledger td.num, .ledger th.num { font-family: var(--font-mono); white-space: nowrap; }
.ledger tbody tr:hover { background: rgba(179, 38, 30, 0.05); }

/* --------------------------------- pricing --------------------------------- */
.price-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #d8cfb6;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
}
.price-figure { font-family: var(--font-display); font-size: clamp(2.4rem, 5vw, 3.4rem); font-weight: 600; }
.price-caption { font-family: var(--font-mono); font-size: 0.85rem; color: #6b6250; }
.price-alt {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #6b6250;
  margin-top: 0.2rem;
}

/* --------------------------------- fasce (studio) --------------------------- */
.tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}
.tier {
  background: var(--paper);
  color: var(--ink-text);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tier-name { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stamp); }
.tier-fee { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; }
.tier-meta { font-size: 0.88rem; color: #6b6250; }
.tier--custom { border: 1px dashed #b7ab8c; background: transparent; color: var(--paper-light); }
.tier--custom .tier-meta { color: var(--bone); }
.tier--custom .tier-name { color: var(--stamp); }

/* --------------------------------- checklist -------------------------------- */
.checklist { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.checklist li { display: flex; gap: 0.85rem; }
.checklist .mark {
  font-family: var(--font-mono);
  color: var(--stamp);
  flex-shrink: 0;
}
.checklist strong { display: block; color: var(--paper-light); margin-bottom: 0.2rem; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.checklist p { font-size: 0.95rem; margin: 0; }

/* --------------------------------- blockquote -------------------------------- */
.excerpt {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.5;
  color: var(--paper-light);
  border-left: 2px solid var(--stamp);
  padding-left: clamp(1.25rem, 3vw, 2rem);
}
.doc .excerpt { color: var(--ink-text); }
.excerpt cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stamp);
}

/* --------------------------------- CTA doppia -------------------------------- */
.dual-cta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}
.dual-cta .doc { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; }

/* --------------------------------- catalogo servizi (new order) ---------------- */
.catalog-item {
  background: var(--paper);
  color: var(--ink-text);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);
}
.catalog-item + .catalog-item { margin-top: 1.5rem; }
.catalog-item h3 { margin-top: 1.5rem; margin-bottom: 0.6rem; }
.catalog-item h3:first-of-type { margin-top: 0; }
.catalog-item .catalog-note { font-size: 0.9rem; color: #6b6250; margin-top: 0.75rem; }
.catalog-item .btn { margin-top: 1.25rem; }

/* --------------------------------- todo flag ------------------------------------ */
.todo-flag {
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--stamp-bright);
  border-bottom: 1px dashed var(--stamp-bright);
}
.doc .todo-flag, .catalog-item .todo-flag, .payment-panel .todo-flag {
  color: var(--stamp);
  border-bottom-color: var(--stamp);
}
/* dentro un bottone a sfondo pieno, eredita il colore del testo del
   bottone invece del rosso fisso — altrimenti sarebbe testo rosso su
   sfondo rosso (btn-primary), illeggibile */
.catalog-item .btn .todo-flag, .doc .btn .todo-flag {
  color: inherit;
  border-bottom-color: currentColor;
}

/* --------------------------------- selettore paese / pagamento ------------------ */
.country-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.country-tab {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.65em 1.2em;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid #b7ab8c;
  background: transparent;
  color: var(--ink-text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.country-tab:hover { border-color: var(--ink-text); }
.country-tab.is-active {
  background: var(--stamp);
  border-color: var(--stamp);
  color: var(--paper-light);
}
.payment-panel { margin-top: 1.5rem; }
.payment-panel[hidden] { display: none; }
.payment-details { margin: 0.75rem 0 0; }
.payment-details dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b6250;
  margin-top: 0.9rem;
}
.payment-details dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

/* --------------------------------- footer ------------------------------------- */
.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--panel-line);
  padding: clamp(2.5rem, 5vw, 3.5rem) 0 2rem;
  margin-top: clamp(4rem, 8vw, 7rem);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.75rem;
}
.footer-brand { font-family: var(--font-mono); color: var(--paper-light); letter-spacing: 0.06em; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.footer-links a { border-bottom: 1px solid transparent; }
.footer-links a:hover { color: var(--paper-light); border-color: var(--stamp); }
.footer-link-pending { color: var(--bone-dim); }
.footer-link-pending em { font-style: normal; opacity: 0.75; }
.footer-powered {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--bone-dim);
  width: 100%;
  padding-top: 1.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--panel-line);
}

/* --------------------------------- responsive nav ------------------------------ */
@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-line);
    padding: 1.25rem clamp(1.25rem, 4vw, 2.5rem) 1.75rem;
    gap: 0.25rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
  }
  .site-nav.is-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .site-nav a:not(.nav-cta) { padding: 1em 0; border-bottom: 1px solid var(--panel-line); }
  .nav-cta { margin-top: 0.75rem; justify-content: center; }
}
