:root {
  --cream: #FFF8E7;
  --cream-dark: #F5EBD0;
  --coral: #FF6B6B;
  --sunshine: #FFD93D;
  --grass: #6BCB77;
  --sky: #4D96FF;
  --orange: #FF8C42;
  --lilac: #C77DFF;
  --outline: #3D2914;
  --ink: #2A2A2A;
  --muted: #7A6A55;
  --card: #FFFCF3;
  --shadow: rgba(61, 41, 20, 0.12);
  --radius: 18px;
  --font: "Segoe UI", "Nunito", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 217, 61, 0.18), transparent 35%),
    radial-gradient(circle at 88% 12%, rgba(77, 150, 255, 0.14), transparent 32%),
    radial-gradient(circle at 70% 80%, rgba(199, 125, 255, 0.12), transparent 40%),
    radial-gradient(circle at 20% 90%, rgba(107, 203, 119, 0.12), transparent 35%),
    var(--cream);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--sky); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--coral); }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* Wobbly scrapbook titles */
.wobble {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--outline);
  text-shadow:
    2px 2px 0 rgba(255, 217, 61, 0.55),
    -1px 1px 0 rgba(255, 107, 107, 0.25);
  transform: rotate(-1.2deg);
  display: inline-block;
}

.wobble.alt { transform: rotate(1deg); }
.wobble.sm { transform: rotate(-0.6deg); font-size: clamp(1.4rem, 3vw, 1.9rem); }

/* Nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(255, 248, 231, 0.86);
  border-bottom: 3px dashed rgba(61, 41, 20, 0.15);
}
.topnav .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}
.brand {
  font-weight: 800;
  color: var(--outline);
  text-decoration: none;
  transform: rotate(-1deg);
}
.brand span { color: var(--coral); }
.navlinks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.navlinks a {
  text-decoration: none;
  color: var(--outline);
  background: var(--card);
  border: 2px solid rgba(61, 41, 20, 0.18);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.navlinks a:hover {
  background: var(--sunshine);
  border-color: var(--outline);
}

/* Hero */
.hero {
  padding: 1.75rem 0 1rem;
}
.hero-banner {
  border: 4px solid var(--outline);
  border-radius: 28px;
  overflow: hidden;
  box-shadow:
    8px 8px 0 rgba(255, 107, 107, 0.35),
    0 18px 40px var(--shadow);
  background: var(--cream-dark);
  transform: rotate(-0.4deg);
}
.hero-banner img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.hero-copy {
  margin-top: 1.35rem;
  display: grid;
  gap: 0.75rem;
  max-width: 46rem;
}
.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.1;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}
.credit {
  display: inline-block;
  background: #fff;
  border: 2.5px dashed var(--coral);
  border-radius: 14px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  color: var(--outline);
  transform: rotate(0.8deg);
  box-shadow: 3px 3px 0 rgba(255, 140, 66, 0.35);
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--card);
  border: 2px solid rgba(61, 41, 20, 0.16);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.chip.count { background: #E8FFF0; border-color: var(--grass); }
.chip.muted { color: var(--muted); font-weight: 600; }
.chip.coral { background: #FFE4E4; border-color: var(--coral); }
.chip.sky { background: #E5F0FF; border-color: var(--sky); }

/* Sections */
section.block {
  padding: 2.2rem 0 1.2rem;
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
}
.section-head p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  max-width: 36rem;
}
.section-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.panel {
  background: rgba(255, 252, 243, 0.85);
  border: 3px solid rgba(61, 41, 20, 0.18);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 5px 5px 0 rgba(61, 41, 20, 0.08);
}

/* Style bible */
.bible-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.1rem;
  align-items: start;
}
@media (max-width: 820px) {
  .bible-grid { grid-template-columns: 1fr; }
}
.swatch-frame {
  border: 3px solid var(--outline);
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  transform: rotate(-1deg);
  box-shadow: 6px 6px 0 rgba(199, 125, 255, 0.28);
}
.swatch-frame img { width: 100%; }
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.8rem 0 1rem;
}
.swatch {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  border: 3px solid var(--outline);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.08);
  position: relative;
}
.swatch span {
  position: absolute;
  left: 50%;
  bottom: -1.35rem;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.rules { margin: 0; padding-left: 1.1rem; }
.rules li { margin: 0.35rem 0; }

/* Gallery grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--card);
  border: 3px solid rgba(61, 41, 20, 0.16);
  border-radius: 16px;
  padding: 0.55rem;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-3px) rotate(-0.5deg);
  box-shadow: 5px 5px 0 rgba(255, 140, 66, 0.25);
}
.card .thumb {
  aspect-ratio: 1;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #f0e6c8 25%, transparent 25%),
    linear-gradient(-45deg, #f0e6c8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0e6c8 75%),
    linear-gradient(-45deg, transparent 75%, #f0e6c8 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #fff;
  border: 2px dashed rgba(61, 41, 20, 0.15);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  padding: 0.35rem;
}
.card .fname {
  margin: 0.45rem 0 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--outline);
  word-break: break-all;
  text-align: center;
}
.card.generating {
  opacity: 0.78;
  border-style: dashed;
}
.placeholder {
  color: var(--muted);
  gap: 0.25rem;
  text-align: center;
  font-weight: 700;
}
.placeholder .dots {
  font-size: 1.8rem;
  color: var(--lilac);
  line-height: 1;
}
.placeholder .label { font-size: 0.78rem; }

/* Tips / download */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}
.tip {
  background: #fff;
  border: 3px solid rgba(61, 41, 20, 0.16);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  border-top: 6px solid var(--sky);
}
.tip:nth-child(2) { border-top-color: var(--grass); }
.tip:nth-child(3) { border-top-color: var(--orange); }
.tip:nth-child(4) { border-top-color: var(--lilac); }
.tip h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: var(--outline);
}
.tip p, .tip code, .tip li {
  font-size: 0.92rem;
  color: var(--ink);
}
.tip code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--cream-dark);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  font-size: 0.85em;
}
.tip ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

footer {
  margin: 2rem 0 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
footer .stamp {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 2.5px solid var(--outline);
  border-radius: 12px;
  background: var(--sunshine);
  color: var(--outline);
  font-weight: 800;
  transform: rotate(-2deg);
}

.tape {
  display: inline-block;
  background: rgba(255, 217, 61, 0.55);
  padding: 0.15rem 0.7rem;
  transform: rotate(-2deg);
  font-weight: 800;
  font-size: 0.78rem;
  color: var(--outline);
  margin-bottom: 0.35rem;
}
