/* =====================================================
   S & J — Wedding Page Stylesheet
   "Romantico ma non pesante, giocoso ma non infantile"
   ===================================================== */

/* ── FONT IMPORTS ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@400;600;700&family=Press+Start+2P&display=swap');

/* ── RESET & BOX MODEL ────────────────────────────── */
html { -webkit-print-color-adjust: exact; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

@media only screen {
  body {
    margin: 0 auto;
    max-width: 860px;
    color: rgb(55, 53, 47);
    padding: 0 1.2rem;
  }
}

/* ── DESIGN TOKENS ────────────────────────────────── */
:root {
  --blue:       #387dc9;
  --blue-dark:  #1f4e8a;
  --soft-blue:  #e8f4ff;
  --peach:      #ffdbca;
  --soft-peach: #fff5f0;
  --rust:       #d35400;
  --text:       #2d3436;
  --muted:      #636e72;

  --font-serif:   'Cormorant Garamond', Georgia, serif;
  --font-sans:    'DM Sans', system-ui, sans-serif;
  --font-game:    'Press Start 2P', monospace;

  --glass:  rgba(255, 255, 255, 0.72);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
  --radius: 18px;
}

/* ── BODY BASE ────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
  /* Subtle warm background that doesn't fight the photos */
  background: #f9f5f1;
  white-space: normal;
}

/* ═══════════════════════════════════════════════════
   HERO SLIDESHOW
   Five photos that cross-fade every ~4 seconds.
   Replace image1.jpg … image5.jpg with real filenames.
   ═══════════════════════════════════════════════════ */
.hero-slideshow {
  position: relative;
  width: 100%;
  height: 50vh;          /* comfortable cinematic strip */
  min-height: 260px;
  max-height: 520px;
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 6px 30px rgba(0,0,0,0.12);
  margin-bottom: 0;
}

/* Each slide is absolutely stacked; only the active one is opaque */
.hero-slideshow .slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

.hero-slideshow .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  display: block;
}

/* The .active class is toggled by JS */
.hero-slideshow .slide.active { opacity: 1; }

/* Soft gradient overlay so the title reads cleanly below */
.hero-slideshow::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 55%,
    rgba(249, 245, 241, 0.7) 100%
  );
  pointer-events: none;
}

/* Dot navigation bullets */
.hero-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}
.hero-dot.active {
  background: white;
  transform: scale(1.3);
}

/* ── PAGE HEADER (below slideshow) ────────────────── */
.page-header-icon { display: none; } /* hide Notion icon; slideshow is our hero */

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1.1;
  /* Blue → peach gradient name */
  background: linear-gradient(115deg, var(--blue) 0%, #ff8a71 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 1rem 0 0.3em;
  text-align: center;
}

/* ── HEADINGS ─────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: #1e272e;
}

/* ── BLOCKQUOTE ───────────────────────────────────── */
blockquote {
  border-left: 4px solid var(--peach);
  background: rgba(255, 255, 255, 0.45);
  padding: 1.4rem 1.8rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: #4a4a4a;
  margin: 1.5em 0;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  /* Subtle entrance animation */
  animation: fadeUp 0.7s ease both;
}

/* ── DETAILS / SUMMARY (FAQs & Presenze) ─────────── */
details {
  margin: 1.2em 0;
  background: var(--glass);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.6);
  /* Slide-in on load */
  animation: fadeUp 0.5s ease both;
}

summary {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue);
  padding: 0.4em 0;
  cursor: pointer;
  list-style: none; /* hide default triangle */
  display: flex;
  align-items: center;
  gap: 0.5em;
  transition: color 0.25s;
  user-select: none;
}
/* Custom triangle arrow */
summary::before {
  content: '▸';
  display: inline-block;
  transition: transform 0.25s;
  font-size: 0.85em;
}
details[open] > summary::before { transform: rotate(90deg); }
summary:hover { color: #ff8a71; }
details[open] > summary { color: #ff8a71; }

/* Animated reveal for <details> content */
details[open] > *:not(summary) {
  animation: slideDown 0.3s ease both;
}

/* ── MATH / CODE INLINE ───────────────────────────── */
.katex {
  font-size: 1em !important;
  background: rgba(255, 255, 255, 0.55);
  padding: 2px 6px;
  border-radius: 5px;
}

code, .mord.texttt {
  font-size: 0.88em;
  background: var(--peach);
  color: var(--rust);
  padding: 0.2em 0.5em;
  border-radius: 5px;
  font-family: 'Courier New', monospace !important;
}

/* ── TABLES ───────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.9rem; }
th, td { border: 1px solid rgba(55, 53, 47, 0.09); padding: 0.5em 0.75em; text-align: left; }
.simple-table-header-color {
  background: rgb(247, 246, 243);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.collection-content {
  font-size: 0.875rem;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.selected-value {
  display: inline-block;
  padding: 0 0.5em;
  background: rgba(206, 205, 202, 0.5);
  border-radius: 3px;
  margin: 0.2em;
  white-space: nowrap;
}
.select-value-color-blue  { background-color: rgba(0,118,217,.15); color:#0076d9; }
.select-value-color-green { background-color: rgba(0,96,38,.15);   color:#006026; }
.select-value-color-red   { background-color: rgba(206,24,0,.15);  color:#ce1800; }

/* ── PRESENZE ─────────────────────────────────────── */
.presenze-container summary { font-size: 1.15rem; }
.presenze-container details[open] summary { color: #ff8a71; }

/* ── TEMPLATE CARD (Missiva) ─────────────────────── */
.template-card {
  background: var(--soft-peach);
  border: 1px solid var(--peach);
  border-radius: var(--radius);
  margin-top: 1rem;
  padding: 20px;
  box-shadow: var(--shadow);
}
.template-body {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}
.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px dashed rgba(211, 84, 0, 0.25);
}
.missiva-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--rust);
  text-transform: uppercase;
}
#copyBtn {
  background: linear-gradient(135deg, #ff8a71 0%, #ff5e3a 100%);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(211, 84, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#copyBtn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(211,84,0,.3); }
#copyBtn:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════
   ARCADE GAME SECTION
   ═══════════════════════════════════════════════════ */
#invaders {
  max-width: 480px;
  margin: 3em auto;
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* Decorative scanline effect on the whole game box */
#invaders::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 3px,
    rgba(56,125,201,0.03) 3px,
    rgba(56,125,201,0.03) 4px
  );
  pointer-events: none;
  border-radius: 24px;
}

