/* ════════════════════════════════════════════════════════════════════════
   LibriAntichi — Style aligned with Voices of Heritage (VoH) platform
   Light theme, bordeaux accents, pill-shaped form fields
   ════════════════════════════════════════════════════════════════════════ */

:root {
  --voh-red:        #A8253E;
  --voh-red-dark:   #8B1E33;
  --voh-red-strip:  #B22D44;
  --voh-red-light:  #E7B8C2;
  --voh-gray:       #918577;
  --voh-bg:         #FFFFFF;
  --voh-bg-soft:    #F8F6F4;
  --voh-border:     #D5D5D5;
  --voh-border-soft:#E8E8E8;
  --voh-text:       #1F1F1F;
  --voh-text-2:     #5A5A5A;
  --voh-text-3:     #9A9A9A;
  --voh-good:       #5B8A4A;
  --voh-warn:       #C68A2A;
  --voh-bad:        #C44536;
  --shadow-card:    0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-card-h:  0 4px 16px rgba(0, 0, 0, 0.10);
  --radius-pill:    100px;
  --radius-card:    8px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--voh-bg);
  color: var(--voh-text);
  min-height: 100vh;
  line-height: 1.55;
  font-size: 15px;
}

h1, h2, h3 { margin: 0; font-weight: 600; color: var(--voh-text); }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.1rem; }

a { color: var(--voh-red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TOP RED STRIP ─────────────────────────────────────────── */
.top-strip {
  height: 7px;
  background: var(--voh-red-strip);
}

/* ── HEADER ────────────────────────────────────────────────── */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 40px;
  border-bottom: 1px solid var(--voh-red-light);
  background: var(--voh-bg);
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-logo img {
  height: 80px;
  width: auto;
  display: block;
}
@media (max-width: 650px) {
  .site-logo img { height: 56px; }
}
.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--voh-text);
  border: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  font-family: inherit;
}
.nav-link:hover { color: var(--voh-red); text-decoration: none; }
.nav-link.active {
  color: var(--voh-red);
  border-color: var(--voh-red);
}

/* ── PAGE TITLE WITH RED BAR ───────────────────────────────── */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 40px 8px;
  max-width: 1500px;
  margin: 0 auto;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.page-title::before {
  content: '';
  width: 4px;
  height: 36px;
  background: var(--voh-red);
  border-radius: 1px;
}
.lang-switcher {
  display: flex;
  gap: 4px;
}
.lang-switcher img { width: 24px; height: 18px; cursor: pointer; }
.lang-flag {
  width: 28px; height: 20px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--voh-border);
  display: inline-block;
  background-size: cover;
  background-position: center;
}
.lang-flag.it { background: linear-gradient(to right, #009246 33%, #FFFFFF 33% 66%, #CE2B37 66%); }
.lang-flag.en { background: linear-gradient(180deg,
  #B22234 0 8.33%, #FFF 8.33% 16.66%, #B22234 16.66% 25%, #FFF 25% 33.33%,
  #B22234 33.33% 41.66%, #FFF 41.66% 50%, #B22234 50% 58.33%, #FFF 58.33% 66.66%,
  #B22234 66.66% 75%, #FFF 75% 83.33%, #B22234 83.33% 91.66%, #FFF 91.66% 100%);
  position: relative; }
.lang-flag.en::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 40%; height: 53.33%; background: #3C3B6E;
}

/* ── DIVIDER LINE BELOW HEADER ─────────────────────────────── */
.page-divider {
  border-top: 1px solid var(--voh-border-soft);
  margin: 6px 40px 0;
}

/* ── LAYOUT ────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 28px;
  padding: 22px 40px 50px;
  max-width: 1500px;
  margin: 0 auto;
}
@media (max-width: 1050px) { .layout { grid-template-columns: 1fr; padding: 22px 24px; } }

/* ── CARD ──────────────────────────────────────────────────── */
.card {
  background: var(--voh-bg);
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--voh-border-soft);
}
.card-head h2 { font-size: 1.05rem; color: var(--voh-text); }

/* ── STAGE / AVATAR ────────────────────────────────────────── */
.stage { display: flex; flex-direction: column; }
.stage-canvas {
  position: relative;
  aspect-ratio: 16 / 11;
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 60%, #F5F0EA 0%, #FFFFFF 70%);
  overflow: hidden;
  transition: background 0.8s ease;
}
.stage-tag {
  position: absolute;
  top: 14px; left: 18px;
  background: var(--voh-bg);
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--voh-text-2);
  font-weight: 500;
  z-index: 5;
  box-shadow: var(--shadow-card);
  display: inline-flex; align-items: center; gap: 6px;
}
.stage-tag::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--voh-red);
}
#book-container {
  display: flex; justify-content: center; align-items: center;
  width: 100%; height: 100%;
  position: relative;
}

