/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, iframe { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:root {
  /* Colore di marca */
  --blue: #0618ff;
  --blue-lo: #040fc4;
  --blue-hi: #2c43ff;

  /* Token semantici — TEMA PUBBLICO (tutto blu) */
  --bg: #0618ff;
  --surface: rgba(255,255,255,.07);
  --surface-2: rgba(255,255,255,.12);
  --text: #ffffff;
  --muted: rgba(255,255,255,.68);
  --muted-2: rgba(255,255,255,.52);
  --border: rgba(255,255,255,.18);
  --border-2: rgba(255,255,255,.32);
  --accent: #b9c2ff;
  --white: #ffffff;
  --ink: #0a0b14;

  --btn-primary-bg: #ffffff;
  --btn-primary-fg: var(--blue);

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 30px 60px -24px rgba(0,0,0,.55);
  --font: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --pad-x: clamp(20px, 4vw, 56px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Larghezza piena con padding laterale */
.container { width: 100%; max-width: none; margin: 0; padding: 0 var(--pad-x); }
.prose { max-width: 760px; margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.strong { font-weight: 600; color: var(--text); }

.eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}

/* ===== Header pubblico ===== */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--blue); border-bottom: 1px solid var(--border); transition: background .3s ease, border-color .3s ease; }
.site-header--overlay { position: fixed; left: 0; right: 0; top: 0; background: transparent; border-bottom-color: transparent; }
.site-header--overlay.is-scrolled { background: var(--blue); border-bottom-color: var(--border); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; height: 74px; gap: 24px; }
.site-logo { display: flex; align-items: center; gap: 12px; }
.site-logo img { height: 30px; width: auto; }
.site-logo .logo-word { color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: .02em; }
.site-nav { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.site-nav a { color: rgba(255,255,255,.82); font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; transition: color .15s ease; }
.site-nav a:hover { color: #fff; }

/* ===== Footer ===== */
.site-footer { background: var(--blue-lo); border-top: 1px solid var(--border); margin-top: 110px; padding: 60px 0; }
.site-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer img { height: 26px; width: auto; }
.site-footer p { font-size: .85rem; color: var(--muted); }

/* ===== HERO a tutto schermo ===== */
.hero {
  position: relative; width: 100%;
  height: 100vh; min-height: 560px; display: flex; align-items: flex-end; overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; }
.hero-bg img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6,24,255,.35) 0%, rgba(6,24,255,.15) 40%, rgba(4,15,196,.92) 100%),
    linear-gradient(90deg, rgba(6,24,255,.55), rgba(6,24,255,.10));
}
.hero-inner { position: relative; z-index: 2; width: 100%; padding-bottom: clamp(48px, 9vh, 110px); padding-top: 120px; pointer-events: none; }
.hero-inner .eyebrow { color: #fff; opacity: .9; }
.hero-inner h1 { font-size: clamp(2.6rem, 7vw, 6rem); line-height: .98; letter-spacing: -.035em; font-weight: 700; color: #fff; max-width: 16ch; }
.hero-inner .lead { color: rgba(255,255,255,.85); font-size: clamp(1.05rem, 1.6vw, 1.35rem); margin: 20px 0 30px; max-width: 56ch; }
.hero-inner .btn { pointer-events: auto; }
.hero-play {
  position: absolute; z-index: 2; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.7); color: #fff;
  font-size: 1.8rem; padding-left: 6px; backdrop-filter: blur(4px); pointer-events: none;
}
.hero-fulllink { position: absolute; inset: 0; z-index: 1; }

/* ===== Sezioni testo ===== */
.intro { padding: 90px 0 40px; }
.intro-compact { padding: 80px 0 8px; }
.section-title { font-size: clamp(1.8rem, 3.5vw, 2.6rem); letter-spacing: -.02em; color: var(--text); font-weight: 700; }
.section-title .accent, .intro h1 .accent { color: var(--accent); }
.intro h1 { font-size: clamp(2.6rem, 6.5vw, 4.6rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 700; color: var(--text); max-width: 14ch; }
.lead { color: var(--muted); font-size: 1.2rem; margin-top: 20px; max-width: 60ch; }

/* ===== Griglia lavori ===== */
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; padding: 48px 0 0; }
.work-card {
  display: flex; flex-direction: column; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: background .25s ease, border-color .25s ease, transform .25s ease;
}
.work-card:hover { background: var(--surface-2); border-color: var(--border-2); transform: translateY(-4px); }
.work-card-media { position: relative; aspect-ratio: 16/10; background: rgba(255,255,255,.08); overflow: hidden; border-radius: var(--radius-sm); margin-bottom: 20px; }
.work-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.work-card:hover .work-card-media img { transform: scale(1.04); }
.work-card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; font-size: 3rem; font-weight: 700; color: rgba(255,255,255,.5); }
.play-badge { position: absolute; inset: 0; margin: auto; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.7); color: #fff; font-size: 1.1rem; padding-left: 4px; backdrop-filter: blur(3px); }
.work-card-cat { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.work-card-index { font-size: .78rem; font-weight: 700; letter-spacing: .12em; color: var(--accent); font-variant-numeric: tabular-nums; margin-bottom: 8px; }
.work-card-body { display: flex; flex-direction: column; }
.work-card-body h2 { font-size: 1.5rem; letter-spacing: -.02em; color: var(--text); font-weight: 700; line-height: 1.15; }
.work-card-body p { color: var(--muted); font-size: .95rem; margin-top: 10px; }
.work-card-arrow { margin-top: 16px; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.work-card-arrow span { transition: transform .2s ease; }
.work-card:hover .work-card-arrow span { transform: translateX(5px); }

.empty-public { padding: 100px 0; text-align: center; color: var(--muted); font-size: 1.1rem; }

/* ===== Dettaglio lavoro ===== */
/* 1) Video principale: sempre largo 100%, altezza proporzionale 16:9
   (su schermi ultrawide 21:9 può superare l'altezza dello schermo). */
.fs-video { position: relative; width: 100%; background: #000; line-height: 0; }
.fs-frame { width: 100%; aspect-ratio: 16 / 9; }
.fs-frame iframe { width: 100%; height: 100%; display: block; border: 0; }

/* 2) Corpo a due colonne: 1/3 categoria · 2/3 contenuto */
.project-body { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(32px, 6vw, 96px); padding: clamp(48px, 8vh, 96px) 0 32px; }
.project-cat { position: sticky; top: 100px; display: inline-block; font-size: .82rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.project-main { max-width: 860px; min-width: 0; }
.project-main h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); letter-spacing: -.03em; color: var(--text); line-height: 1.04; margin-bottom: 24px; font-weight: 700; }
.project-desc { font-size: 1.18rem; color: rgba(255,255,255,.86); margin-bottom: 44px; }
.project-desc p { margin-bottom: 20px; }
.all-projects { margin-top: 48px; }

.video-wrap { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.section-label { font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 44px 0 18px; }

/* Elenco video (nella colonna 2/3) */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.project-videos { margin-bottom: 8px; }
.video-grid-item { margin: 0; }
.video-grid-item .video-wrap { border: 1px solid var(--border); margin-bottom: 10px; }
.video-grid-item figcaption { font-size: .95rem; color: var(--text); font-weight: 600; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-item { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); aspect-ratio: 1; transition: transform .2s ease; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item:hover { transform: scale(1.015); border-color: var(--border-2); }

/* ===== Lightbox ===== */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(2,6,60,.95); display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 90vw; max-height: 86vh; border-radius: 8px; }
.lightbox-close, .lightbox-nav { position: absolute; background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.6rem; display: grid; place-items: center; transition: background .15s ease; }
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255,255,255,.3); }
.lightbox-close { top: 24px; right: 24px; }
.lightbox-prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 24px; top: 50%; transform: translateY(-50%); }

