/* =========================================================
   HHP256 — Design System
   Palette: laboratorio / specimen card
   ========================================================= */

:root {
  --ink:        #121A1F;   /* header, testo forte */
  --paper:      #FAF9F5;   /* sfondo pagina */
  --paper-2:    #F1EFE7;   /* sfondo sezioni alternate */
  --slate:      #3C4650;   /* testo body */
  --slate-soft: #6B7580;   /* testo secondario */
  --line:       #DEDACD;   /* hairline / bordi */
  --accent:     #2B6E63;   /* teal — identità primaria */
  --accent-2:   #B85C2E;   /* rust — dati / evidenze */
  --accent-soft:#E7F0EE;   /* teal chiaro, badge/sfondi */
  --mono:       "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --serif:      "Source Serif 4", "Georgia", serif;
  --sans:       "Inter", -apple-system, "Segoe UI", sans-serif;

  --header-h: 64px;
  --toc-w: 260px;
  --info-w: 300px;
  --radius: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--slate);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.site-header .logo {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.site-header .logo span { color: var(--accent-2); }

.site-search {
  position: relative;
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 36px;
}
.site-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: #fff;
  font-family: var(--sans);
  font-size: 13.5px;
  padding: 0 8px;
}
.site-search input::placeholder { color: rgba(255,255,255,0.45); }
.site-search svg { flex-shrink: 0; opacity: 0.6; width: 15px; height: 15px; }

/* ---------------- Search results dropdown ---------------- */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 420px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  z-index: 200;
}
.search-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--accent-soft); }
.search-result-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}
.search-result-page {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 6px;
  border-radius: 3px;
}
.search-result-snippet {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--slate-soft);
  line-height: 1.4;
}
.search-empty {
  padding: 14px;
  font-size: 13px;
  color: var(--slate-soft);
  text-align: center;
}

.header-nav {
  margin-left: auto;
  display: flex;
  gap: 20px;
  font-size: 13px;
}
.header-nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
}
.header-nav a:hover { color: #fff; }

/* ---------------- Intro / breadcrumb row ---------------- */
.intro-row {
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 14px 24px 16px;
}
.intro-row .inner {
  max-width: 1320px;
  margin: 0 auto;
}
.breadcrumb {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.breadcrumb a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
}
.breadcrumb a:hover { color: #fff; }
.breadcrumb span { color: rgba(255,255,255,0.3); }
.breadcrumb .current { color: var(--accent-2); font-weight: 500; }

.intro-desc {
  margin: 0 0 14px;
  max-width: 820px;
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(255,255,255,0.68);
}

.quick-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-menu a {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.quick-menu a:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
}
.quick-menu a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (max-width: 760px) {
  .quick-menu { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
}

/* ---------------- Title block ---------------- */
.title-block {
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  padding: 28px 24px 22px;
}
.title-block .inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.title-block .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}
.title-block .eyebrow1 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}
.title-block h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
}
.title-meta {
  display: flex;
  gap: 18px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--slate-soft);
}
.title-meta b { color: var(--ink); font-weight: 600; }

/* ---------------- Layout grid ---------------- */
.page-grid {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--toc-w) 1fr var(--info-w);
  gap: 32px;
  padding: 28px 24px 80px;
  align-items: start;
}

/* ---------------- TOC sidebar ---------------- */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  padding-right: 8px;
}
.toc h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-soft);
  margin: 0 0 10px;
  font-family: var(--sans);
  font-weight: 600;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 6px 10px;
  margin-bottom: 1px;
  font-size: 13px;
  color: var(--slate);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.toc a:hover { background: var(--accent-soft); color: var(--accent); }
.toc a.active {
  border-left-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.toc .sub { padding-left: 22px; font-size: 12.5px; }

/* ---------------- Main content ---------------- */
.content { min-width: 0; }

section.card {
  scroll-margin-top: calc(var(--header-h) + 16px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 20px;
}
section.card h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
section.card h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 20px 0 8px;
}
section.card p { margin: 0 0 12px; }
section.card p:last-child { margin-bottom: 0; }

/* key-value data table, stile PubChem */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 4px 0 8px;
}
table.data-table tr { border-bottom: 1px solid var(--line); }
table.data-table tr:last-child { border-bottom: none; }
table.data-table td {
  padding: 9px 4px;
  vertical-align: top;
}
table.data-table td:first-child {
  width: 220px;
  color: var(--slate-soft);
  font-weight: 500;
}
table.data-table td:last-child {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}
table.data-table .src {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--slate-soft);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-right: 6px;
}
.badge.warn { background: #F5E8DD; color: var(--accent-2); }

/* ---------------- Right info panel ---------------- */
.info-panel {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
.info-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}
.info-card .structure {
  aspect-ratio: 4 / 3;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.info-card .structure img,
.info-card .structure svg { max-width: 96%; max-height: 96%; object-fit: contain; }
.info-card .facts { padding: 14px 16px; }
.info-card .facts dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-soft);
  margin: 10px 0 2px;
}
.info-card .facts dt:first-child { margin-top: 0; }
.info-card .facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
}

/* ---------------- Contact form ---------------- */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
  max-width: 560px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.form-row input,
.form-row select,
.form-row textarea {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--accent);
}

.form-row textarea { resize: vertical; min-height: 110px; font-family: var(--sans); }

.btn-submit {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 11px 22px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--sans);
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.88; }

/* ---------------- Footer ---------------- */
/* ---------------- Document viewer (Bibliography) ---------------- */
#immagini {
  margin-top: 18px;
}
#slider1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
#slider1 button {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
#slider1 button:hover { background: var(--accent-soft); }

.mainblock {
  position: relative;
  display: flex;
  justify-content: center;
}
.page-grid.no-info {
  grid-template-columns: var(--toc-w) 1fr;
}

.mainblock img.xzoom1,
.mainblock img.xzoom {
  width: 100%;
  max-width: 920px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  cursor: zoom-in;
}
.mainblock .openzoom1 {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mainblock .openzoom1 img { width: 18px; height: 18px; }

/* la card che contiene il viewer si allarga oltre la larghezza standard delle altre card */
#viewer.card { max-width: none; }

/* ---------------- Lightbox ---------------- */
#viewer-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 14, 18, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
#viewer-lightbox[hidden] { display: none; }
#viewer-lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#viewer-lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
#viewer-lightbox-close:hover { background: rgba(255,255,255,0.22); }

footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--slate-soft);
  font-size: 12.5px;
}
footer a {
  color: var(--accent);
  text-decoration: none;
  margin-left: 8px;
  font-weight: 500;
}
footer a:hover { text-decoration: underline; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1100px) {
  .page-grid { grid-template-columns: var(--toc-w) 1fr; }
  .info-panel { display: none; }
}
@media (max-width: 760px) {
  .page-grid { grid-template-columns: 1fr; }
  .toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
    margin-bottom: 10px;
  }
  .title-meta { margin-left: 0; }
  .header-nav { display: none; }
}