/* ── Stack di immagini fotografiche del manoscritto beneventano ── */
.ms-stack {
  position: relative;
  width: 92%;
  height: 92%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.6s ease;
}
.ms-img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(4px 10px 22px rgba(60, 30, 10, 0.30));
  user-select: none;
  pointer-events: none;
}
.ms-caption {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(255,255,255,0.94);
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem;
  z-index: 10;
  box-shadow: var(--shadow-card);
}
.ms-caption-num {
  font-weight: 700;
  color: var(--voh-red);
  font-size: 0.84rem;
}
.ms-caption-label {
  color: var(--voh-text-2);
  font-weight: 500;
}

/* Per-location stage backgrounds (subtle, light-theme appropriate) */
.stage-canvas.loc-vault     { background: radial-gradient(ellipse at 50% 60%, #E8EDF2 0%, #FFFFFF 70%); }
.stage-canvas.loc-library   { background: repeating-linear-gradient(90deg, transparent 0 24px, rgba(180,140,80,0.05) 24px 25px), radial-gradient(ellipse at 50% 60%, #F7EFE2 0%, #FFFFFF 70%); }
.stage-canvas.loc-museum    { background: radial-gradient(ellipse at 50% 40%, #FFF5E8 0%, #FFFFFF 70%); }
.stage-canvas.loc-monastery { background: repeating-linear-gradient(0deg, transparent 0 32px, rgba(120,120,100,0.06) 32px 33px), radial-gradient(ellipse at 50% 60%, #EEEDE5 0%, #FFFFFF 70%); }
.stage-canvas.loc-basement  { background: radial-gradient(ellipse at 50% 85%, rgba(80,120,90,0.18) 0%, transparent 60%), radial-gradient(ellipse at 50% 40%, #E8EAE5 0%, #DEDED5 70%); }
.stage-canvas.loc-attic     { background: radial-gradient(ellipse at 50% 25%, rgba(255,180,80,0.30) 0%, transparent 60%), radial-gradient(ellipse at 50% 60%, #FAEAD0 0%, #FFF5E0 70%); }

/* KPI overlay */
.overlay {
  position: absolute; inset: auto 18px 18px 18px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.kpi {
  background: var(--voh-bg);
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.kpi-label {
  font-size: 0.68rem;
  color: var(--voh-text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.kpi-label::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--voh-red);
}
.kpi-value {
  font-size: 1.5rem;
  color: var(--voh-text);
  line-height: 1.1;
  font-weight: 600;
  margin-top: 3px;
}
.kpi-value small {
  font-size: 0.7rem; color: var(--voh-text-3);
  margin-left: 6px; font-weight: 400;
}

/* ── BUTTONS ───────────────────────────────────────────────── */
button.btn-primary, button.btn-ghost, button.btn-outline {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 9px 22px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}
button.btn-primary {
  background: var(--voh-red);
  color: #FFFFFF;
  border-color: var(--voh-red);
}
button.btn-primary:hover {
  background: var(--voh-red-dark);
  border-color: var(--voh-red-dark);
}
button.btn-primary.playing {
  background: #6A6A6A;
  border-color: #6A6A6A;
}
button.btn-ghost {
  background: transparent;
  color: var(--voh-text-2);
  border-color: var(--voh-border);
}
button.btn-ghost:hover { color: var(--voh-red); border-color: var(--voh-red); }
button.btn-outline {
  background: transparent;
  color: var(--voh-red);
  border-color: var(--voh-red);
}
button.btn-outline:hover {
  background: var(--voh-red);
  color: #FFFFFF;
}

.stage-controls { display: flex; gap: 8px; }

/* ── TIMELINE ──────────────────────────────────────────────── */
.timeline {
  padding: 16px 22px 20px;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  border-top: 1px solid var(--voh-border-soft);
}
.timeline label { color: var(--voh-text-2); font-size: 0.85rem; font-weight: 500; }
.timeline output {
  font-size: 1.05rem;
  color: var(--voh-red);
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* ── RANGE INPUT ───────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--voh-red) 0%, var(--voh-border) 0%);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--voh-red); border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 1px var(--voh-red), 0 2px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--voh-red); border: 3px solid #FFFFFF;
  box-shadow: 0 0 0 1px var(--voh-red);
  cursor: pointer;
}

/* ── DASHBOARD / FIELDSET ──────────────────────────────────── */
.dashboard { padding-bottom: 4px; }
fieldset {
  border: none;
  padding: 16px 22px;
  margin: 0;
  border-bottom: 1px solid var(--voh-border-soft);
}
fieldset:last-child { border-bottom: none; }
legend {
  font-size: 0.78rem;
  color: var(--voh-text-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
legend::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--voh-red);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  display: block;
  font-size: 0.78rem;
  color: var(--voh-text-2);
  font-weight: 600;
  margin-bottom: 4px;
}
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 0.78rem; color: var(--voh-text-2); font-weight: 600; }

/* ── PILL DROPDOWN (VoH signature) ─────────────────────────── */
select {
  width: 100%;
  padding: 10px 36px 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--voh-bg);
  color: var(--voh-text);
  border: 1px solid var(--voh-border);
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%231F1F1F' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
select:focus {
  outline: none;
  border-color: var(--voh-red);
  box-shadow: 0 0 0 3px rgba(168, 37, 62, 0.10);
}
select option { background: #FFFFFF; color: var(--voh-text); }

/* ── MANUSCRIPT CARD (VoH result card style) ───────────────── */
.manu-card {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-card);
  background: var(--voh-bg);
  border: 1px solid var(--voh-border-soft);
  box-shadow: var(--shadow-card);
}
.manu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  margin-bottom: 10px;
}
.manu-row > div { display: grid; gap: 3px; }
.manu-k {
  font-size: 0.68rem;
  color: var(--voh-text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.manu-k::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--voh-red);
}
.manu-v {
  font-size: 0.92rem;
  color: var(--voh-text);
  font-weight: 500;
}
.manu-v.link {
  color: var(--voh-red);
  text-decoration: underline;
  cursor: pointer;
}
.manu-state {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--voh-border);
}
.badge {
  font-size: 0.74rem;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 500;
}
.badge.ok   { background: rgba(91,138,74,0.12);  color: var(--voh-good); border-color: rgba(91,138,74,0.35); }
.badge.warn { background: rgba(198,138,42,0.12); color: var(--voh-warn); border-color: rgba(198,138,42,0.35); }
.badge.bad  { background: rgba(196,69,54,0.12);  color: var(--voh-bad);  border-color: rgba(196,69,54,0.35); }
.manu-note {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--voh-border);
  font-size: 0.84rem;
  color: var(--voh-text-2);
  line-height: 1.55;
  font-style: italic;
}

/* ── LOCATION BUTTONS ──────────────────────────────────────── */
.locations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 600px) { .locations { grid-template-columns: 1fr 1fr; } }
.loc {
  background: var(--voh-bg);
  color: var(--voh-text-2);
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-pill);
  padding: 9px 6px;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  text-align: center;
}
.loc:hover { color: var(--voh-red); border-color: var(--voh-red); }
.loc.on {
  background: var(--voh-red);
  color: #FFFFFF;
  border-color: var(--voh-red);
}
.loc-desc {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--voh-text-2);
  line-height: 1.5;
  font-style: italic;
}

/* ── SLIDERS ───────────────────────────────────────────────── */
.slider { margin-bottom: 16px; }
.slider:last-child { margin-bottom: 0; }
.slider-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 4px;
}
.slider .val { color: var(--voh-text-2); font-size: 0.82rem; font-weight: 500; }
.slider .val b {
  color: var(--voh-red);
  font-weight: 700;
  font-size: 1rem;
  margin-right: 2px;
}
.hint {
  font-size: 0.74rem;
  color: var(--voh-text-3);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── WEATHER BUTTONS ───────────────────────────────────────── */
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 8px;
}
.weather-btn {
  background: var(--voh-bg);
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-card);
  padding: 9px 6px;
  cursor: pointer;
  color: var(--voh-text-2);
  font-family: inherit;
  font-size: 0.76rem;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: all 0.15s;
  font-weight: 500;
}
.weather-btn .wi { font-size: 1.3rem; }
.weather-btn:hover { color: var(--voh-red); border-color: var(--voh-red); }
.weather-btn.active {
  background: var(--voh-red);
  color: #FFFFFF;
  border-color: var(--voh-red);
}

/* ── RISK BLOCKS (chemical / mechanical / biological) ─────── */
.risk-block { margin-bottom: 16px; }
.risk-block:last-child { margin-bottom: 0; }
.risk-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.risk-name {
  font-size: 0.86rem;
  color: var(--voh-text);
  font-weight: 600;
  line-height: 1.35;
}
.risk-name small {
  color: var(--voh-text-3);
  font-weight: 400;
  font-size: 0.75rem;
  font-style: italic;
}
.risk-level {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}
.risk-level.lvl-0 { color: var(--voh-good); border-color: var(--voh-good); background: rgba(91,138,74,0.10); }
.risk-level.lvl-1 { color: #B8870F;        border-color: #B8870F;        background: rgba(184,135,15,0.10); }
.risk-level.lvl-2 { color: var(--voh-warn); border-color: var(--voh-warn); background: rgba(198,138,42,0.10); }
.risk-level.lvl-3 { color: var(--voh-bad);  border-color: var(--voh-bad);  background: rgba(196,69,54,0.10); }

/* Horizontal gauge bar */
.risk-gauge {
  position: relative;
  height: 12px;
  background: var(--voh-bg-soft);
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 4px;
}
.risk-gauge-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--voh-good);
  transition: width 0.45s ease, background-color 0.45s ease;
}
.risk-gauge-ticks {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  pointer-events: none;
}
.risk-gauge-ticks span {
  border-right: 1px solid rgba(255,255,255,0.65);
}
.risk-gauge-ticks span:last-child { border-right: 0; }

