:root {
  --bg:        oklch(0.13 0.018 260);
  --bg-2:      oklch(0.17 0.020 260);
  --card:      oklch(0.19 0.022 260);
  --line:      oklch(0.30 0.020 260);
  --line-2:    oklch(0.42 0.020 260);
  --ink:       oklch(0.97 0.010 88);
  --ink-2:     oklch(0.82 0.014 88);
  --ink-3:     oklch(0.58 0.016 88);
  --accent:    oklch(0.74 0.14 75);
  --accent-2:  oklch(0.62 0.16 75);
  --warn:      oklch(0.66 0.18 28);
  --sans: 'DM Sans', -apple-system, system-ui, sans-serif;
  --display: 'Syne', 'Space Grotesk', sans-serif;
  --serif: 'Syne', Georgia, serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mx: 50%;
  --my: 50%;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

::selection {
  background: oklch(0.74 0.14 75 / 0.25);
  color: var(--ink);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

body {
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle film grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease), filter .2s var(--ease); }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }

/* ============================================
   Progress bar
   ============================================ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 9999;
  width: 0%;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ============================================
   Header
   ============================================ */
.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(0.13 0.018 260 / 0.85);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  transition: padding .35s var(--ease), background .35s var(--ease);
}
.site.shrink {
  background: oklch(0.10 0.018 260 / 0.92);
}
.site .inner {
  max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 24px; align-items: center;
  padding: 18px 28px;
}

.brand {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: 12px;
  text-transform: lowercase;
}
.brand em { color: var(--accent); font-style: italic; }
.logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 10px oklch(0.74 0.14 75 / 0.35));
  transition: transform .4s var(--ease);
}
.brand:hover .logo-img { transform: rotate(-8deg) scale(1.08); }

nav.menu {
  display: flex; gap: 24px;
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
nav.menu a {
  color: var(--ink-3);
  position: relative;
  padding-bottom: 2px;
}
nav.menu a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width .3s var(--ease);
}
nav.menu a:hover::after,
nav.menu a.on::after { width: 100%; }
nav.menu a:hover, nav.menu a.on { color: var(--ink); }

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  align-items: center;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--ink-2);
  border-radius: 1px;
  transition: transform .3s var(--ease), opacity .2s;
  transform-origin: center;
}
.menu-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 780px) {
  .site .inner { grid-template-columns: 1fr auto; }
  nav.menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: oklch(0.10 0.018 260 / 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 20px 28px 28px;
    gap: 16px;
    font-size: 14px;
  }
  nav.menu.open { display: flex; }
  .menu-toggle { display: flex; }
}

/* ============================================
   Hero
   ============================================ */
.hero {
  max-width: 1440px; margin: 0 auto;
  padding: 100px 28px 80px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(52px, 8vw, 120px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 32px;
  text-transform: lowercase;
}
.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}
.hero .lead {
  font-size: 19px;
  color: var(--ink-2);
  max-width: 760px;
  margin-bottom: 32px;
  line-height: 1.6;
}
.hero-meta {
  display: flex; gap: 24px;
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

/* Hero background UFO */
.hero::before {
  content: "";
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 38vw;
  height: 38vw;
  max-width: 520px;
  max-height: 520px;
  background-image: url('ufo.svg');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.14;
  pointer-events: none;
  filter: drop-shadow(0 12px 80px oklch(0.74 0.14 75 / 0.35));
  animation: float 7s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(-50%) translateX(0) rotate(0deg); }
  50% { transform: translateY(calc(-50% - 18px)) translateX(10px) rotate(2deg); }
}
@media (max-width: 940px) {
  .hero::before { display: none; }
  .hero { padding: 72px 24px 60px; }
}
.hero h1, .hero .lead, .hero-meta {
  position: relative;
  z-index: 1;
}

/* ============================================
   Sections
   ============================================ */
.bay {
  max-width: 1440px; margin: 0 auto;
  padding: 96px 28px;
}
.section-tag {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 18px;
  display: block;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 20px;
  text-transform: lowercase;
}
.section-head h2 em { font-style: italic; font-weight: 500; color: var(--accent); }
.section-head p {
  max-width: 720px;
  font-size: 17px;
  margin-bottom: 52px;
  line-height: 1.55;
}

/* ============================================
   Cards grid
   ============================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 980px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  transition: border-color .35s var(--ease), transform .4s var(--ease), box-shadow .4s var(--ease);
  display: flex; flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), oklch(0.74 0.14 75 / 0.08), transparent 40%);
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
  z-index: 0;
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: oklch(0.74 0.14 75 / 0.45);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px -20px oklch(0.05 0.02 260 / 0.6), 0 0 0 1px oklch(0.74 0.14 75 / 0.15) inset;
}
.card .kicker {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  position: relative; z-index: 1;
}
.card h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.025em;
  color: var(--ink);
  line-height: 1;
  text-transform: lowercase;
  position: relative; z-index: 1;
  transition: color .3s var(--ease);
}
.card:hover h3 { color: var(--accent); }
.card p {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.55;
  position: relative; z-index: 1;
}
.card .arrow {
  margin-top: auto;
  font-family: var(--mono); font-size: 13px;
  color: var(--accent);
  position: relative; z-index: 1;
  transition: transform .3s var(--ease);
  display: inline-block;
}
.card:hover .arrow { transform: translateX(4px); }

/* Card variety */
.cards .card:nth-child(odd) {
  background: linear-gradient(145deg, var(--card) 0%, oklch(0.17 0.03 260) 100%);
}
.cards .card:nth-child(4n) {
  background: linear-gradient(160deg, oklch(0.20 0.03 260) 0%, var(--card) 100%);
}

