:root {
  --bg: #f4efe7;
  --bg-deep: #eadcc7;
  --surface: rgba(255, 251, 245, 0.8);
  --surface-strong: #fffaf2;
  --ink: #2f241d;
  --muted: #6d5a4f;
  --line: rgba(84, 57, 35, 0.12);
  --accent: #b85c38;
  --accent-deep: #894127;
  --sage: #8ea67f;
  --gold: #cf9f47;
  --shadow: 0 22px 60px rgba(54, 34, 17, 0.14);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Aptos", "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(207, 159, 71, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(142, 166, 127, 0.18), transparent 28%),
    linear-gradient(180deg, #f8f3ed 0%, var(--bg) 55%, #efe6da 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.14), transparent 72%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 20px auto 40px;
}

.hero,
.section,
.site-footer {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
}

.hero::after,
.section::after {
  content: "";
  position: absolute;
  inset: auto -20% -55% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 92, 56, 0.18), transparent 70%);
  pointer-events: none;
}

.topbar,
.hero-content,
.intro-grid,
.family-grid,
.memory-grid,
.journal-list,
.rhythm-grid,
.site-footer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #fff9f4;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 28px rgba(184, 92, 56, 0.3);
}

.topbar h1,
.section-heading h2,
.dialog-copy h2,
.hero-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
}

.topbar h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--muted);
}

.topbar-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.topbar-links a,
.button,
.filter-chip,
.dialog-close {
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, color 180ms ease;
}

.topbar-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.topbar-links a:hover,
.topbar-links a:focus-visible {
  transform: translateY(-1px);
  color: var(--accent-deep);
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 34px;
  align-items: center;
}

.hero-copy h2 {
  font-size: clamp(2.6rem, 5vw, 5rem);
  max-width: 10ch;
  margin-bottom: 18px;
}

