:root {
  --paper: #faf6ef;
  --card: #ffffff;
  --ink: #2b2420;
  --muted: #74675c;
  --accent: #9b2c2c;
  --accent-soft: #f1e4d6;
  --line: #e7dccd;
  --shadow: 0 2px 6px rgba(60, 40, 20, .08), 0 10px 24px rgba(60, 40, 20, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 "Source Sans 3", system-ui, sans-serif;
}

h1, h2, h3 { font-family: "Playfair Display", Georgia, serif; margin: 0; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 32px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 24px 56px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 22px;
}
.hero h1 { font-size: clamp(40px, 6vw, 68px); line-height: 1.05; }
.tagline { font-size: 20px; color: var(--muted); margin: 18px 0 10px; max-width: 30ch; }
.stats {
  display: inline-block;
  margin: 8px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}

.hero-photos { position: relative; height: 420px; }
.polaroid {
  position: absolute;
  width: 46%;
  height: auto;
  padding: 10px 10px 34px;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 2px;
}
.p0 { left: 2%;  top: 4%;  transform: rotate(-7deg); z-index: 2; }
.p1 { left: 50%; top: 0;   transform: rotate(5deg); }
.p2 { left: 26%; top: 34%; transform: rotate(-2deg); z-index: 3; }
.p3 { left: 0;   top: 56%; transform: rotate(4deg); z-index: 1; }
.p4 { left: 54%; top: 50%; transform: rotate(-5deg); z-index: 2; }

/* Jump links */
.jump {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(250, 246, 239, .94);
  backdrop-filter: blur(6px);
  border-block: 1px solid var(--line);
}
.jump a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 999px;
}
.jump a:hover { background: var(--accent-soft); color: var(--accent); }

/* Sections */
main { max-width: 1180px; margin: 0 auto; padding: 8px 24px 40px; }
.category { padding-top: 48px; scroll-margin-top: 64px; }
.category h2 {
  font-size: 30px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.card {
  display: block;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 4px 10px rgba(60,40,20,.12), 0 18px 36px rgba(60,40,20,.14); }
.card-photo { aspect-ratio: 4 / 3; background: var(--accent-soft); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 14px 16px 16px; }
.card-year {
  display: block;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .06em;
}
.card h3 { font-size: 20px; line-height: 1.25; margin: 2px 0 4px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

footer {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px 48px;
  border-top: 1px solid var(--line);
}

/* Phones */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 40px 16px 32px; text-align: center; }
  .tagline { margin-inline: auto; }
  .hero-photos { height: 300px; max-width: 420px; width: 100%; margin: 0 auto; }
  .jump { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; }
  .jump a { white-space: nowrap; }
  main { padding: 0 16px 32px; }
  .category h2 { font-size: 24px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .card h3 { font-size: 17px; }
}

/* Event pages */
.event-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 24px 8px;
}
.back {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.back:hover { text-decoration: underline; }
.event-year {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .06em;
}
.event-header h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.1; }
.event-count { color: var(--muted); margin: 10px 0 0; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  padding-top: 24px;
}
.tile {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--accent-soft);
  box-shadow: 0 1px 3px rgba(60, 40, 20, .12);
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.tile:hover img { transform: scale(1.04); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
footer a { color: var(--accent); font-weight: 600; }

/* Full-size viewer */
body.viewing { overflow: hidden; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 15, 12, .98);
}
.viewer[hidden] { display: none; }
.viewer figure {
  margin: 0;
  max-width: calc(100vw - 140px);
  text-align: center;
}
.viewer img {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
}
.viewer figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: #efe6da;
  font-size: 17px;
}
.viewer-count { color: #b8aa9a; white-space: nowrap; }
.viewer button {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  cursor: pointer;
  border-radius: 999px;
  width: 52px;
  height: 52px;
  font-size: 34px;
  line-height: 1;
}
.viewer button:hover { background: rgba(255, 255, 255, .22); }
.viewer-close { top: 16px; right: 16px; font-size: 30px; }
.viewer-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 16px; top: 50%; transform: translateY(-50%); }

@media (max-width: 760px) {
  .event-header { padding: 20px 16px 4px; }
  .gallery { grid-template-columns: repeat(3, 1fr); gap: 4px; padding-top: 16px; }
  .tile { border-radius: 2px; }
  .viewer figure { max-width: 100vw; padding: 0 8px; }
  .viewer img { max-height: calc(100vh - 140px); }
  .viewer-prev, .viewer-next { top: auto; bottom: 16px; transform: none; }
  .viewer figcaption { padding: 0 4px 60px; }
}

/* Welcome page (the original Sibilia Family Album artwork) */
body.welcome {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #fffdf8 0%, var(--paper) 55%, #efe5d4 100%);
}
.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 32px 16px;
  text-align: center;
}
.welcome-art img {
  display: block;
  width: min(452px, 82vw);
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(60, 40, 20, .18));
  transition: transform .3s ease;
}
.welcome-art:hover img { transform: scale(1.02) rotate(-.5deg); }
.enter {
  display: inline-block;
  padding: 14px 30px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 19px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(155, 44, 44, .28);
  transition: transform .18s ease, box-shadow .18s ease;
}
.enter:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(155, 44, 44, .32); }
.welcome-note {
  margin: 0;
  color: var(--muted);
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
}

/* Invitation to share photos, across the top of the landing page */
.upload-banner {
  display: block;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-size: 17px;
  line-height: 1.4;
}
.upload-banner strong { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.upload-banner:hover strong, .upload-banner:focus strong { text-decoration-thickness: 2px; }
@media (max-width: 600px) { .upload-banner span { display: block; } }

/* "Back to top" link in the footer */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.to-top { display: inline-block; padding: 8px 18px; border-radius: 999px; background: var(--accent-soft); text-decoration: none; }
.to-top:hover, .to-top:focus { text-decoration: underline; }
