/* The Roman Hideout — foglio di stile unico (sito pubblico + admin) */
:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --ink: #2a1a0c;
  --muted: #6e5a46;
  --line: #e5d9c6;
  --brand: #5a2d0c;       /* marrone del vecchio sito, più profondo */
  --brand-ink: #fdf3e2;
  --accent: #a3361f;      /* rosso pompeiano */
  --gold: #c9962b;
  --ok: #2f6b3a;
  --err: #a3271f;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b140e; --surface: #241b13; --ink: #f1e7d8; --muted: #b9a68f; --line: #3b2e22;
    --brand: #2c1708; --brand-ink: #f6e7cf; --accent: #e07a5f; --gold: #d9ab4a;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; }
h3 a, h2 a { color: inherit; text-decoration: none; }
h3 a:hover, h2 a:hover { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }
.small { font-size: .85em; }

/* Header */
.site-header { background: var(--brand); color: var(--brand-ink); border-bottom: 4px solid var(--gold); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { font-family: var(--serif); font-weight: 700; letter-spacing: .12em; font-size: 13px; border: 2px solid var(--gold); color: var(--gold); padding: 6px 8px; border-radius: 4px; }
.brand-text strong { display: block; font-family: var(--serif); font-size: 22px; }
.brand-text small { opacity: .8; font-size: 13px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--brand-ink); text-decoration: none; padding: 8px 12px; border-radius: 6px; font-size: 15px; }
.nav a:hover { background: rgba(255,255,255,.1); }
.nav a[aria-current="page"] { background: rgba(255,255,255,.16); box-shadow: inset 0 -2px 0 var(--gold); }
.nav-toggle { display: none; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: 6px 12px; font: inherit; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; }
  .nav-open .nav { display: flex; }
}

main { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }

/* Intro e titoli */
.intro { padding: 8px 0 20px; max-width: 720px; }
.intro h1 { font-size: clamp(28px, 4vw, 40px); }
.intro p, .lede { color: var(--muted); font-size: 1.08em; }
.section-title { font-size: 15px; font-family: var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 8px; margin: 32px 0 20px; }
.page-title { font-size: clamp(28px, 4vw, 38px); }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.meta a { color: inherit; }

/* Notizie */
.news-lead { display: grid; grid-template-columns: 1fr; gap: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.news-lead .news-img img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4/3; }
.news-lead .news-body { padding: 24px; align-self: center; }
.news-lead:has(.news-img) { grid-template-columns: 1.3fr 1fr; }
.news-lead:has(.news-img) .news-body { padding-left: 0; }
.news-lead h3 { font-size: clamp(24px, 3vw, 32px); }
@media (max-width: 760px) {
  .news-lead, .news-lead:has(.news-img) { grid-template-columns: 1fr; }
  .news-lead .news-body, .news-lead:has(.news-img) .news-body { padding: 0 20px 20px; }
}
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 20px; }
.news-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding-bottom: 12px; }
.news-card > :first-child:not(.news-img) { margin-top: 16px; }
.news-card .news-img img { width: 100%; aspect-ratio: 3/2; object-fit: cover; margin-bottom: 12px; }
.news-card > :not(.news-img) { padding: 0 16px; }
.news-card h3 { font-size: 20px; }
.news-card p:last-child { margin: 0; color: var(--muted); font-size: 15px; }
.more { margin-top: 24px; }

.news-list { display: grid; gap: 16px; }
.news-row { display: grid; grid-template-columns: 180px 1fr; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.news-row .news-img img { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: 6px; }
.news-row h2 { font-size: 22px; }
.news-row p:last-child { margin: 0; color: var(--muted); }
@media (max-width: 560px) { .news-row { grid-template-columns: 1fr; } }

.article { max-width: 760px; }
.article h1 { font-size: clamp(30px, 4.5vw, 44px); }
.article figure { margin: 24px 0; }
.article figure img { border-radius: var(--radius); width: 100%; }
.prose p { margin: 0 0 1em; }
.source { color: var(--muted); font-size: 15px; border-top: 1px solid var(--line); padding-top: 12px; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }

/* Directory link */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.cat-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); padding: 18px; }
.cat-card:hover { border-color: var(--accent); }
.cat-card p { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.count { font-size: 13px; color: var(--accent); font-weight: 600; }
.country-index { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.country-index a { background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; font-size: 14px; text-decoration: none; }
.link-group h2 { font-size: 22px; margin-top: 28px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.link-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.link-list li > a, .link-head > a:first-child { font-weight: 600; }
.link-list p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.kind { font-size: 12px; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--line); color: var(--muted); vertical-align: 1px; }

.empty { padding: 40px 0; color: var(--muted); }
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 9px 18px; border-radius: 6px; text-decoration: none; font-weight: 600; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-danger { background: var(--err); }
.btn-sm { padding: 5px 12px; font-size: 14px; }

/* Filtri e dettagli della directory */
.link-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 20px 0 8px; }
.link-filters input[type=search], .link-filters select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 15px; background: var(--bg); color: var(--ink); }
.link-filters input[type=search] { flex: 1 1 220px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; cursor: pointer; user-select: none; }
.chip:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input { margin: 0; accent-color: var(--accent); }
.f-count { margin-left: auto; }
.link-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.country { display: inline-block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin-right: 6px; }
.tags { margin: 6px 0 0 !important; display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; margin: 2px 4px 0 0; font-size: 12px; padding: 0 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.award { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; text-decoration: none; }
.award-gold { background: #f6e3a8; color: #6b4b00; }
.award-platinum { background: #e2e4e8; color: #3a3f47; }
.suggest { margin-top: 32px; }
[hidden] { display: none !important; }

/* Footer */
.site-footer { background: var(--brand); color: var(--brand-ink); border-top: 4px solid var(--gold); padding: 24px 0; font-size: 15px; }
.site-footer a { color: var(--gold); }
.footer-inner p { margin: 0 0 6px; }

/* ---------- Area admin ---------- */
.admin-bar { background: #1f150d; color: #f1e7d8; }
.admin-bar .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.admin-bar a { color: #f1e7d8; text-decoration: none; margin-right: 14px; }
.admin-bar a[aria-current="page"] { color: var(--gold); }
.admin-bar strong { font-family: var(--serif); margin-right: 18px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash-ok { background: #e3f1e4; color: var(--ok); }
.flash-err { background: #f8e1de; color: var(--err); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form { display: flex; gap: 8px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data td.actions { white-space: nowrap; }
table.data td.actions form { display: inline; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.badge-published { background: #e3f1e4; color: var(--ok); }
.badge-draft { background: var(--line); color: var(--muted); }
.badge-scheduled { background: #fbefd2; color: #8a5d00; }
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 820px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 3px; }
.field input[type=text], .field input[type=url], .field input[type=email], .field input[type=password],
.field input[type=datetime-local], .field input[type=number], .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--bg); color: var(--ink);
}
.field textarea { min-height: 240px; resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }
.preview-img { max-width: 240px; border-radius: 6px; margin: 6px 0; }
.login-box { max-width: 380px; margin: 40px auto; }
.errors { background: #f8e1de; color: var(--err); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.errors ul { margin: 0; padding-left: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 28px; font-family: var(--serif); }
.stat span { color: var(--muted); font-size: 14px; }
.badge-broken { background: #f8e1de; color: var(--err); }
