/* =========================================================================
   ARI Cremona — foglio di stile unico
   Restyling moderno: nessun dipendenza esterna, responsive, accessibile.
   ========================================================================= */

:root {
  --blue-950: #081736;
  --blue-900: #0d2352;
  --blue-800: #12306e;
  --blue-700: #1a4396;
  --blue-600: #2557bd;
  --blue-100: #e7edfb;
  --blue-50: #f2f5fd;
  --gold: #f2b705;
  --gold-dark: #c99503;
  --ink: #1b2430;
  --muted: #5d6878;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --line: #e1e6f0;
  --danger: #b3261e;
  --success: #146c43;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(13, 35, 82, .06), 0 8px 24px rgba(13, 35, 82, .07);
  --container: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; height: auto; }

a { color: var(--blue-700); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--blue-900); }

h1, h2, h3, h4 { line-height: 1.25; color: var(--blue-900); margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 1.1rem + .9vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1.1em; }
.text-justify { text-align: justify; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }

.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto;
  clip: auto; padding: 10px 16px; background: var(--gold); color: var(--blue-950);
  font-weight: 700; border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------- bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .65em 1.35em; border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-900); color: #fff; }
.btn-gold { background: var(--gold); color: var(--blue-950); }
.btn-gold:hover { background: var(--gold-dark); color: var(--blue-950); }
.btn-outline { border-color: currentColor; background: transparent; color: inherit; }
.btn-outline:hover { background: rgba(255, 255, 255, .12); }
.btn-light { background: #fff; color: var(--blue-900); border-color: var(--line); }
.btn-light:hover { background: var(--blue-50); color: var(--blue-900); }
.btn-small { padding: .45em 1em; font-size: .85rem; }

/* -------------------------------------------------------------- header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(13, 35, 82, .04);
  position: relative;
  z-index: 30;
}
.header-top { display: flex; align-items: center; gap: 20px; padding-block: 14px; }

.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { height: 74px; width: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: clamp(1rem, .85rem + .7vw, 1.35rem); color: var(--blue-900); }
.brand-text span { font-size: .9rem; color: var(--muted); }
.brand:hover .brand-text strong { color: var(--blue-700); }

.site-search { display: flex; gap: 8px; margin-left: auto; }
.site-search input {
  font: inherit; font-size: .95rem; padding: .55em 1em; width: clamp(140px, 18vw, 240px);
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink);
}
.site-search input:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 1px; background: #fff; }
.site-search button {
  font: inherit; font-size: .9rem; font-weight: 600; padding: .55em 1.1em;
  border: 0; border-radius: 999px; background: var(--blue-800); color: #fff; cursor: pointer;
}
.site-search button:hover { background: var(--blue-950); }

.nav-toggle {
  display: none; align-items: center; gap: 10px; margin-left: auto;
  padding: .5em 1em; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--blue-900); font: inherit; font-weight: 600; cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; content: "";
  position: relative; transition: transform .2s;
}
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

.site-nav { background: var(--blue-800); }
.site-nav .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.menu { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.menu a {
  display: block; padding: .85em .78em; color: #e9eefb; text-decoration: none;
  font-size: .92rem; font-weight: 600; letter-spacing: .01em; border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.menu a:hover { background: var(--blue-700); color: #fff; }
.menu .is-current > a { background: var(--blue-900); border-bottom-color: var(--gold); color: #fff; }
.menu-separator { width: 1px; align-self: stretch; margin: 8px 4px; background: rgba(255, 255, 255, .25); }
.menu-account { display: flex; align-items: center; gap: 12px; color: #cdd8f5; font-size: .9rem; padding-block: 8px; }
.menu-account .btn { color: #fff; white-space: nowrap; flex-shrink: 0; }
/* su schermi larghi la barra resta su una riga sola */
@media (min-width: 1101px) { .menu { flex-wrap: nowrap; } }

/* --------------------------------------------------------------- main */
.site-main { padding-block: 32px 56px; }
.page-head { margin-bottom: 26px; }
.page-head h1 {
  display: inline-block; position: relative; padding-bottom: .25em; margin-bottom: 0;
}
.page-head h1::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 4px;
  background: var(--gold); border-radius: 2px;
}

.card, .prose-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(20px, 3vw, 34px);
}
.prose-block + .prose-block { margin-top: 24px; }