/* ===== Pagine personalizzate ===== */
.page-detail { padding: 72px 0 40px; }
.page-detail h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.03em; color: var(--text); margin-bottom: 30px; line-height: 1.04; text-align: center; }
.page-content { font-size: 1.15rem; color: rgba(255,255,255,.86); }
.page-content h2 { font-size: 1.7rem; color: var(--text); margin: 40px 0 14px; letter-spacing: -.02em; }
.page-content h3 { font-size: 1.3rem; color: var(--text); margin: 30px 0 10px; }
.page-content p { margin-bottom: 20px; }
.page-content ul, .page-content ol { margin: 0 0 20px 1.3em; }
.page-content li { margin-bottom: 6px; }
.page-content a { color: #fff; text-decoration: underline; }
.page-content img { border-radius: var(--radius-sm); margin: 24px 0; }

/* ===== Bottoni ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; padding: 13px 26px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text); font-weight: 600; font-size: .95rem; transition: all .15s ease; }
.btn:hover { background: rgba(255,255,255,.1); border-color: var(--text); }
.btn-primary { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-primary:hover { opacity: .92; background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.btn-danger { background: transparent; border-color: rgba(255,255,255,.4); color: #ffd7d8; }
.btn-danger:hover { background: rgba(229,72,77,.25); border-color: #ffb3b5; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,.1); border-color: transparent; }
.btn-sm { padding: 8px 15px; font-size: .84rem; }

/* =========================================================
   ADMIN — tema blu (coerente col sito). I campi restano su
   fondo chiaro per massima leggibilità durante la digitazione.
   ========================================================= */
.admin-body { background: var(--blue); color: #fff; }

.admin-topbar { background: var(--blue-lo); border-bottom: 1px solid var(--border); }
.admin-topbar-inner { padding: 0 28px; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-topbar .brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.admin-topbar .brand img { height: 24px; width: auto; }
.admin-topbar nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.admin-topbar nav a { color: rgba(255,255,255,.82); font-size: .82rem; font-weight: 600; }
.admin-topbar nav a:hover { color: #fff; }
.admin-topbar nav .muted { color: rgba(255,255,255,.5); }
.admin-topbar .btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.4); background: transparent; }
.admin-topbar .btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 36px 28px 80px; }

.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-head h1 { font-size: 1.7rem; color: #fff; letter-spacing: -.02em; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 26px; margin-bottom: 24px; }
.card h2 { font-size: 1.15rem; margin-bottom: 16px; color: #fff; }
.card .muted, .form-card .muted { color: var(--muted); }
.card a { color: #fff; text-decoration: underline; }
.empty { text-align: center; padding: 48px; }
.empty p { color: var(--muted); margin-bottom: 16px; }

.admin-table { padding: 0; overflow-x: auto; }
.admin-table.card { padding: 0; }
.admin-table table { width: 100%; border-collapse: collapse; min-width: 680px; }
.admin-table th, .admin-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .strong { color: #fff; }
.admin-table .strong:hover { color: var(--accent); }
.admin-table td .muted { color: var(--muted); }
.thumb-cell { width: 76px; }
.thumb-cell img { width: 60px; height: 42px; object-fit: cover; border-radius: 6px; }
.thumb-placeholder { width: 60px; height: 42px; border-radius: 6px; background: rgba(255,255,255,.12); }
.actions { white-space: nowrap; text-align: right; }
.actions .btn { margin-left: 6px; }

.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: rgba(255,255,255,.1); color: var(--muted); border: 1px solid var(--border); }
.badge-ok { color: #fff; background: rgba(255,255,255,.2); border-color: var(--border-2); }

.form-card label, .auth-card label { display: block; margin-bottom: 20px; font-weight: 600; color: #fff; }
.form-card input[type=text], .form-card input[type=url], .form-card input[type=number],
.form-card textarea, .form-card input[type=file], .form-card select,
.auth-card input, .input-light {
  width: 100%; margin-top: 8px; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.25);
  background: #fff; color: #0a0b14; font-weight: 400;
}
.form-card textarea { resize: vertical; }
.form-card input:focus, .form-card select:focus, .auth-card input:focus, .form-card textarea:focus, .input-light:focus { outline: 2px solid #fff; outline-offset: 1px; border-color: #fff; }
.form-card hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.form-row { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.form-row .grow { flex: 1; min-width: 200px; }
.checkbox { display: flex !important; align-items: center; gap: 8px; font-weight: 500; color: #fff; }
.checkbox input { width: auto !important; margin: 0 !important; }

.photo-grid-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.photo-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.photo-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-item form { padding: 8px; text-align: center; }

.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: .95rem; }
.alert-ok { background: rgba(255,255,255,.14); border: 1px solid var(--border-2); color: #fff; }
.alert-err { background: rgba(255,90,95,.22); border: 1px solid rgba(255,150,155,.6); color: #ffe3e4; }
.alert a { color: inherit; font-weight: 700; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; text-align: left; }
.auth-logo { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: rgba(255,255,255,.14); border: 1px solid var(--border); margin-bottom: 20px; }
.auth-logo img { height: 30px; width: auto; }
.auth-card h1 { font-size: 1.5rem; color: #fff; letter-spacing: -.02em; }
.auth-card > .muted { margin-bottom: 22px; }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-card .center { margin-top: 18px; }
.auth-card .center a { color: #fff; text-decoration: underline; }

/* Admin: righe video */
.video-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.videos-list .video-row:first-child { border-top: none; }
.video-main { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .82rem; white-space: nowrap; margin: 8px 0 0; color: #fff; }
.video-main input { margin: 0; }
.video-fields { display: grid; grid-template-columns: 2.4fr 1.4fr 70px; gap: 8px; flex: 1; }
.video-fields input { padding: 9px 11px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; background: #fff; color: #0a0b14; width: 100%; }
.video-sort { text-align: center; }
.video-del { margin: 8px 0 0; font-size: .8rem; white-space: nowrap; color: #fff; }
#add-video { margin-top: 14px; }

/* Admin: editor testo (documento su fondo chiaro) */
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.editor-toolbar button { padding: 7px 12px; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.1); border-radius: 8px; font-size: .85rem; color: #fff; font-weight: 400; }
.editor-toolbar button:hover { background: rgba(255,255,255,.2); border-color: #fff; }
.rich-editor { min-height: 260px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 16px 18px; background: #fff; color: #0a0b14; font-weight: 400; line-height: 1.6; overflow-y: auto; }
.rich-editor:focus { outline: 2px solid #fff; outline-offset: 1px; }
.rich-editor img { max-width: 100%; height: auto; border-radius: 8px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .project-body { grid-template-columns: 1fr; gap: 20px; padding-top: 48px; }
  .project-cat { position: static; top: auto; margin-bottom: 4px; }
}
@media (max-width: 820px) {
  .video-fields { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .admin-head { flex-direction: column; align-items: stretch; }
  .works-grid { grid-template-columns: 1fr; }
  .intro { padding: 64px 0 32px; }
  .video-row { flex-wrap: wrap; }
  .video-fields { grid-template-columns: 1fr; }
  .hero-inner h1 { font-size: clamp(2.2rem, 11vw, 3.4rem); }
}
