/* Malta Debt Clock · stile "Platino" (grafite, platino, dettagli champagne) */

:root {
  --bg: #0E0F11;
  --panel: #15171A;
  --panel-2: #111214;
  --line: #2A2D33;
  --line-soft: #1F2125;
  --line-strong: #3A3D43;
  --text: #ECEEF1;
  --text-soft: #C9CDD3;
  --muted: #9AA0A8;
  --sep: #7C828B;
  --gold: #C9A96E;
  --up: #5BE39A;
  --down: #FF7B7B;
  --flat: #9AA0A8;
  --serif: Cinzel, "Trajan Pro", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(900px 420px at 50% -10%, rgba(232, 234, 237, 0.07), transparent 60%) no-repeat, var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.45;
}

a { color: var(--gold); }
a:hover { color: #E3CC9C; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: 1360px; margin: 0 auto; padding-inline: clamp(16px, 3vw, 40px); }

.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 { position: absolute; left: -9999px; top: 12px; z-index: 10; padding: 8px 14px; border-radius: 6px; background: var(--gold); color: var(--bg); font-weight: 700; text-decoration: none; }
.skip:focus { left: 12px; }

/* ---------- Testata ---------- */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 18px; }

.brand { display: flex; align-items: center; gap: 12px; color: #D5D9DE; text-decoration: none; }
.brand:hover { color: #FFFFFF; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-name { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.16em; line-height: 1.1; color: var(--text); text-transform: uppercase; }
.brand-sub { font-size: 10px; font-weight: 600; letter-spacing: 0.24em; color: var(--muted); text-transform: uppercase; }

.live { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 11px; font-weight: 600; letter-spacing: 0.22em; color: var(--muted); text-transform: uppercase; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; color: var(--up); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--up); animation: pulse 2s ease-in-out infinite; }
.clock { color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 0.12em; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Tessere ---------- */
.tiles { display: flex; flex-wrap: nowrap; align-items: center; gap: 0.07em; min-height: 1.22em; line-height: 1; font-weight: 500; }

.tile {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 0.78em; height: 1.22em;
  border-radius: 0.08em;
  background: linear-gradient(#3A3D43, #272A2F 50%, #1E2024 50%, #141518);
  border: 1px solid rgba(232, 234, 237, 0.16);
  color: #F2F3F5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0.08em 0.2em rgba(0, 0, 0, 0.4);
  font-variant-numeric: tabular-nums;
  perspective: 3em;
  transition: border-color 0.2s;
}
.tile::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.7); pointer-events: none; }
.tile .d { display: inline-block; backface-visibility: hidden; }
.sep { display: inline-block; width: 0.28em; text-align: center; color: var(--sep); }

/* ---------- Variazioni % ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; border: 1px solid;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.5;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.chip svg { width: 8px; height: 8px; flex: none; }
.chip.up { color: var(--up); border-color: rgba(91, 227, 154, 0.5); background: rgba(91, 227, 154, 0.08); }
.chip.down { color: var(--down); border-color: rgba(255, 123, 123, 0.5); background: rgba(255, 123, 123, 0.08); }
.chip.flat { color: var(--flat); border-color: rgba(154, 160, 168, 0.5); background: rgba(154, 160, 168, 0.08); }

/* ---------- Debito pubblico ---------- */
.hero {
  margin-top: 28px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 16px;
  padding: clamp(24px, 4vw, 52px) clamp(14px, 3vw, 40px);
  border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(201, 169, 110, 0.07), transparent 65%);
}
.kicker { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.32em; color: var(--gold); text-transform: uppercase; }
.hero h1 { margin: 0; font-family: var(--serif); font-size: clamp(30px, 4.6vw, 60px); font-weight: 600; letter-spacing: 0.06em; line-height: 1.05; }

