:root {
  --terra: #c4552d;
  --terra-dark: #a03f1e;
  --cream: #faf6ef;
  --card: #ffffff;
  --ink: #2d2419;
  --muted: #8a7d6d;
  --line: #eadfd0;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 40, 20, .08);
  --shadow-lg: 0 12px 32px rgba(60, 40, 20, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Assistant', sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
}

h1, h2, h3, .chip, .badge { font-family: 'Heebo', sans-serif; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, #d96b35 0%, var(--terra) 55%, #9c3d1c 100%);
  color: #fff;
  padding: 56px 20px 84px;
  text-align: center;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute; inset: auto 0 -1px 0;
  height: 42px; background: var(--cream);
  border-radius: 42px 42px 0 0;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.logo { font-size: 52px; }
.hero h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -.5px; }
.tagline { opacity: .92; font-size: 17px; margin-top: 4px; }

.search-wrap { margin-top: 26px; }
#search {
  width: 100%; max-width: 520px;
  padding: 14px 22px;
  font-size: 16.5px; font-family: inherit;
  border: none; border-radius: 999px;
  outline: 3px solid transparent;
  box-shadow: var(--shadow-lg);
  transition: outline .15s;
}
#search:focus { outline-color: rgba(255,255,255,.45); }

.chips {
  margin-top: 18px;
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
}
.chip {
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  color: #fff; font-size: 14.5px; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: background .15s, transform .1s;
  backdrop-filter: blur(4px);
}
.chip:hover { background: rgba(255,255,255,.3); }
.chip.active { background: #fff; color: var(--terra-dark); }

/* ---------- Grid ---------- */
main { max-width: 1180px; margin: -10px auto 60px; padding: 0 20px; }

.count { text-align: center; color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

.card-img {
  aspect-ratio: 4/3;
  width: 100%;
  object-fit: cover;
  display: block;
  background: linear-gradient(135deg, #e8d9c5, #d9bfa0);
}
.card-noimg {
  aspect-ratio: 4/3;
  display: flex; align-items: center; justify-content: center;
  font-size: 54px;
  background: linear-gradient(135deg, #f3e7d6, #e5cfb4);
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.badge {
  align-self: flex-start;
  font-size: 12px; font-weight: 600;
  color: var(--terra-dark);
  background: #fbe9df;
  padding: 3px 11px; border-radius: 999px;
}
.card-title {
  font-size: 18px; font-weight: 800; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-excerpt {
  color: var(--muted); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Modal ---------- */
.overlay[hidden] { display: none !important; }
.overlay {
  position: fixed; inset: 0;
  background: rgba(30, 20, 10, .55);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal {
  background: var(--card);
  border-radius: 20px;
  max-width: 680px; width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  animation: pop .22s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

.close {
  position: sticky; top: 12px;
  margin-inline-start: calc(100% - 48px);
  width: 36px; height: 36px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--ink); font-size: 16px;
  cursor: pointer; z-index: 2;
  box-shadow: var(--shadow);
}
.modal-img { width: 100%; max-height: 340px; object-fit: cover; display: block; margin-top: -48px; }
.modal-body { padding: 22px 26px 30px; }
.modal-body h2 { font-size: 25px; font-weight: 800; margin-bottom: 4px; }
.modal-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.modal-text { white-space: pre-wrap; font-size: 15.5px; }
.modal-text::first-line { font-weight: 700; }

/* ---------- Footer / empty ---------- */
footer {
  text-align: center; color: var(--muted);
  font-size: 13.5px; padding: 26px 16px 34px;
}
.empty { text-align: center; color: var(--muted); font-size: 19px; padding: 70px 0; }

@media (max-width: 560px) {
  .hero { padding: 40px 14px 70px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .modal-body { padding: 18px 18px 24px; }
}