#invaders canvas {
  display: block;
  margin: 0 auto 1rem;
  image-rendering: pixelated;
  border-radius: 12px;
  width: 100%;
  max-width: 320px;
  /* Neon glow while playing (toggled via JS class) */
  box-shadow: 0 4px 20px rgba(56, 125, 201, 0.25);
  transition: box-shadow 0.4s;
  border: 2px solid rgba(56,125,201,0.15);
}
#invaders canvas.glow-playing {
  box-shadow: 0 0 0 2px var(--blue), 0 0 22px rgba(56,125,201,0.45);
}

/* Start button */
#startBtn {
  font-family: var(--font-game);
  font-size: 9px;
  padding: 14px 22px;
  background: var(--peach);
  border: none;
  border-bottom: 4px solid #e67e22;
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 0 #e67e22;
}
#startBtn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #e67e22; }
#startBtn:active { transform: translateY(2px); box-shadow: 0 2px 0 #e67e22; }

/* Touch controls (D-Pad vibe) */
#touchControls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2em;
  margin-top: 1.2em;
}
#touchControls button {
  background: white;
  border: none;
  border-radius: 50%;
  width: 58px; height: 58px;
  box-shadow: 0 4px 0 #ddd;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s, box-shadow 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#touchControls button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #ddd;
}
#touchControls button[data-dir="fire"] {
  background: var(--peach);
  box-shadow: 0 4px 0 #e67e22;
  font-size: 1.6rem;
}

/* High-score modal — dark arcade cabinet feel */
#nameModal {
  display: none;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(12, 20, 35, 0.97);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 24px;
  border: 3px solid var(--blue);
  box-shadow: inset 0 0 40px rgba(56,125,201,0.35);
}
#playerName {
  font-family: var(--font-game);
  font-size: 16px;
  background: rgba(255,255,255,0.07);
  border: none;
  border-bottom: 3px solid #00ffcc;
  color: #00ffcc;
  text-shadow: 0 0 8px rgba(0,255,204,0.7);
  text-align: center;
  outline: none;
  text-transform: uppercase;
  width: 75%;
  padding: 10px;
  margin-bottom: 16px;
  transition: border-color 0.3s, color 0.3s;
}
#playerName:focus {
  border-bottom-color: #ff8a71;
  color: #ff8a71;
  text-shadow: 0 0 8px rgba(255,138,113,0.8);
}
#saveScoreBtn {
  font-family: var(--font-game);
  font-size: 9px;
  padding: 14px 28px;
  background: var(--blue);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 4px 4px 0 #003366;
  letter-spacing: 0.05em;
  transition: transform 0.1s, box-shadow 0.1s;
}
#saveScoreBtn:hover { background: #2b69b3; }
#saveScoreBtn:active { transform: translate(2px,2px); box-shadow: 2px 2px 0 #003366; }

/* "Fight aliens" CTA button */
.arcade-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 26px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1rem;
  color: white;
  background: linear-gradient(135deg, var(--blue) 0%, #63a4ff 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(56,125,201,0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.arcade-cta:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 8px 28px rgba(56,125,201,0.4);
  background: linear-gradient(135deg, #ff8a71 0%, #ffaf9b 100%);
}
.arcade-cta:active { transform: scale(0.98); }
.arcade-cta .emoji {
  font-size: 1.2rem;
  animation: bounce 2s ease-in-out infinite;
}

/* ── ANIMATIONS ───────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* ── RESPONSIVE ───────────────────────────────────── */
@media (max-width: 600px) {
  .page-title { font-size: 2.6rem; }
  body { font-size: 16px; }
  .hero-slideshow { height: 38vh; }
}