/* Segmented control for structural sub-indicators */
.seg-list {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.seg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
.seg-label {
  font-size: 0.82rem;
  color: var(--voh-text-2);
  font-weight: 500;
}
.seg-control {
  display: inline-flex;
  border: 1px solid var(--voh-border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--voh-bg);
}
.seg-control button {
  background: transparent;
  border: 0;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--voh-text-3);
  cursor: default;
  border-right: 1px solid var(--voh-border);
  white-space: nowrap;
}
.seg-control button:last-child { border-right: 0; }
.seg-control button.on.sev-0 { background: var(--voh-good); color: #FFFFFF; }
.seg-control button.on.sev-1 { background: #B8870F;        color: #FFFFFF; }
.seg-control button.on.sev-2 { background: var(--voh-warn); color: #FFFFFF; }
.seg-control button.on.sev-3 { background: var(--voh-bad);  color: #FFFFFF; }
@media (max-width: 500px) {
  .seg-row { grid-template-columns: 1fr; }
  .seg-control { justify-self: stretch; display: grid; grid-template-columns: repeat(4, 1fr); }
  .seg-control button { padding: 6px 4px; }
}

/* ── MANUSCRIPT CARD GRID (Manoscritti page) ───────────────── */
.ms-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.ms-card {
  background: var(--voh-bg);
  border: 2px solid var(--voh-border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: grid;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s;
  box-shadow: var(--shadow-card);
}
.ms-card:hover {
  border-color: var(--voh-red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-h);
}
.ms-card.on {
  border-color: var(--voh-red);
  background: linear-gradient(180deg, rgba(168,37,62,0.06), rgba(168,37,62,0.02));
}
.ms-card-id {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--voh-red);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--voh-border-soft);
  padding-bottom: 8px;
  margin-bottom: 2px;
}
.ms-card-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: baseline;
}
.ms-card-k {
  font-size: 0.66rem;
  color: var(--voh-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.ms-card-v {
  font-size: 0.86rem;
  color: var(--voh-text);
  font-weight: 500;
  text-align: right;
}

/* Card meta in card-head */
.card-meta {
  font-size: 0.78rem;
  color: var(--voh-text-3);
  font-style: italic;
}

/* ── KPI STRIP (Manoscritti page simulation card) ──────────── */
.sim-card .card-body { padding: 18px 22px 6px; }
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-strip .kpi {
  background: var(--voh-bg-soft);
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  box-shadow: none;
}

/* When .timeline lives inside a .card-body it must drop its own padding */
.card-body > .timeline {
  padding: 14px 0 0;
  margin-top: 6px;
}

.single-col {
  grid-template-columns: 1fr;
}

/* ── SIMULATOR PAGE: Hypothetical manuscript note ──────────── */
.hypothetical-note {
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(168,37,62,0.07), rgba(168,37,62,0.02));
  border: 1px solid var(--voh-red-light);
  border-left: 3px solid var(--voh-red);
  border-radius: var(--radius-card);
  font-size: 0.85rem;
  color: var(--voh-text-2);
  line-height: 1.55;
}
.hypothetical-note strong { color: var(--voh-red); }

/* ── REAL TIME MONITORING ──────────────────────────────────── */
.mon-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
}
@media (max-width: 800px) {
  .mon-banner { grid-template-columns: 1fr; }
}
.mon-banner-left {
  display: flex;
  align-items: center;
  gap: 20px;
}
.mon-banner-left h2 { margin: 0; }
.mon-live {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--voh-red);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #FFFFFF;
  animation: live-pulse 1.4s infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.7); }
}
.mon-banner-right { text-align: right; }
.mon-status {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  border: 2px solid;
  margin-bottom: 8px;
}
.mon-status.status-ok   { color: var(--voh-good); border-color: var(--voh-good); background: rgba(91,138,74,0.08); }
.mon-status.status-warn { color: var(--voh-warn); border-color: var(--voh-warn); background: rgba(198,138,42,0.08); }
.mon-status.status-bad  { color: var(--voh-bad);  border-color: var(--voh-bad);  background: rgba(196,69,54,0.08); animation: status-blink 1.5s infinite; }
@keyframes status-blink {
  0%, 100% { background: rgba(196,69,54,0.08); }
  50%      { background: rgba(196,69,54,0.20); }
}
.mon-meta {
  font-size: 0.78rem;
  color: var(--voh-text-3);
}
.mon-meta b { color: var(--voh-text-2); font-weight: 600; }

