/* Biblioteca delle Risorse — Design System CSS v1.0 */

:root {
  --bib-green: #11824b;
  --bib-green-mid: #14854a;
  --bib-green-dark: #0f6b3b;
  --bib-green-light: #e8f5ee;
  --bib-green-pale: #f7faf8;
  --bib-border: #e2efe8;
  --bib-text: #2d3748;
  --bib-text-muted: #4a5568;
  --bib-white: #ffffff;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 10.5pt;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body {
  margin: 0;
  padding: 0;
  font-family: Inter, 'Segoe UI', Arial, Helvetica, sans-serif;
  color: var(--bib-text);
  line-height: 1.55;
  background: #e8ece9;
}

/* Screen preview */
.guide-wrapper {
  max-width: 210mm;
  margin: 24px auto;
  background: var(--bib-white);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

/* Page structure */
.page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 20mm 22mm 20mm;
  background: var(--bib-white);
  page-break-after: always;
  break-after: page;
}

.page:last-child {
  page-break-after: auto;
  break-after: auto;
}

.page-cover {
  padding: 0;
  min-height: 297mm;
  overflow: hidden;
}

.page-cover img {
  width: 100%;
  height: 297mm;
  object-fit: cover;
  display: block;
}

.cover-panel {
  position: relative;
  min-height: 297mm;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #0f6b3b 0%, #11824b 55%, #14854a 100%);
  color: #ffffff;
  padding: 16mm 18mm 14mm;
}

.cover-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #74f0af;
}

.cover-badge {
  display: inline-block;
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #a8dcc4;
  margin-bottom: 18mm;
}

.cover-title {
  font-size: 28pt;
  font-weight: 700;
  line-height: 1.15;
  color: #ffffff;
  margin: 0 0 8mm 0;
  max-width: 92%;
}

.cover-subtitle {
  font-size: 12pt;
  line-height: 1.55;
  color: #d4ede0;
  margin: 0 0 10mm 0;
  max-width: 85%;
}

.cover-divider {
  width: 48mm;
  height: 2px;
  background: #a8dcc4;
  margin-bottom: 10mm;
}

.cover-photo {
  margin-top: auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.cover-photo img {
  display: block;
  width: 100%;
  height: 78mm;
  object-fit: cover;
  object-position: center;
}

.cover-phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4mm;
  margin-bottom: 8mm;
}

.cover-phase {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4mm 3mm;
  text-align: center;
}

.cover-phase strong {
  display: block;
  font-size: 9pt;
  margin-bottom: 2mm;
}

.cover-phase span {
  font-size: 7.5pt;
  color: #a8dcc4;
}

.cover-brand {
  margin-top: 8mm;
}

.cover-brand strong {
  display: block;
  font-size: 13pt;
  margin-bottom: 2mm;
}

.cover-brand span {
  display: block;
  font-size: 9pt;
  color: #a8dcc4;
  line-height: 1.5;
}

/* Running header/footer simulation */
.page-header {
  position: absolute;
  top: 10mm;
  left: 20mm;
  right: 20mm;
  border-top: 4px solid var(--bib-green);
  padding-top: 6px;
  font-size: 7.5pt;
  color: var(--bib-text-muted);
  letter-spacing: 0.3px;
}

.page-footer {
  position: absolute;
  bottom: 10mm;
  left: 20mm;
  right: 20mm;
  border-top: 1px solid var(--bib-border);
  padding-top: 6px;
  font-size: 7.5pt;
  color: var(--bib-text-muted);
  display: flex;
  justify-content: space-between;
}

.page-content {
  margin-top: 8mm;
}

/* Typography */
h1 {
  font-size: 18pt;
  font-weight: 700;
  color: var(--bib-green);
  margin: 0 0 12px 0;
  line-height: 1.25;
}

h2 {
  font-size: 13pt;
  font-weight: 600;
  color: var(--bib-green-dark);
  margin: 20px 0 8px 0;
}

h3 {
  font-size: 11pt;
  font-weight: 600;
  color: var(--bib-text);
  margin: 16px 0 6px 0;
}

p {
  margin: 0 0 10px 0;
}

.lead {
  font-size: 11pt;
  color: var(--bib-text-muted);
  margin-bottom: 16px;
}

ul, ol {
  margin: 0 0 12px 0;
  padding-left: 20px;
}

li { margin-bottom: 4px; }

/* Components */
.bib-box {
  background: var(--bib-green-light);
  border-left: 4px solid var(--bib-green);
  padding: 12px 14px;
  margin: 14px 0;
  border-radius: 0 6px 6px 0;
}

.bib-box-title {
  font-weight: 700;
  color: var(--bib-green-dark);
  font-size: 10pt;
  margin-bottom: 6px;
}

.bib-box p:last-child,
.bib-box ul:last-child { margin-bottom: 0; }

.bib-recap {
  background: var(--bib-green-pale);
  border: 1px solid var(--bib-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 16px 0 0 0;
}

.bib-recap-title {
  font-weight: 700;
  color: var(--bib-green);
  font-size: 10pt;
  margin-bottom: 8px;
}

.bib-stat {
  text-align: center;
  margin: 16px 0;
}

.bib-stat-num {
  font-size: 28pt;
  font-weight: 700;
  color: var(--bib-green);
  line-height: 1;
}

.bib-stat-label {
  font-size: 9pt;
  color: var(--bib-text);
  margin-top: 4px;
}

.bib-stat-src {
  font-size: 7.5pt;
  color: var(--bib-text-muted);
  font-style: italic;
}

.bib-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 9pt;
}

.bib-table th {
  background: var(--bib-green);
  color: var(--bib-white);
  font-weight: 600;
  text-align: left;
  padding: 8px 10px;
}

.bib-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--bib-border);
  vertical-align: top;
}

.bib-table tr:nth-child(even) td {
  background: var(--bib-green-pale);
}

.bib-table tr:last-child td {
  border-bottom: none;
}

.bib-figure {
  margin: 16px 0;
  text-align: center;
}

.bib-figure img,
.bib-figure svg {
  max-width: 100%;
  height: auto;
}

.bib-figure-caption {
  font-size: 8pt;
  color: var(--bib-text-muted);
  font-style: italic;
  margin-top: 6px;
}

.bib-photo {
  margin: 12px 0 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--bib-border);
}

.bib-photo img {
  display: block;
  width: 100%;
  height: 128px;
  object-fit: cover;
  object-position: center;
}

.bib-question {
  border: 1.5px dashed var(--bib-green-mid);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
}

.chapter-num {
  font-size: 9pt;
  font-weight: 600;
  color: var(--bib-green-mid);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
}

.toc-list li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dotted var(--bib-border);
  padding: 8px 0;
  font-size: 10pt;
}

.toc-list .toc-page {
  color: var(--bib-text-muted);
  font-size: 9pt;
}

.sources-table { font-size: 8.5pt; }

.cover-brand {
  text-align: center;
  padding-top: 40mm;
}

/* Print */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  body { background: white; }
  .guide-wrapper {
    margin: 0;
    box-shadow: none;
    max-width: none;
  }
  .page {
    margin: 0;
    box-shadow: none;
  }
  .no-print { display: none !important; }
}

@media screen {
  .print-hint {
    position: fixed;
    bottom: 16px;
    right: 16px;
    background: var(--bib-green);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 9pt;
    z-index: 100;
  }
}