.hero-num { max-width: 100%; margin-top: 6px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.hero-num .tiles { font-size: clamp(22px, 5.2vw, 76px); }
.hero-num:hover .tile { border-color: rgba(232, 234, 237, 0.32); }

.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); }
.hero-meta .chip { font-size: 12px; padding: 2px 10px; }
.hero-meta .mi { display: inline-flex; align-items: center; gap: 12px; }
.hero-meta .mi::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #5A5F68; }
.hint { margin: 0; font-size: 11px; font-weight: 500; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }

/* ---------- Intestazioni delle sezioni ---------- */
.sec-h { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; color: var(--gold); }
.sec-h h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: 0.12em; line-height: 1.1; color: var(--text); }
.sec-h svg { flex: none; }

/* ---------- Striscia "Public finances" ---------- */
.strip { margin-top: 40px; min-height: 180px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 20px 28px; margin-top: 6px; }

.kpi {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  width: 100%; padding: 18px 0 4px;
  border: 0; border-top: 1px solid var(--line); background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.kpi::before { content: ""; position: absolute; top: -1px; left: 0; width: 28px; height: 2px; background: var(--gold); }
.kpi .tiles { font-size: 28px; }
.kpi:hover .tile { border-color: rgba(232, 234, 237, 0.32); }

/* ---------- Sezioni ---------- */
.board { margin-top: 44px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(540px, 100%), 1fr)); align-items: start; gap: 40px 48px; }
.col { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
.sec { padding-top: 18px; border-top: 1px solid var(--line-strong); }

.row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  width: 100%; padding: 16px 0;
  border: 0; border-top: 1px solid var(--line-soft); background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.row .tiles { font-size: 22px; }
.row:hover .label, .kpi:hover .label { color: #FFFFFF; }
.row:hover .tile { border-color: rgba(232, 234, 237, 0.32); }

.row-l { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; transition: color 0.2s; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.sub { font-size: 11px; font-weight: 500; letter-spacing: 0.1em; color: var(--muted); }

/* ---------- Testi per Google e per chi legge ---------- */
.noscript { margin: 32px 0 0; color: var(--text-soft); }
.about { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line-strong); }
.about > h2 { margin: 0 0 24px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.1em; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 28px 48px; }
.about h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.18em; color: var(--gold); text-transform: uppercase; }
.about p { margin: 0; max-width: 62ch; color: var(--text-soft); font-size: 15px; line-height: 1.65; }

/* ---------- Piè di pagina ---------- */
.foot { margin-top: 64px; border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 18px 28px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }

/* ---------- Scheda di dettaglio ---------- */
dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
dialog::backdrop { background: rgba(5, 6, 7, 0.8); }
.d-in { padding: clamp(18px, 3vw, 28px); }
.d-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.d-group { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.24em; color: var(--gold); text-transform: uppercase; }
.d-title { margin: 6px 0 0; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.08em; line-height: 1.2; }
.d-close { flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; }
.d-close:hover { border-color: var(--muted); }

.d-value { margin-top: 18px; flex-wrap: wrap; row-gap: 0.12em; font-size: clamp(22px, 6vw, 40px); }

.d-facts { margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.d-facts > div { padding: 12px 14px; background: var(--panel-2); }
.d-facts > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.d-facts dt { font-size: 10px; font-weight: 600; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.d-facts dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.d-hist { margin-top: 20px; }
.d-hist-title { margin: 0 0 10px; font-size: 10px; font-weight: 600; letter-spacing: 0.18em; color: var(--muted); text-transform: uppercase; }
.d-bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-l { color: var(--text-soft); }
.bar { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--line-soft); }
.bar > span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: #5A5F68; }
.bar-row.now .bar > span { background: var(--gold); }

.d-notes { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.55; color: var(--text-soft); }
.d-notes p { margin: 0 0 6px; }
.d-notes strong { margin-right: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--gold); text-transform: uppercase; }

/* ---------- Telefono ---------- */
@media (max-width: 420px) {
  .brand-name { font-size: 19px; letter-spacing: 0.12em; }
  .row .tiles { font-size: 20px; }
  .kpi .tiles { font-size: 26px; }
}

/* ---------- Meno movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .live-dot::before { animation: none; }
  .tile, .label { transition: none; }
}
