@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  color-scheme: light;
  font-family: Nunito, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fdf6ec;
  color: #3a2e26;

  --paper: #fdf6ec;
  --paper-deep: #f7ecd9;
  --ink: #3a2e26;
  --ink-soft: #6b5a4d;
  --ink-muted: #8a7a6d;
  --border: #e4d5bd;
  --border-strong: #d8c4a2;
  --surface: #fffdf8;
  --surface-muted: #f7ecd9;

  --hand: "Patrick Hand", cursive;

  /* pastel palette, cycled by category */
  --p1: #ffd166;
  --p1-ink: #8a5a00;
  --p2: #8ee3c8;
  --p2-ink: #0f6b52;
  --p3: #ffadc6;
  --p3-ink: #9c2f52;
  --p4: #c3b1f0;
  --p4-ink: #5b3fa0;
  --p5: #9ecbff;
  --p5-ink: #2b5f9c;
  --p6: #ffb787;
  --p6-ink: #a15318;

  --brand: #ff8c42;
  --brand-dark: #e56b1f;

  --shadow-sm: 0 2px 0 rgba(58, 46, 38, 0.08);
  --shadow-md: 6px 8px 0 rgba(58, 46, 38, 0.07);
  --shadow-lg: 10px 12px 0 rgba(58, 46, 38, 0.09);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 1px 1px, rgba(58, 46, 38, 0.05) 1px, transparent 0) 0 0 / 22px 22px,
    var(--paper);
  display: flex;
  flex-direction: column;
}

body > * {
  min-width: 0;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  min-width: 0;
  box-sizing: border-box;
}

/* Navbar */

.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(253, 246, 236, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 2px dashed var(--border-strong);
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--hand);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.01em;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  transform: rotate(-4deg);
}

.navbar-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.82rem;
  color: var(--ink-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.navbar-meta strong {
  color: var(--brand-dark);
  font-weight: 800;
}

@media (max-width: 560px) {
  .navbar-inner {
    padding: 12px 16px;
  }

  .brand {
    font-size: 1.2rem;
  }

  .navbar-meta {
    gap: 10px;
    font-size: 0.72rem;
  }
}

/* Page shell */

main.page {
  flex: 1;
  padding: 40px 0 64px;
}

/* Hero */

.hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
  min-width: 0;
}

.hero h1,
.hero p {
  overflow-wrap: break-word;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: #ffe8d1;
  border: 1px dashed var(--brand);
  border-radius: 999px;
  padding: 4px 12px;
  width: fit-content;
}

.hero h1 {
  margin: 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 3rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.hero p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 640px;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.breadcrumb-trail a {
  color: var(--brand-dark);
  text-decoration: none;
  font-weight: 700;
}

.breadcrumb-trail a:hover {
  text-decoration: underline;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
}

.stat-pill:nth-of-type(2) {
  border-color: var(--p3-ink);
}

.stat-pill strong {
  font-size: 1.05rem;
  color: var(--brand-dark);
}

.stat-pill span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Category nav (chip list, capped height with scroll) */

.category-nav-wrap {
  margin-bottom: 32px;
}

.category-nav-label {
  font-family: var(--hand);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 96px;
  overflow-y: auto;
  padding-right: 4px;
}

.category-nav a,
.category-nav span.active {
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.category-nav a:hover {
  background: #ffe8d1;
  border-color: var(--brand);
  transform: translateY(-1px);
}

.category-nav span.active {
  background: var(--brand);
  border-color: var(--brand-dark);
  color: #ffffff;
  font-weight: 800;
}

/* Category grid (homepage) */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px;
}

@media (max-width: 900px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}

.category-card {
  display: block;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.category-card:nth-child(6n+1) { border-color: var(--p1-ink); }
.category-card:nth-child(6n+2) { border-color: var(--p2-ink); }
.category-card:nth-child(6n+3) { border-color: var(--p3-ink); }
.category-card:nth-child(6n+4) { border-color: var(--p4-ink); }
.category-card:nth-child(6n+5) { border-color: var(--p5-ink); }
.category-card:nth-child(6n+6) { border-color: var(--p6-ink); }

.category-card:hover {
  transform: translateY(-4px) rotate(-0.6deg);
  box-shadow: var(--shadow-lg);
}

.category-card .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-muted);
}