/* Monitoring config row */
.mon-config {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}
@media (max-width: 750px) {
  .mon-config { grid-template-columns: 1fr; }
}
.mon-action { display: flex; justify-content: flex-end; }

/* Sensor grid */
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.sensor-card {
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  padding: 14px;
  background: var(--voh-bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sensor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sensor-label {
  font-size: 0.76rem;
  color: var(--voh-text-2);
  font-weight: 600;
  line-height: 1.3;
}
.sensor-status {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid;
  white-space: nowrap;
}
.sensor-status.status-ok   { color: var(--voh-good); border-color: var(--voh-good); background: rgba(91,138,74,0.08); }
.sensor-status.status-warn { color: var(--voh-warn); border-color: var(--voh-warn); background: rgba(198,138,42,0.08); }
.sensor-status.status-bad  { color: var(--voh-bad);  border-color: var(--voh-bad);  background: rgba(196,69,54,0.08); }
.sensor-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--voh-text);
  line-height: 1;
}
.sensor-value small {
  font-size: 0.72rem;
  color: var(--voh-text-3);
  font-weight: 400;
  margin-left: 4px;
}
.sensor-bar {
  height: 6px;
  background: var(--voh-bg-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.sensor-bar-fill {
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  transition: width 0.4s ease, background-color 0.3s ease;
}
.bar-ok   { background: var(--voh-good); }
.bar-warn { background: var(--voh-warn); }
.bar-bad  { background: var(--voh-bad); }
.sensor-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--voh-text-3);
}
.trend-arrow {
  font-weight: 700;
  font-size: 0.85rem;
}
.trend-up   { color: var(--voh-bad); }
.trend-down { color: var(--voh-good); }
.trend-flat { color: var(--voh-text-3); }
.trend-delta { font-family: 'Inter', monospace; font-weight: 600; }

