:root {
  --bg: #0b0c0e;
  --bg2: #111317;
  --panel: #15181d;
  --line: #262b33;
  --text: #e8e9ec;
  --muted: #8d93a0;
  --gold: #d4af5a;
  --gold-dark: #9a7a2e;
  --danger: #d4574f;
  --ok: #4fae7a;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}
body.locked { overflow: hidden; }

/* ----- sfondo animato (immagine Aegis) ----- */
body::before {
  content: "";
  position: fixed; inset: -6%;
  z-index: -2;
  background: url("/assets/aegis-bg.png") center / cover no-repeat;
  filter: blur(3px) brightness(.42) saturate(1.05);
  animation: bg-drift 38s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 35%, rgba(212, 175, 90, .16) 50%, transparent 65%) 0 0 / 250% 100%,
    radial-gradient(ellipse at 50% 0%, rgba(212, 175, 90, .12), transparent 60%),
    linear-gradient(180deg, rgba(11, 12, 14, .55), rgba(11, 12, 14, .82));
  animation: light-sweep 9s linear infinite;
}
@keyframes bg-drift {
  0%   { transform: scale(1.02) translate3d(-1.5%, -1%, 0); }
  50%  { transform: scale(1.12) translate3d(1%, 1.2%, 0); }
  100% { transform: scale(1.06) translate3d(1.8%, -1.2%, 0); }
}
@keyframes light-sweep {
  from { background-position: 150% 0, 0 0, 0 0; }
  to   { background-position: -100% 0, 0 0, 0 0; }
}
@keyframes float-y { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes glow-pulse {
  0%, 100% { filter: drop-shadow(0 8px 26px rgba(212, 175, 90, .22)); }
  50%      { filter: drop-shadow(0 8px 46px rgba(212, 175, 90, .55)); }
}
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 90, .45); }
  50%      { box-shadow: 0 0 0 10px rgba(212, 175, 90, 0); }
}
@keyframes fade-up { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes line-shine { from { background-position: 0 0; } to { background-position: 200% 0; } }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ----- nav ----- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: rgba(11, 12, 14, .72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; letter-spacing: .12em; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: .62rem; font-weight: 500; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; }
.nav nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
.nav nav a:not(.btn) { color: var(--muted); font-size: .92rem; }
.nav nav a:not(.btn):hover { color: var(--text); text-decoration: none; }

/* ----- bottoni ----- */
.btn {
  display: inline-block; cursor: pointer;
  padding: 12px 24px; border-radius: 8px; border: 1px solid var(--gold);
  background: linear-gradient(180deg, #e3c26a, #b8923b);
  color: #14110a; font-weight: 700; font-size: .95rem; font-family: inherit;
}
.btn { animation: btn-pulse 2.6s ease-out infinite; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { animation: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 14px; font-size: .85rem; }
.btn-ghost { background: transparent; color: var(--gold); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ----- hero ----- */
.hero {
  text-align: center;
  padding: 110px 24px 100px;
  background: linear-gradient(180deg, rgba(11, 12, 14, .15), rgba(11, 12, 14, .55));
  border-bottom: 1px solid var(--line);
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero-logo { animation: float-y 5s ease-in-out infinite, glow-pulse 3.2s ease-in-out infinite; }
.hero-inner > * { animation: fade-up .9s ease-out both; }
.hero-inner > :nth-child(2) { animation-delay: .12s; }
.hero-inner > :nth-child(3) { animation-delay: .24s; }
.hero-inner > :nth-child(4) { animation-delay: .36s; }
.hero-inner > :nth-child(5) { animation-delay: .48s; }
.hero-inner > .hero-logo { animation: fade-up .9s ease-out both, float-y 5s ease-in-out .9s infinite, glow-pulse 3.2s ease-in-out infinite; }
.eyebrow { color: var(--gold); letter-spacing: .3em; text-transform: uppercase; font-size: .75rem; margin: 22px 0 8px; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); line-height: 1.1; margin: 0 0 18px; letter-spacing: .04em; }
.tagline { color: var(--muted); font-style: italic; font-size: 1.1rem; margin: 0 0 32px; }
.cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ----- sezioni ----- */
.section { padding: 80px 24px; max-width: 1080px; margin: 0 auto; }
.section.alt { max-width: none; background: rgba(17, 19, 23, .72); backdrop-filter: blur(6px); border-block: 1px solid var(--line); }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }
.section.alt > * { max-width: 1032px; margin-inline: auto; }
.section h2 {
  font-size: 1.7rem; margin: 0 0 28px; letter-spacing: .06em; text-transform: uppercase;
  display: flex; align-items: center; gap: 14px;
}
.section h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), var(--gold-dark), transparent) 0 0 / 200% 100%; animation: line-shine 4s linear infinite; }
.lead { font-size: 1.12rem; max-width: 780px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--gold-dark); transform: translateY(-3px); }
.card.reveal { transition: opacity .8s ease, transform .8s ease, border-color .2s; }
.card.reveal.in { transition: opacity .8s ease, transform .25s ease, border-color .2s; }
.card .icon { font-size: 2rem; margin-bottom: 8px; display: inline-block; animation: float-y 4s ease-in-out infinite; }
.card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); }
.request { text-align: center; }
.request h2 { justify-content: center; }
.request h2::after { display: none; }
.request .lead { margin: 0 auto 26px; }