/* ---------------------------------------------------------------- hero */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--blue-950) center/cover no-repeat;
  color: #fff; margin-bottom: 34px; box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(8, 23, 54, .92) 8%, rgba(18, 48, 110, .72) 55%, rgba(18, 48, 110, .35));
}
.hero-sky { background-image: url("../../images/IMG_0533.JPG"); }
.hero-inner { position: relative; padding: clamp(34px, 6vw, 74px) clamp(22px, 5vw, 58px); max-width: 780px; }
.hero h1 { color: #fff; margin-bottom: .35em; }
.hero h1::after { content: ""; display: block; width: 72px; height: 4px; background: var(--gold); border-radius: 2px; margin-top: .5em; }
.hero p { font-size: clamp(1rem, .95rem + .5vw, 1.2rem); color: #dfe7fa; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-callsign {
  display: inline-block; margin-bottom: 14px; padding: .25em .9em; border: 1px solid rgba(242, 183, 5, .7);
  border-radius: 999px; color: var(--gold); font-weight: 700; letter-spacing: .12em; font-size: .85rem;
}

/* --------------------------------------------------------------- card */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid > * { margin: 0; }
.feature-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px;
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(13, 35, 82, .14); color: inherit; }
.feature-card h2 { font-size: 1.15rem; margin: 0; }
.feature-card p { color: var(--muted); margin: 0; font-size: .96rem; }
.feature-card .card-link { margin-top: auto; padding-top: 10px; font-weight: 600; color: var(--blue-700); }
.feature-card .card-icon { font-size: 1.6rem; line-height: 1; }

/* -------------------------------------------------------------- tabella */
.table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .98rem; }
.table caption { caption-side: top; text-align: left; color: var(--muted); padding-bottom: 10px; font-size: .92rem; }
.table th, .table td { padding: .7em .85em; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { background: var(--blue-800); color: #fff; font-size: .88rem; letter-spacing: .04em; text-transform: uppercase; }
.table tbody tr:nth-child(even) { background: var(--blue-50); }
.table tbody tr:hover { background: var(--blue-100); }
.table td p { margin: 0; }
.table-wrapper { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table-wrapper .table { border: 0; }
.table-wrapper .table tbody tr:nth-child(even) { background: var(--blue-50); }

.table-filter { margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-filter input {
  font: inherit; padding: .55em 1em; border: 1px solid var(--line); border-radius: 999px;
  min-width: min(280px, 100%); background: #fff;
}
.table-filter label { color: var(--muted); font-size: .92rem; }

/* --------------------------------------------------------------- forme */
.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 6px; }
.form-row-two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.form label { font-weight: 600; font-size: .95rem; color: var(--blue-900); }
.form .hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
.form .required { color: var(--danger); }
.form input[type="text"], .form input[type="email"], .form input[type="password"],
.form input[type="search"], .form textarea, .form select {
  font: inherit; padding: .6em .9em; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s;
}
.form textarea { min-height: 150px; resize: vertical; }
.form input:focus-visible, .form textarea:focus-visible, .form select:focus-visible,
.site-search input:focus-visible {
  outline: none; border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37, 87, 189, .18);
}
.form input[aria-invalid="true"], .form textarea[aria-invalid="true"] { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: .88rem; font-weight: 600; }
.consent-box {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
  padding: 16px 18px; max-height: 260px; overflow-y: auto; font-size: .9rem; color: var(--muted);
}
.consent-check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--blue-900); }
.consent-check input { width: 20px; height: 20px; accent-color: var(--blue-700); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 22px; font-size: .97rem; }
.alert-success { background: #eaf6ef; border-color: #b6e0c9; color: #0f5132; }
.alert-error { background: #fdeeec; border-color: #f5c6c2; color: var(--danger); }
.alert-info { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-900); }

/* ------------------------------------------- gestione accessi e utilità */
.mt-0 { margin-top: 0; }
.muted, .hint { color: var(--muted); font-weight: 400; }
.hint { font-size: .9em; }
.badge {
  display: inline-block; padding: .16em .7em; border-radius: 999px;
  font-size: .8rem; font-weight: 700; border: 1px solid var(--line);
  background: #f2f4f8; color: var(--muted); white-space: nowrap;
}
.badge-yes { background: #eaf6ef; border-color: #b6e0c9; color: #0f5132; }
.badge-admin { background: #fff6df; border-color: var(--gold); color: #7c5f00; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline-block; margin-left: 8px; }
.btn-danger { color: var(--danger); border-color: currentColor; }
.btn-danger:hover { background: rgba(180, 35, 24, .1); color: var(--danger); }
fieldset.permissions {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; margin: 0; display: grid; gap: 8px;
}
fieldset.permissions legend { font-weight: 700; padding: 0 8px; }
fieldset.permissions label { display: flex; align-items: center; gap: 9px; font-weight: 600; }
fieldset.permissions input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue-700); }

/* -------------------------------------------------------- login/accesso */
.login-card { max-width: 460px; margin-inline: auto; }
.login-card .form-actions { justify-content: space-between; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; font-size: .92rem; flex-wrap: wrap; }

.iframe-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.iframe-panel iframe { display: block; width: 100%; height: 640px; border: 0; }

/* ---------------------------------------------------------------- blog */
.blog-list { display: grid; gap: 22px; }
.post-card {
  display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(13, 35, 82, .14); color: inherit; }
.post-card-media { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--blue-100); }
.post-card-body { padding: 20px 22px 22px 0; }
.post-card-body h2 { font-size: 1.2rem; margin-bottom: .3em; }
.post-card-body p { color: var(--muted); margin-bottom: .6em; font-size: .96rem; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: .85rem; }
.post-meta .tag { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 999px; padding: .1em .7em; }

