/* Martocci Heritage design system.
   Palette from the arms of the Region of Basilicata (no Martocci arms exist): azure waves on silver, a sea-blue banner with
   gold lettering, and the Italian tricolor ribbon. Display type: Cormorant Garamond. Text: Inter. Both SIL OFL, self-hosted. */

@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant-garamond-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Cormorant Garamond'; src: url('/fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --azure-950: #071A33;
  --azure-900: #0A2342;
  --azure-800: #0B3266;
  --azure-700: #004C97; /* Pantone 2945, the region's blue */
  --azure-600: #1A5BA8;
  --azure-400: #5B8FD0;
  --azure-200: #BFD3EE;
  --azure-100: #E4EDF8;
  --argent: #F5F3EE;
  --argent-2: #ECE8DF;
  --silver: #C7CDD6;
  --oro: #C9A227;
  --oro-deep: #8F6E12;
  --oro-soft: #F3E7BF;
  --verde: #00814A;
  --rosso: #C42A35;

  --bg: var(--argent);
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F8F6F1;
  --line: #E1DCD1;
  --line-strong: #CFC7B8;
  --ink: #16202D;
  --ink-2: #3C4756;
  --ink-3: #66707E;
  --accent: var(--azure-700);
  --accent-ink: #FFFFFF;
  --gold-text: var(--oro-deep);
  --ok: var(--verde);
  --warn: #B26B00;
  --bad: var(--rosso);
  --focus: #2E7CF6;
  --shadow-1: 0 1px 2px rgba(10, 35, 66, .06), 0 1px 1px rgba(10, 35, 66, .04);
  --shadow-2: 0 6px 24px rgba(10, 35, 66, .10), 0 2px 6px rgba(10, 35, 66, .06);
  --shadow-3: 0 18px 48px rgba(7, 26, 51, .22);
  --radius: 14px;
  --radius-sm: 9px;
  --display: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --text: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08121F; --bg-2: #0B1828; --surface: #0F1F33; --surface-2: #132740; --line: #1E3350; --line-strong: #2A4466;
    --ink: #E9EEF5; --ink-2: #BFC9D6; --ink-3: #8D9AAD; --accent: #5B8FD0; --accent-ink: #06121F; --gold-text: #E2C35B;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 8px 28px rgba(0, 0, 0, .45); --warn: #E2A23B; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08121F; --bg-2: #0B1828; --surface: #0F1F33; --surface-2: #132740; --line: #1E3350; --line-strong: #2A4466;
  --ink: #E9EEF5; --ink-2: #BFC9D6; --ink-3: #8D9AAD; --accent: #5B8FD0; --accent-ink: #06121F; --gold-text: #E2C35B;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 8px 28px rgba(0, 0, 0, .45); --warn: #E2A23B; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.1; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.55rem; }
