/* =========================================================
   La Sala Giochi dell'IA — home page
   Same arcade identity as the games:
   Orbitron (arcade display) + Syne (headings) + DM Sans (body)
========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700;800;900&family=Syne:wght@600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ---------- tokens ---------- */
:root {
  --bg: #0D0B1A;
  --panel: #15132A;
  --panel-2: #1A1834;
  --border: #2A2545;
  --ink: #E6EBFF;
  --ink-2: #CDD7F3;
  --muted: #8B8AA3;

  --teal: #4ECDC4;
  --coral: #FF6B6B;
  --yellow: #FFE66D;
  --purple: #A78BFA;

  --brand-yellow: #FFE66D;
  --brand-glow: rgba(255,230,109,.45);

  --font-heading: 'Syne', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-arcade: 'Orbitron', var(--font-heading), system-ui, sans-serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
}

:root[data-theme="light"] {
  --bg: #F5F3FF;
  --panel: #FFFFFF;
  --panel-2: #F9F8FF;
  --border: #D4D0E8;
  --ink: #1E1B34;
  --ink-2: #3B3660;
  --muted: #6B6790;
  --teal: #0D8A80;
  --coral: #D03030;
  --yellow: #A07800;
  --purple: #7C5FC4;
  --brand-yellow: #B8860B;
  --brand-glow: rgba(184,134,11,.25);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(167,139,250,.14), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(78,205,196,.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  overflow-x: hidden;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(124,95,196,.10), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(13,138,128,.08), transparent 60%),
    var(--bg);
}
a { color: inherit; }
button, .btn { font-family: var(--font-body); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* =========================================================
   HEADER
========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--border);
  background: rgba(13,11,26,.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
:root[data-theme="light"] .site-header { background: rgba(245,243,255,.85); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.brand-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 12px var(--teal);
}

.header-right { display: inline-flex; align-items: center; gap: 6px; }
.nav-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 8px;
  margin-right: 4px;
}
.nav-link:hover { color: var(--teal); }
.header-right button {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--ink-2);
  border-radius: 8px;
  padding: 5px 10px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.header-right button:hover { border-color: var(--teal); color: var(--ink); }
.header-right button[aria-pressed="true"] { background: var(--panel); border-color: var(--teal); color: var(--teal); }

/* =========================================================
   HERO
========================================================= */
main { padding-inline: var(--gutter); }

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding-block: clamp(40px, 8vw, 84px) clamp(28px, 5vw, 48px);
  text-align: center;
}
/* the title with the games' emoji scattered around it: the padding is
   the band where the emoji float, so they never cover the letters */
.hero-title {
  position: relative;
  padding: clamp(34px, 6vw, 48px) clamp(40px, 9vw, 96px);
}
.float-emoji {
  position: absolute;
  font-size: clamp(22px, 3.6vw, 36px);
  line-height: 1;
  animation: emojiBob 2.6s ease-in-out infinite;
}
.float-emoji.e1 { top: 2px;     left: 9%;   animation-delay: 0s; }
.float-emoji.e2 { top: 42%;     left: 0;    animation-delay: .4s; }
.float-emoji.e3 { bottom: 0;    left: 16%;  animation-delay: .8s; }
.float-emoji.e4 { top: 6px;     right: 12%; animation-delay: 1.2s; }
.float-emoji.e5 { top: 38%;     right: 0;   animation-delay: 1.6s; }
.float-emoji.e6 { bottom: 2px;  right: 19%; animation-delay: 2s; }
.float-emoji.e7 { top: 0;       left: 47%;  animation-delay: .6s; font-size: clamp(18px, 2.6vw, 26px); }
@keyframes emojiBob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-8px) rotate(6deg); }
}

.hero h1 {
  margin: 0;
  font-family: var(--font-arcade);
  font-weight: 900;
  font-size: clamp(34px, 7vw, 68px);
  line-height: 1.05;
  letter-spacing: .03em;
  color: var(--brand-yellow);
  text-shadow: 0 0 10px var(--brand-glow), 0 0 34px var(--brand-glow);
  animation: titleGlow 2.4s ease-in-out infinite alternate;
  text-wrap: balance;
}
@keyframes titleGlow {
  from { text-shadow: 0 0 8px var(--brand-glow), 0 0 22px var(--brand-glow); }
  to   { text-shadow: 0 0 14px var(--brand-glow), 0 0 42px var(--brand-glow); }
}
.lead {
  margin: 18px auto 0;
  max-width: 620px;
  font-size: clamp(16px, 2vw, 18px);
  color: var(--ink-2);
  text-wrap: pretty;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: all .2s;
}
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn.primary {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(78,205,196,.12);
  box-shadow: 0 0 16px rgba(78,205,196,.15);
}
.btn.primary:hover { background: rgba(78,205,196,.22); }