/* Monitoring grid (rate + chart + alerts) */
.mon-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1.5fr;
  gap: 22px;
}
@media (max-width: 1100px) { .mon-grid { grid-template-columns: 1fr; } }

.deg-rate-big {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--voh-red);
  line-height: 1;
}
.deg-rate-big small {
  font-size: 0.85rem;
  color: var(--voh-text-3);
  margin-left: 6px;
  font-weight: 500;
}
#liveChart {
  display: block;
  width: 100%;
  height: 200px;
  background: var(--voh-bg-soft);
  border-radius: var(--radius-card);
}

/* Alert list */
.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.alert-list li {
  padding: 10px 12px;
  border-radius: var(--radius-card);
  border-left: 3px solid var(--voh-border);
  background: var(--voh-bg-soft);
  font-size: 0.82rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}
.alert-list li.alert-warn { border-left-color: var(--voh-warn); }
.alert-list li.alert-bad  { border-left-color: var(--voh-bad); background: rgba(196,69,54,0.06); }
.alert-list li.alert-ok   { border-left-color: var(--voh-good); color: var(--voh-text-3); font-style: italic; }
.alert-time {
  font-family: 'Inter', monospace;
  font-weight: 600;
  color: var(--voh-text-3);
  font-size: 0.74rem;
}
.alert-msg { color: var(--voh-text-2); }