h4 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--ink-3); }
.eyebrow { font: 600 .75rem/1 var(--text); letter-spacing: .16em; text-transform: uppercase; color: var(--gold-text); margin-bottom: 14px; display: inline-flex; align-items: center; gap: 10px; }
.eyebrow::before { content: ''; width: 28px; height: 2px; background: currentColor; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent; font: 600 .95rem/1 var(--text); text-decoration: none; cursor: pointer; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-1); }
.btn-gold { background: linear-gradient(135deg, #E6C766, var(--oro) 55%, #A8841A); color: #1C1405; box-shadow: 0 4px 14px rgba(201, 162, 39, .35); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-light { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-light:hover { background: rgba(255, 255, 255, .18); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .85rem; }
.btn-danger { background: var(--bad); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: 600 .75rem/1.4 var(--text); background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip-gold { background: var(--oro-soft); color: #5C4508; border-color: #E7D395; }
.chip-azure { background: var(--azure-100); color: var(--azure-800); border-color: var(--azure-200); }
.chip-ok { background: #E3F4EA; color: #0B5B35; border-color: #BFE3CD; }
.chip-warn { background: #FBEFD9; color: #7A4A00; border-color: #F0D59F; }
.chip-bad { background: #FBE3E4; color: #8A1C24; border-color: #F2BEC2; }
:root[data-theme="dark"] .chip-gold, :root[data-theme="dark"] .chip-azure, :root[data-theme="dark"] .chip-ok, :root[data-theme="dark"] .chip-warn, :root[data-theme="dark"] .chip-bad { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-strong); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-gold, :root:not([data-theme="light"]) .chip-azure, :root:not([data-theme="light"]) .chip-ok, :root:not([data-theme="light"]) .chip-warn, :root:not([data-theme="light"]) .chip-bad { background: var(--surface-2); color: var(--ink-2); border-color: var(--line-strong); } }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 22px; }
.card h3 { margin-bottom: .35em; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

/* Site header */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; font: 700 1.45rem/1 var(--display); letter-spacing: .01em; }
.brand small { display: block; font: 600 .62rem/1.4 var(--text); letter-spacing: .2em; text-transform: uppercase; color: var(--gold-text); margin-top: 3px; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 12px; border-radius: 999px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.theme-toggle, .nav-toggle { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; }
.theme-toggle svg, .nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .site-nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px var(--gutter) 16px; box-shadow: var(--shadow-2); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; font-size: 1.05rem; }
  .nav-toggle { display: grid; }
  .site-header .btn-gold { display: none; }
}

/* Hero */
.hero { position: relative; overflow: hidden; color: #F2F5FA; background: radial-gradient(1200px 600px at 75% -10%, #1C5DAA 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #0B3266 0%, transparent 60%), linear-gradient(160deg, var(--azure-900), var(--azure-950)); }
.hero::after { content: ''; position: absolute; inset: auto 0 0 0; height: 4px; background: linear-gradient(90deg, var(--verde) 0 33.3%, #F4F5F0 33.3% 66.6%, var(--rosso) 66.6%); opacity: .9; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr .75fr; gap: 40px; align-items: center; padding-top: clamp(56px, 9vw, 110px); padding-bottom: clamp(64px, 9vw, 120px); }
.hero h1 { color: #fff; font-weight: 600; }
.hero h1 em { font-style: italic; color: #E6C766; font-weight: 500; }
.hero .lede { font-size: clamp(1.05rem, 2vw, 1.3rem); color: #C9D6E8; max-width: 38em; margin-bottom: 28px; }
.hero .eyebrow { color: #E6C766; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-emblem { justify-self: center; width: min(100%, 340px); filter: drop-shadow(0 24px 60px rgba(0, 0, 0, .45)); animation: float 9s ease-in-out infinite; }
.hero-waves { position: absolute; left: 0; right: 0; bottom: 0; height: 96px; opacity: .1; pointer-events: none; }
@keyframes float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .hero-emblem { animation: none; } html { scroll-behavior: auto; } }
@media (max-width: 860px) { .hero .wrap { grid-template-columns: 1fr; } .hero-emblem { width: 180px; order: -1; justify-self: start; } }

/* Stats strip */
.stats-strip { position: relative; z-index: 2; margin-top: -42px; }
.stats-strip .card { display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px; }
.stat { padding: 16px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font: 600 2.1rem/1 var(--display); color: var(--ink); }
.stat span { display: block; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
@media (max-width: 760px) { .stats-strip .card { grid-template-columns: repeat(2, 1fr); } .stat { border-right: 0; border-bottom: 1px solid var(--line); } .stat:last-child { grid-column: span 2; border-bottom: 0; } }

/* Sections */
.section { padding: clamp(56px, 8vw, 104px) 0; }
.section-alt { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 36px; }
.section-head p { color: var(--ink-2); font-size: 1.1rem; }
.feature { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .2s ease, box-shadow .2s ease, border-color .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.feature .icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--azure-100); color: var(--azure-700); }
:root[data-theme="dark"] .feature .icon { background: var(--surface-2); color: var(--azure-400); }
.feature .icon svg { width: 24px; height: 24px; }
.feature-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--azure-100); color: var(--azure-700); margin-bottom: 12px; }
.feature-icon svg { width: 24px; height: 24px; }
:root[data-theme="dark"] .feature-icon { background: var(--surface-2); color: var(--azure-400); }
.feature p { color: var(--ink-2); margin: 0; }
.feature .more { margin-top: auto; font-weight: 600; color: var(--accent); }

/* Page header */
.page-hero { background: linear-gradient(160deg, var(--azure-900), var(--azure-950)); color: #E8EEF7; position: relative; overflow: hidden; }
.page-hero .wrap { padding-top: clamp(44px, 7vw, 84px); padding-bottom: clamp(44px, 7vw, 84px); position: relative; z-index: 1; }
.page-hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.6rem); }
.page-hero p { color: #C3D1E6; font-size: 1.15rem; max-width: 46em; margin: 0; }
.page-hero .eyebrow { color: #E6C766; }
.page-hero::after { content: ''; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, var(--verde) 0 33.3%, #F4F5F0 33.3% 66.6%, var(--rosso) 66.6%); }

/* Prose and evidence */
.prose { max-width: 760px; }
.prose p, .prose li { color: var(--ink-2); font-size: 1.05rem; }
.prose h2 { margin-top: 1.4em; }
.evidence { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 0; font-size: .82rem; color: var(--ink-3); }
.sources { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; font-size: .85rem; }
.sources a { color: var(--ink-3); }
.callout { border-left: 4px solid var(--oro); background: var(--surface); padding: 18px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; box-shadow: var(--shadow-1); }
.callout strong { color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 .75rem/1.2 var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Timeline (public history page) */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 8px 14px; font: 600 .85rem/1 var(--text); cursor: pointer; min-height: 38px; }
.filter[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.timeline { position: relative; margin: 0; padding: 0 0 0 28px; list-style: none; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--azure-400), var(--oro)); border-radius: 2px; }
.timeline li { position: relative; padding: 0 0 26px 18px; }
.timeline li::before { content: ''; position: absolute; left: -27px; top: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.timeline li[data-scope="emigration"]::before { border-color: var(--oro); }
.timeline li[data-scope="us"]::before { border-color: var(--rosso); }
.timeline li[data-scope="world"]::before { border-color: var(--ink-3); }
.timeline .year { font: 700 1.5rem/1 var(--display); color: var(--gold-text); }
.timeline h3 { font-size: 1.3rem; margin: 4px 0 6px; }
.timeline p { color: var(--ink-2); margin: 0 0 4px; max-width: 60em; }
.timeline li.hidden { display: none; }

/* Map */
.map-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.italy-map { width: 100%; max-width: 460px; margin: 0 auto; }
.italy-map path { fill: var(--azure-100); stroke: var(--surface); stroke-width: 1.2; transition: fill .2s; }
:root[data-theme="dark"] .italy-map path { fill: var(--surface-2); stroke: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .italy-map path { fill: var(--surface-2); stroke: var(--bg); } :root:not([data-theme="light"]) .feature .icon, :root:not([data-theme="light"]) .feature-icon { background: var(--surface-2); color: var(--azure-400); } }
.italy-map path.hl { fill: var(--azure-700); }
.italy-map path.hl2 { fill: var(--azure-400); }
.italy-map path:hover { fill: var(--oro); cursor: pointer; }
.italy-map .pin circle { fill: var(--oro); stroke: #fff; stroke-width: 2; }
.italy-map .pin text { font: 600 13px var(--text); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
@media (max-width: 860px) { .map-card { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { background: var(--azure-950); color: #9FB0C8; padding: 48px 0 32px; margin-top: 0; }
.site-footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.site-footer h4 { color: #E8EEF7; font-size: 1.15rem; }
.site-footer a { color: #C9D6E8; text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: #fff; }
.site-footer .credit { grid-column: 1 / -1; margin: 0; font-size: .9rem; color: #C9D6E8; }
.site-footer .credit a { display: inline; color: var(--oro); font-weight: 600; }
.site-footer .credit a:hover { color: #E6C766; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 20px; font-size: .82rem; color: #7E8FA8; }
@media (max-width: 760px) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* Utilities */
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 400 1rem/1.4 var(--text); }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); outline-offset: 0; }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.wave-divider { height: 28px; width: 100%; color: var(--azure-200); }
.gap-bottom { margin-bottom: 48px; }
.gap-top { margin-top: 56px; }
.name-filter { max-width: 420px; margin-bottom: 16px; }
.gold-link { color: #E6C766; }
.mobile-only { display: none; }
@media (max-width: 860px) { .mobile-only { display: block; } }