/* =========================================================
   GAME CARDS
========================================================= */
.games {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  scroll-margin-top: 80px;
}

.game-card {
  --accent: var(--c);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
:root[data-theme="light"] .game-card { --accent: var(--cl); }
/* neon strip on top, in the game's colour */
.game-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(0,0,0,.35), 0 0 0 1px var(--accent), 0 0 26px color-mix(in srgb, var(--accent) 30%, transparent);
}
:root[data-theme="light"] .game-card:hover {
  box-shadow: 0 14px 30px rgba(30,27,52,.12), 0 0 0 1px var(--accent);
}

.game-icon {
  width: 56px; height: 56px;
  display: grid;
  place-items: center;
  font-size: 30px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  margin-bottom: 6px;
}
.game-card:hover .game-icon { animation: emojiBob 1.6s ease-in-out infinite; }

/* "start here" tag on the first card */
.start-badge {
  position: absolute;
  top: 18px; right: 18px;
  padding: 4px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.game-card h2 {
  margin: 0;
  font-family: var(--font-arcade);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: .02em;
  text-wrap: balance;
}
.game-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-2);
  flex: 1;
  text-wrap: pretty;
}
.play {
  align-self: flex-start;
  margin-top: 10px;
  padding: 5px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-family: var(--font-arcade);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  transition: background .2s;
}
.game-card:hover .play { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* =========================================================
   ABOUT
========================================================= */
.about {
  max-width: var(--max);
  margin: clamp(48px, 8vw, 88px) auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 22px;
  scroll-margin-top: 80px;
}
.about-text {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}
.about-text h2 {
  margin: 0 0 14px;
  font-family: var(--font-arcade);
  font-weight: 900;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: .03em;
  color: var(--teal);
}
.about-text p {
  margin: 0 0 12px;
  font-size: 15.5px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.about-text p:last-child { margin-bottom: 0; }
.about-text b { color: var(--ink); }

.about-card {
  align-self: start;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
}
.about-card h3 {
  margin: 0 0 12px;
  font-family: var(--font-arcade);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
}
.chips {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chips li {
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.lead-by { margin: 0 0 4px; font-size: 14.5px; color: var(--ink-2); }
.lead-by b { color: var(--ink); }
.affil { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.mail { margin: 0 0 18px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px;
  font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.mail a { display: inline-block; color: var(--teal); font-weight: 700; text-decoration: none;
  border-bottom: 1px dotted currentColor; overflow-wrap: anywhere; }
.mail a:hover { border-bottom-style: solid; }

/* =========================================================
   FOOTER
========================================================= */
.site-footer {
  margin-top: clamp(48px, 8vw, 80px);
  padding-block: 20px;
  padding-inline: var(--gutter);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.site-footer a { color: var(--ink-2); font-weight: 600; text-decoration: none; border-bottom: 1px dotted currentColor; }
.site-footer a:hover { color: var(--teal); }

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 960px) {
  .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .games { grid-template-columns: minmax(0, 1fr); gap: 14px; scroll-margin-top: 70px; }
  .brand span:last-child { font-size: 13px; }
  .nav-link { display: none; }
  .site-footer .sep { display: none; }
  .hero { padding-block: 18px 28px; }
  .hero-title { padding: 36px 30px; }
  .float-emoji { font-size: 22px; }
  .float-emoji.e2, .float-emoji.e5 { top: 44%; }
  .start-badge { position: static; justify-self: start; font-size: 11px; padding: 3px 9px; }
  .game-card.first .game-icon { grid-row: 1 / span 4; }
  .hero-cta .btn { flex: 1 1 0; justify-content: center; min-width: max-content; }
  /* icon beside the title: a compact card, less scrolling through six games */
  .game-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; row-gap: 6px; padding: 18px 16px 16px; }
  .game-icon { width: 48px; height: 48px; font-size: 26px; margin-bottom: 0; grid-row: 1 / span 3; }
  .game-card h2 { font-size: 16px; align-self: center; }
  .play { margin-top: 6px; justify-self: start; }
  .about { scroll-margin-top: 70px; }
  .about-text p { font-size: 15px; }
  .about-card .btn { width: 100%; justify-content: center; text-align: center; }
}

@media (pointer: coarse) {
  .header-right button { min-width: 42px; min-height: 40px; font-size: 14px; }
  .nav-link { padding-block: 10px; }
  .btn { min-height: 46px; }
}

/* touch screens keep :hover "stuck" after a tap */
@media (hover: none) {
  .game-card:hover { transform: none; }
  .game-card:hover .game-icon { animation: none; }
}

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