/* ── PREDICTION LIST ───────────────────────────────────────── */
.prediction { background: var(--voh-bg-soft); }
.pred-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.pred-list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--voh-bg);
  border: 1px solid var(--voh-border-soft);
  font-size: 0.86rem;
  color: var(--voh-text-2);
  line-height: 1.5;
  border-left: 3px solid var(--voh-border);
}
.pred-list li .ico {
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.pred-list li.good { border-left-color: var(--voh-good); }
.pred-list li.good .ico { background: rgba(91,138,74,0.15); color: var(--voh-good); }
.pred-list li.warn { border-left-color: var(--voh-warn); }
.pred-list li.warn .ico { background: rgba(198,138,42,0.15); color: var(--voh-warn); }
.pred-list li.bad  { border-left-color: var(--voh-bad); }
.pred-list li.bad  .ico { background: rgba(196,69,54,0.15); color: var(--voh-bad); }
.pred-list li b { color: var(--voh-text); font-weight: 600; }

/* ── FULL-WIDTH BOTTOM SECTIONS ───────────────────────────── */
.full-section {
  padding: 0 40px 30px;
  max-width: 1500px;
  margin: 0 auto;
}
.full-section .card { margin-bottom: 22px; }
.section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 1050px) { .section-grid { grid-template-columns: 1fr; } }

.card-body { padding: 18px 22px; }

#degradation-chart {
  display: block;
  width: 100%;
  background: var(--voh-bg-soft);
  border-radius: var(--radius-card);
}

/* ── THRESHOLDS ───────────────────────────────────────────── */
.threshold-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--voh-bg);
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  padding: 11px 16px;
  margin-bottom: 8px;
}
.threshold-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.threshold-label {
  flex: 1;
  font-size: 0.86rem;
  color: var(--voh-text-2);
  font-weight: 500;
}
.threshold-years {
  font-size: 1.02rem;
  font-weight: 700;
  text-align: right;
  min-width: 80px;
}

/* ── REFERENCE TABLE ─────────────────────────────────────── */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ref-table thead tr { border-bottom: 2px solid var(--voh-red); }
.ref-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--voh-text);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ref-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--voh-border-soft);
  color: var(--voh-text-2);
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table td:first-child { color: var(--voh-text); font-weight: 600; }
.ref-table .star { color: var(--voh-red); letter-spacing: 1px; }

/* ── BRAND STRIP (centered big logo above footer) ─────────── */
.brand-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 24px 28px;
  border-top: 2px solid var(--voh-red);
  background: linear-gradient(180deg, var(--voh-bg) 0%, var(--voh-bg-soft) 100%);
  text-align: center;
}
.brand-strip img {
  height: 140px;
  width: auto;
  display: block;
  margin-bottom: 14px;
}
.brand-strip-tag {
  margin: 0;
  font-size: 0.95rem;
  color: var(--voh-text-2);
  font-style: italic;
  max-width: 600px;
}
@media (max-width: 650px) {
  .brand-strip img { height: 90px; }
  .brand-strip { padding: 26px 16px 20px; }
}

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  background: var(--voh-red);
  color: #FFFFFF;
  margin-top: 0;
  padding: 36px 40px 28px;
  position: relative;
  overflow: hidden;
}
.site-footer::before, .site-footer::after {
  content: '';
  position: absolute;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}