/* ============================================
   Reveal animations
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============================================
   Article page
   ============================================ */
.article {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 28px 48px;
}
.article .crumb {
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 32px;
}
.article .crumb a { color: var(--ink-2); }
.article .crumb a:hover { color: var(--accent); }
.article h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(40px, 5.5vw, 72px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 18px;
  text-transform: lowercase;
}
.article .deck {
  font-size: 18px;
  color: var(--ink-2);
  margin-bottom: 36px;
  line-height: 1.55;
  border-bottom: 1px solid var(--line);
  padding-bottom: 28px;
}
.article h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 52px 0 18px;
  line-height: 1.1;
  text-transform: lowercase;
}
.article h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 32px 0 14px;
  text-transform: lowercase;
}
.article p {
  font-size: 16.5px;
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 18px;
}
.article p strong { color: var(--ink); font-weight: 500; }
.article ul, .article ol {
  margin: 16px 0 24px 24px;
  color: var(--ink-2);
}
.article li { line-height: 1.7; padding: 4px 0; }
.article blockquote {
  border-left: 3px solid var(--accent);
  margin: 28px 0;
  padding: 8px 24px;
  font-family: var(--serif);
  font-size: 19px;
  font-style: italic;
  color: var(--ink);
  line-height: 1.55;
}
.article figure {
  margin: 28px 0;
}
.article figure img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  transition: border-color .3s var(--ease), transform .4s var(--ease);
}
.article figure:hover img {
  border-color: oklch(0.74 0.14 75 / 0.35);
  transform: scale(1.01);
}
.article figure figcaption {
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-3);
  margin-top: 10px;
  text-align: center;
}
.article hr {
  border: none;
  height: 1px;
  background: var(--line);
  margin: 40px 0;
}

/* ============================================
   Related
   ============================================ */
.related {
  max-width: 1440px;
  margin: 72px auto 48px;
  padding: 32px 28px 0;
  border-top: 1px solid var(--line);
}
.related h4 {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 16px;
}
.related-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 640px) { .related-list { grid-template-columns: 1fr; } }
.related-item {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink-2);
  transition: border-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.related-item:hover {
  border-color: oklch(0.74 0.14 75 / 0.45);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px -12px oklch(0.05 0.02 260 / 0.5);
  color: var(--ink);
}
.related-item .ri-name {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.014em;
}
.related-item .ri-meta {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ============================================
   Footer
   ============================================ */
footer.site {
  position: static;
  margin-top: 64px;
  padding: 64px 28px 36px;
  background: oklch(0.08 0.018 260);
  border-top: 1px solid var(--line);
}
footer.site .inner {
  max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  padding: 0;
}
@media (max-width: 780px) {
  footer.site .inner { grid-template-columns: 1fr; gap: 28px; }
}
footer .foot-brand {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 12px;
  text-transform: lowercase;
}
footer .foot-brand em { color: var(--accent); font-style: italic; }
footer p {
  font-size: 13.5px;
  color: var(--ink-3);
  max-width: 38ch;
  line-height: 1.55;
}
footer h5 {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 14px;
}
footer ul { list-style: none; }
footer ul li { padding: 4px 0; }
footer ul a { color: var(--ink-2); font-size: 13.5px; position: relative; }
footer ul a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width .3s var(--ease);
}
footer ul a:hover::after { width: 100%; }
footer ul a:hover { color: var(--ink); }
.foot-bot {
  max-width: 1440px;
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
}
.foot-mind a { color: var(--accent); font-weight: 600; }
.foot-mind em { font-style: italic; opacity: 0.7; }

/* ============================================
   Article with metadata sidebar
   ============================================ */
.article-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px 28px 0;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 64px;
}
@media (max-width: 940px) {
  .article-wrap { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px 0; }
}
.article-wrap .article {
  max-width: none;
  padding: 0;
}
.article-meta {
  align-self: start;
  position: sticky;
  top: 100px;
  display: grid;
  gap: 20px;
  align-content: start;
  font-family: var(--mono);
  font-size: 12px;
  padding: 24px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .3s var(--ease);
}
.article-meta:hover {
  border-color: oklch(0.74 0.14 75 / 0.35);
}
@media (max-width: 940px) {
  .article-meta {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 16px 28px;
    padding: 16px 18px;
  }
}
.meta-block {
  display: grid;
  gap: 4px;
}
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10.5px;
  color: var(--ink-3);
}
.meta-val {
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

/* ============================================
   Back to top
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease), border-color .2s;
  z-index: 90;
  box-shadow: 0 8px 30px -8px oklch(0.05 0.02 260 / 0.5);
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ============================================
   Misc
   ============================================ */
.bay + .bay { padding-top: 0; }

/* ============================================
   Data tables (avvistamenti, etc.)
   ============================================ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  margin-top: 36px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead tr {
  border-bottom: 1px solid var(--line);
}
.data-table th {
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.5;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover td {
  background: oklch(0.21 0.022 260);
}
.td-date { white-space: nowrap; color: var(--ink-3); }
.td-place strong { color: var(--ink); font-weight: 600; }
.td-desc { color: var(--ink-2); }

.qualif {
  margin-top: 28px;
  font-size: 13px;
  color: var(--ink-3);
  font-family: var(--mono);
  text-transform: none;
}

/* Focus visible for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