.post-hero { width: 100%; border-radius: var(--radius); margin-bottom: 24px; box-shadow: var(--shadow); }
.post-body { font-size: 1.02rem; }
.post-body img { display: block; margin: 22px auto; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.post-nav { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 30px; }

.pagination { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 30px; list-style: none; padding: 0; }
.pagination a, .pagination span {
  display: inline-block; padding: .45em .95em; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; text-decoration: none; color: var(--blue-800); font-weight: 600; font-size: .92rem;
}
.pagination a:hover { background: var(--blue-50); }
.pagination .current { background: var(--blue-800); border-color: var(--blue-800); color: #fff; }

/* ------------------------------------------------------------ ricerca */
.search-form-large { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.search-form-large input {
  font: inherit; flex: 1 1 260px; padding: .65em 1.1em; border: 1px solid var(--line);
  border-radius: 999px; background: #fff;
}
.result-list { display: grid; gap: 16px; list-style: none; padding: 0; margin: 0; }
.result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.result h2 { font-size: 1.08rem; margin-bottom: .25em; }
.result p { margin: 0; color: var(--muted); font-size: .95rem; }
.result .url { font-size: .82rem; color: var(--success); word-break: break-all; }
mark { background: #fde68a; color: inherit; padding: 0 .15em; border-radius: 3px; }

/* -------------------------------------------------------------- immagini */
.figure { margin: 0 0 24px; }
.figure img { border-radius: var(--radius); box-shadow: var(--shadow); }
.figure figcaption { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.figure-centered { margin-inline: auto; max-width: 460px; }
.pull-right { float: right; margin: 0 0 18px 24px; max-width: 45%; }
.clearfix::after { content: ""; display: table; clear: both; }
.beacon-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .95rem; letter-spacing: .1em; color: var(--blue-900);
}
.noscript-note { background: #fde68a; color: #4a3a05; text-align: center; padding: 10px 20px; font-size: .92rem; }
.form-feedback[hidden] { display: none; }

/* --------------------------------------------------------------- footer */
.site-footer { background: var(--blue-950); color: #c6d1ec; margin-top: 20px; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding-block: 42px 30px; }
.footer-col h2 { color: #fff; font-size: 1rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .8em; }
.footer-col p { margin-bottom: .6em; font-size: .95rem; }
.site-footer a { color: #ffd968; }
.site-footer a:hover { color: #fff; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .95rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .14); padding-block: 18px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; font-size: .87rem; }
.footer-bottom p { margin: 0; }
.footer-note { color: #8ea1c9; }

/* ------------------------------------------------------------ cookie bar */
.cookie-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--blue-950); color: #e7ecf9;
  box-shadow: 0 -6px 24px rgba(8, 23, 54, .35); font-size: .93rem;
}
.cookie-bar[hidden] { display: none; }
.cookie-bar p { margin: 0; }
.cookie-bar a { color: var(--gold); }

/* -------------------------------------------------------------- utilità */
.notice { font-size: .93rem; color: var(--muted); }
.mt-sm { margin-top: 16px; }
.mt-md { margin-top: 26px; }
.mb-0 { margin-bottom: 0; }
.justify-between { justify-content: space-between; }
.divider { height: 1px; background: var(--line); border: 0; margin: 30px 0; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.stat-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 26px; }
.stat { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: var(--radius); padding: 16px 18px; }
.stat strong { display: block; font-size: 1.4rem; color: var(--blue-800); }
.stat span { font-size: .88rem; color: var(--muted); }

/* --------------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .js .nav-toggle { display: inline-flex; }
  .site-search { order: 3; width: 100%; }
  .site-search input { width: auto; flex: 1; }
  .header-top { flex-wrap: wrap; }
  .js .site-nav { display: none; }
  .js .site-nav.is-open { display: block; }
  .site-nav .container { flex-direction: column; align-items: stretch; padding-block: 10px; gap: 6px; }
  .menu { flex-direction: column; }
  .menu a { padding: .7em .6em; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .menu .is-current > a { border-bottom-color: var(--gold); }
  .menu-separator { display: none; }
  .menu-account { padding: 10px 6px 4px; }
  .post-card { grid-template-columns: 1fr; }
  .post-card-media { aspect-ratio: 16 / 9; }
  .post-card-body { padding: 0 20px 20px; }
  .pull-right { float: none; max-width: 100%; margin: 0 0 20px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand-logo { height: 56px; }
  .site-main { padding-block: 22px 40px; }
  .cookie-bar { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .cookie-bar, .site-search, .nav-toggle, .btn { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card, .prose-block { border: 0; box-shadow: none; padding: 0; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
}