.hero-text,
.family-card p,
.memory-card p,
.journal-card p,
.rhythm-card p,
.dialog-copy p {
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.button,
.filter-chip,
.dialog-close {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}

.button:hover,
.button:focus-visible,
.filter-chip:hover,
.filter-chip:focus-visible,
.dialog-close:hover,
.dialog-close:focus-visible {
  transform: translateY(-2px);
}

.button-primary {
  color: #fffaf2;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 24px rgba(184, 92, 56, 0.28);
}

.button-secondary,
.dialog-close {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(84, 57, 35, 0.08);
}

.hero-collage {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.polaroid {
  position: relative;
  padding: 18px 18px 22px;
  border-radius: 12px;
  background: #fffdf8;
  box-shadow: 0 22px 36px rgba(69, 45, 28, 0.14);
  transform-origin: top center;
}

.polaroid-large {
  grid-row: span 2;
  transform: rotate(-3deg);
}

.sunset {
  transform: rotate(4deg);
}

.meadow {
  transform: rotate(-5deg) translateY(-12px);
}

.pin {
  position: absolute;
  top: 10px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.polaroid-photo,
.memory-photo,
.dialog-photo {
  border-radius: 8px;
  min-height: 210px;
  background-size: cover;
  background-position: center;
}

.sunrise .polaroid-photo {
  min-height: 290px;
}

.sunrise .polaroid-photo,
.memory-photo.sunrise,
.dialog-photo.sunrise {
  background-image:
    linear-gradient(180deg, rgba(31, 28, 35, 0.1), rgba(31, 28, 35, 0.24)),
    linear-gradient(140deg, #f6c88f, #ef8f60 38%, #6a7da6 100%);
}

.sunset .polaroid-photo,
.memory-photo.sunset,
.dialog-photo.sunset {
  background-image:
    linear-gradient(180deg, rgba(31, 28, 35, 0.1), rgba(31, 28, 35, 0.24)),
    linear-gradient(140deg, #f5df93, #dd8054 42%, #758b6f 100%);
}

.meadow .polaroid-photo,
.memory-photo.meadow,
.dialog-photo.meadow {
  background-image:
    linear-gradient(180deg, rgba(31, 28, 35, 0.08), rgba(31, 28, 35, 0.22)),
    linear-gradient(140deg, #b9d59a, #6f9c7a 46%, #c5a86f 100%);
}

.indoors .memory-photo,
.dialog-photo.indoors {
  background-image:
    linear-gradient(180deg, rgba(31, 28, 35, 0.08), rgba(31, 28, 35, 0.22)),
    linear-gradient(145deg, #ebcba4, #d38c64 50%, #8c6c5a 100%);
}

.celebration .memory-photo,
.dialog-photo.celebration {
  background-image:
    linear-gradient(180deg, rgba(31, 28, 35, 0.08), rgba(31, 28, 35, 0.22)),
    linear-gradient(140deg, #fee08f, #ef9467 43%, #7a8fd3 100%);
}

.polaroid h3,
.family-card h3,
.memory-card h3,
.journal-card h3,
.rhythm-card h3 {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.polaroid p,
.memory-card p {
  margin: 0;
}

.section {
  margin-top: 22px;
  padding: 28px;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

.intro-band {
  background:
    linear-gradient(120deg, rgba(255, 248, 240, 0.92), rgba(236, 227, 214, 0.86)),
    var(--surface);
}

.intro-grid,
.family-grid,
.rhythm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.intro-grid article,
.family-card,
.memory-card,
.journal-card,
.rhythm-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 247, 0.78);
  box-shadow: 0 16px 32px rgba(68, 47, 28, 0.08);
}

.intro-grid article,
.family-card,
.rhythm-card {
  padding: 24px;
}

.family-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.family-badge {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(142, 166, 127, 0.18);
  color: #4d6341;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.memory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-chip {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(84, 57, 35, 0.08);
}

.filter-chip.is-active {
  color: #fff8f0;
  background: var(--ink);
  box-shadow: 0 12px 22px rgba(47, 36, 29, 0.18);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.memory-card,
.journal-card {
  overflow: hidden;
}

.memory-photo {
  min-height: 220px;
}

.memory-copy,
.journal-copy {
  padding: 22px;
}

.memory-card button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.memory-card button:hover .memory-copy h3,
.memory-card button:focus-visible .memory-copy h3 {
  color: var(--accent-deep);
}

.memory-meta,
.journal-meta,
.dialog-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.journal-list {
  display: grid;
  gap: 18px;
}

.journal-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
}

.journal-date {
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at top, rgba(184, 92, 56, 0.14), transparent 58%),
    rgba(255, 248, 239, 0.95);
}

.journal-date strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 24px 28px;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

.memory-dialog {
  width: min(760px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: #fffaf3;
  box-shadow: 0 32px 80px rgba(30, 18, 10, 0.35);
}

.memory-dialog::backdrop {
  background: rgba(33, 25, 20, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
}

.dialog-photo {
  min-height: 310px;
  border-radius: 0;
}

.dialog-copy {
  padding: 28px;
}

@media (max-width: 1024px) {
  .hero-content,
  .family-grid,
  .memory-grid,
  .rhythm-grid,
  .intro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-content {
    align-items: start;
  }

  .hero-collage {
    grid-template-columns: 1fr 1fr;
  }

  .polaroid-large {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    margin: 10px auto 24px;
  }

  .hero,
  .section,
  .site-footer {
    border-radius: 24px;
  }

  .hero,
  .section {
    padding: 22px 18px;
  }

  .topbar,
  .site-footer,
  .hero-content,
  .family-grid,
  .memory-grid,
  .rhythm-grid,
  .intro-grid,
  .journal-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    justify-content: start;
  }

  .topbar-links {
    gap: 12px 18px;
  }

  .hero-copy h2 {
    max-width: none;
  }

  .hero-collage {
    grid-template-columns: 1fr;
  }

  .journal-card {
    display: block;
  }

  .journal-date {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .memory-dialog {
    width: calc(100% - 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .topbar-links a,
  .button,
  .filter-chip,
  .dialog-close {
    transition: none;
  }
}