.news-list { display: grid; gap: 16px; }
.news-item { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 20px 24px; }
.news-item h3 { margin: 0; }
.news-item time { color: var(--muted); font-size: .8rem; }
.news-item p { margin: 10px 0 0; white-space: pre-wrap; }

.announcement { background: var(--gold); color: #14110a; text-align: center; padding: 9px 16px; font-weight: 600; font-size: .92rem; }
.footer { text-align: center; padding: 36px 24px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.footer p { margin: 4px 0; }

.maintenance { position: fixed; inset: 0; z-index: 100; background: rgba(11, 12, 14, .88); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 24px; text-align: center; }
.maintenance-box { max-width: 460px; }

/* ----- area staff ----- */
.app-body { min-height: 100vh; }
.box, .panel, .post { backdrop-filter: blur(6px); background-color: rgba(21, 24, 29, .86); animation: fade-up .5s ease-out both; }
.topbar, .tabs { background: rgba(17, 19, 23, .8); backdrop-filter: blur(8px); }
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.box { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; }
.box h1 { font-size: 1.3rem; margin: 12px 0 4px; letter-spacing: .06em; text-transform: uppercase; }
.box .sub { color: var(--muted); font-size: .9rem; margin: 0 0 22px; }
.box img.logo { display: block; margin: 0 auto; }
label { display: block; font-size: .82rem; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 90px; }
.box .btn { width: 100%; margin-top: 22px; }
.msg { margin-top: 14px; font-size: .88rem; min-height: 1.2em; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.tempbox {
  margin-top: 18px; padding: 16px; border: 1px dashed var(--gold); border-radius: 10px;
  background: rgba(212, 175, 90, .07); text-align: center;
}
.tempbox code { display: block; font-size: 1.35rem; letter-spacing: .08em; margin: 8px 0; color: var(--gold); user-select: all; }
.tempbox small { color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.topbar .who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; }
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--bg2); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 13px 16px; cursor: pointer; font: inherit; white-space: nowrap; }
.tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.wrap { max-width: 820px; margin: 0 auto; padding: 28px 20px 80px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 1.05rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.badge.webmaster { color: var(--gold); border-color: var(--gold); }
.badge.dev { color: #7fb2ff; border-color: #7fb2ff; }
.badge.staff { color: #9be0b5; border-color: #9be0b5; }
.badge.off { color: var(--danger); border-color: var(--danger); }
.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.post.pinned { border-color: var(--gold-dark); }
.post-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.post-head strong { font-size: .98rem; }
.post-head time { color: var(--muted); font-size: .78rem; margin-left: auto; }
.post-body { white-space: pre-wrap; word-wrap: break-word; margin: 6px 0; }
.post img.media { max-width: 100%; max-height: 420px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }
.actions { display: flex; gap: 14px; margin-top: 10px; }
.link { background: none; border: 0; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; padding: 0; }
.link:hover { color: var(--gold); }
.link.danger:hover { color: var(--danger); }
.comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.comment { padding: 8px 0; font-size: .92rem; }
.comment .meta { color: var(--muted); font-size: .78rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment p { margin: 3px 0 0; white-space: pre-wrap; word-wrap: break-word; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.table select { padding: 6px 8px; width: auto; }
.table-wrap { overflow-x: auto; }
.preview { max-width: 160px; max-height: 120px; border-radius: 8px; margin-top: 8px; }
@media (max-width: 640px) {
  .nav { padding: 10px 14px; }
  .nav nav a:not(.btn) { display: none; }
  .section { padding: 56px 18px; }
  .hero { padding: 70px 18px; }
}