.category-card:nth-child(6n+1) .thumb { background: color-mix(in srgb, var(--p1) 35%, var(--surface-muted)); }
.category-card:nth-child(6n+2) .thumb { background: color-mix(in srgb, var(--p2) 35%, var(--surface-muted)); }
.category-card:nth-child(6n+3) .thumb { background: color-mix(in srgb, var(--p3) 35%, var(--surface-muted)); }
.category-card:nth-child(6n+4) .thumb { background: color-mix(in srgb, var(--p4) 35%, var(--surface-muted)); }
.category-card:nth-child(6n+5) .thumb { background: color-mix(in srgb, var(--p5) 35%, var(--surface-muted)); }
.category-card:nth-child(6n+6) .thumb { background: color-mix(in srgb, var(--p6) 35%, var(--surface-muted)); }

.category-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.category-card:hover img {
  transform: scale(1.06) rotate(0.8deg);
}

.category-card .count-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--ink);
  color: #fffdf8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.category-card .info {
  padding: 14px 16px 16px;
  border-top: 2px dashed var(--border);
}

.category-card h3 {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--ink);
}

/* Image gallery (category page) */

.gallery {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}

@media (max-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 560px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.card:nth-child(6n+1):hover { border-color: var(--p1-ink); }
.card:nth-child(6n+2):hover { border-color: var(--p2-ink); }
.card:nth-child(6n+3):hover { border-color: var(--p3-ink); }
.card:nth-child(6n+4):hover { border-color: var(--p4-ink); }
.card:nth-child(6n+5):hover { border-color: var(--p5-ink); }
.card:nth-child(6n+6):hover { border-color: var(--p6-ink); }

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px) rotate(-0.4deg);
}

.card-thumb-link {
  display: block;
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--surface-muted);
}

.card .info {
  padding: 12px 14px 14px;
}

.card h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.card-title-link {
  color: var(--ink);
  text-decoration: none;
}

.card-title-link:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--p2);
  color: var(--p2-ink);
}

.tag:nth-of-type(6n+1) { background: var(--p1); color: var(--p1-ink); }
.tag:nth-of-type(6n+2) { background: var(--p2); color: var(--p2-ink); }
.tag:nth-of-type(6n+3) { background: var(--p3); color: var(--p3-ink); }
.tag:nth-of-type(6n+4) { background: var(--p4); color: var(--p4-ink); }
.tag:nth-of-type(6n+5) { background: var(--p5); color: var(--p5-ink); }
.tag:nth-of-type(6n+6) { background: var(--p6); color: var(--p6-ink); }

/* Rating */

.rating {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--border);
  min-width: 0;
}

.stars {
  display: flex;
  gap: 1px;
}

.star {
  background: none;
  border: none;
  padding: 2px;
  font-size: 1.1rem;
  line-height: 1;
  color: #ddd0ba;
  cursor: pointer;
  transition: color 0.1s ease, transform 0.1s ease;
}

.star:hover,
.star.hovered {
  color: var(--brand);
  transform: scale(1.15) rotate(-6deg);
}

.star.filled {
  color: var(--brand);
}

.rating-summary {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating.rated .star.filled {
  color: var(--brand-dark);
}

/* Detail page (single image) */

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 32px;
  margin: 20px 0 40px;
  align-items: start;
}

@media (max-width: 860px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.detail-image {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  padding: 10px;
}

.detail-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.detail-title {
  margin: 0;
  font-family: var(--hand);
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1.15;
  color: var(--ink);
}

.detail-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.5;
}

.detail-tags .tag {
  font-size: 0.78rem;
  padding: 4px 12px;
}

.detail-info .rating {
  border-top: none;
  padding-top: 4px;
  margin-top: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-top: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--brand);
  border: 2px solid var(--brand-dark);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-back:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.related-section {
  margin-top: 12px;
}

/* Pagination */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 2px dashed var(--border-strong);
}

.pagination a,
.pagination span {
  min-width: 38px;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink-soft);
}

.pagination a {
  background: var(--surface);
  border: 2px solid var(--border-strong);
}

.pagination a:hover {
  background: #ffe8d1;
  border-color: var(--brand);
  color: var(--brand-dark);
}

.pagination span.active {
  background: var(--brand);
  border: 2px solid var(--brand-dark);
  color: #ffffff;
}

.pagination span.disabled {
  color: #d8c4a2;
}

/* Footer */

.site-footer {
  border-top: 2px dashed var(--border-strong);
  background: var(--paper-deep);
  padding: 28px 0;
  margin-top: auto;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--brand-dark);
}

.footer-links {
  display: flex;
  gap: 18px;
}

/* 404 */

.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-state h1 {
  font-family: var(--hand);
  font-size: 2.2rem;
  font-weight: 400;
  margin-bottom: 8px;
}

.empty-state a {
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
}

.empty-state a:hover {
  text-decoration: underline;
}