.site-footer::before {
  width: 320px; height: 320px;
  right: -100px; bottom: -100px;
}
.site-footer::after {
  width: 220px; height: 220px;
  right: -60px; bottom: -60px;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 30px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
  position: relative;
  z-index: 1;
}
@media (max-width: 750px) {
  .footer-content { grid-template-columns: 1fr; text-align: center; }
}
.footer-brand img {
  height: 110px;
  width: auto;
  filter: brightness(0) invert(1);
}
.footer-brand p {
  margin-top: 14px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.footer-legal h4 {
  font-size: 1rem;
  margin: 0 0 10px;
  color: #FFFFFF;
  font-weight: 600;
}
.footer-legal a {
  color: #FFFFFF;
  text-decoration: underline;
  font-size: 0.85rem;
  display: block;
  margin-bottom: 6px;
}
.footer-legal a:hover { color: var(--voh-red-light); }
.footer-meta {
  font-size: 0.78rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  font-style: italic;
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--voh-bg-soft); }
::-webkit-scrollbar-thumb { background: var(--voh-border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--voh-red-light); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 650px) {
  .site-header { padding: 12px 18px; }
  .site-logo img { height: 38px; }
  .nav-link { padding: 6px 12px; font-size: 0.85rem; }
  .page-title-row { padding: 20px 18px 6px; }
  .page-divider { margin: 6px 18px 0; }
  .layout { padding: 18px; }
  .full-section { padding: 0 18px 22px; }
  .site-footer { padding: 28px 20px 22px; }
  .overlay { grid-template-columns: 1fr 1fr; }
  .overlay .kpi:last-child { grid-column: span 2; }
  h2 { font-size: 1.3rem; }
}

/* ════════════════════════════════════════════════════════════════════════
   Additions: enriched manuscript cards, detailed thresholds, wear curve,
   section intro text
   ════════════════════════════════════════════════════════════════════════ */

/* Explanatory intro paragraph */
.section-intro {
  font-size: 0.88rem;
  color: var(--voh-text-2);
  line-height: 1.6;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--voh-bg-soft);
  border-left: 3px solid var(--voh-red);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
}
.section-intro strong { color: var(--voh-text); }

/* ── Enriched manuscript catalog cards ── */
.ms-card-sub {
  font-size: 0.82rem;
  color: var(--voh-text-3);
  font-style: italic;
  margin-top: -4px;
  margin-bottom: 4px;
}
.ms-card-rows {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--voh-border-soft);
  border-bottom: 1px solid var(--voh-border-soft);
}
.ms-card-note {
  font-size: 0.8rem;
  color: var(--voh-text-2);
  line-height: 1.5;
  font-style: italic;
}
.ms-card-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--voh-red);
  margin-top: 2px;
}
.ms-card.on .ms-card-cta { text-decoration: underline; }

/* ── Detailed degradation thresholds ── */
.threshold-block {
  border: 1px solid var(--voh-border-soft);
  border-left: 4px solid var(--lvl, var(--voh-border));
  border-radius: var(--radius-card);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--voh-bg);
}
.threshold-block.reached {
  background: var(--voh-bg-soft);
}
.threshold-block:last-child { margin-bottom: 0; }
.threshold-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.threshold-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--voh-text);
  flex: 1;
}
.threshold-pct {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--voh-text-3);
  margin-left: 4px;
}
.threshold-years {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}
.threshold-block.reached .threshold-years {
  color: var(--voh-text-3) !important;
  font-style: italic;
}
.threshold-detail {
  display: grid;
  gap: 8px;
}
.threshold-detail p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--voh-text-2);
}
.td-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-right: 6px;
  vertical-align: middle;
}
.td-mean { background: rgba(91,138,74,0.12);  color: var(--voh-good); }
.td-act  { background: rgba(168,37,62,0.10);  color: var(--voh-red); }

/* ── Wear curve (monitoring) ── */
.wear-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 800px) {
  .wear-layout { grid-template-columns: 1fr; }
}
.wear-info {
  background: var(--voh-bg-soft);
  border: 1px solid var(--voh-border-soft);
  border-radius: var(--radius-card);
  padding: 16px;
}
.wi-big {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}
.wi-big small {
  font-size: 0.72rem;
  color: var(--voh-text-3);
  font-weight: 500;
  margin-left: 6px;
}
.wi-state {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 6px 0 12px;
}
.wi-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.wi-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--voh-border-soft);
}
.wi-list li:last-child { border-bottom: none; }
.wi-list li span { color: var(--voh-text-3); }
.wi-list li b { color: var(--voh-text); font-weight: 600; text-align: right; }
#wearChart {
  display: block;
  width: 100%;
  height: 260px;
  background: var(--voh-bg-soft);
  border-radius: var(--radius-card);
}
