/* ============================================================
   KINGDOM — Community Inspiration Gallery
   Builds on kingdom.css + home.css tokens.
   ============================================================ */

/* ---------- Page intro ---------- */
.gal-intro {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(200,161,90,0.07), transparent 60%),
    var(--ivory);
  padding: 112px 0 56px;
  text-align: center;
}
.gal-intro .wrap { max-width: 760px; }
.gal-intro .eyebrow { display: block; }
.gal-intro h1 {
  font-size: clamp(38px, 4.6vw, 64px);
  line-height: 1.06;
  margin-top: 16px;
}
.gal-intro .lede {
  margin: 22px auto 0;
  max-width: 600px;
  color: var(--charcoal);
  font-size: 18px;
}
.gal-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-top: 38px;
  flex-wrap: wrap;
}
.gal-stat { text-align: center; padding: 0 36px; }
.gal-stat:not(:first-child) { border-left: 1px solid var(--line); }
.gal-stat b {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  color: var(--emerald);
  line-height: 1;
}
.gal-stat span {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-text);
}

/* ---------- Toolbar (filters + sort) ---------- */
.gal-toolbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247,242,236,0.86);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.gal-toolbar-inner {
  display: flex;
  align-items: flex-start;
  gap: 14px 22px;
  padding-top: 16px;
  padding-bottom: 16px;
  flex-wrap: wrap;
}
.gal-filters {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex: 1 1 540px;
  min-width: 0;
  flex-wrap: wrap;
}
.gal-fgroup { display: flex; align-items: center; gap: 10px 8px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.gal-fgroup > .gal-flabel {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal);
  opacity: .65;
  margin-right: 2px;
}
.gal-chip {
  flex: 0 0 auto;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--charcoal);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 7px 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.gal-chip:hover { border-color: var(--gold); color: var(--gold-deep); }
.gal-chip.active {
  background: var(--emerald);
  border-color: var(--emerald);
  color: var(--gold-soft);
}
.gal-divider { width: 1px; height: 26px; background: var(--line); flex: 0 0 auto; align-self: center; }

.gal-sort { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: auto; }
.gal-sort label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal);
  opacity: .65;
}
.gal-select {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--emerald);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 34px 8px 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8823F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.gal-select:hover { border-color: var(--gold); }

/* ---------- Grid ---------- */
.gal-section { padding: 44px 0 100px; background: var(--ivory); }
.gal-count {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin-bottom: 26px;
}
.gal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
}
.gal-empty {
  display: none;
  text-align: center;
  padding: 80px 0;
  color: var(--charcoal);
}
.gal-empty h3 { font-size: 26px; margin-bottom: 10px; }

/* ---------- Card ---------- */
.g-card {
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s ease;
  opacity: 0;
  transform: translateY(14px);
}
.g-card.in { opacity: 1; transform: none; }
.g-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.g-media {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--beige-soft);
}
.g-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.g-card:hover .g-media img { transform: scale(1.045); }

/* love button overlay */
.g-love {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 10px;
  border: none;
  border-radius: 100px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 3px 12px rgba(15,31,27,0.14);
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  backdrop-filter: blur(4px);
  transition: transform .18s ease, background .2s ease;
}
.g-love:hover { transform: scale(1.06); }
.g-love:active { transform: scale(.94); }
.g-love svg { width: 17px; height: 17px; display: block; transition: transform .2s ease; }
.g-love .heart-o { stroke: #8a8480; fill: none; stroke-width: 1.7; }
.g-love .heart-f { display: none; fill: #C0392B; }
.g-love.loved .heart-o { display: none; }
.g-love.loved .heart-f { display: block; }
.g-love.loved { color: #C0392B; }
.g-love.pop svg { animation: lovePop .42s cubic-bezier(.2,.8,.2,1); }
@keyframes lovePop {
  0% { transform: scale(1); }
  35% { transform: scale(1.42); }
  60% { transform: scale(.86); }
  100% { transform: scale(1); }
}

.g-info { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.g-info h3 { font-size: 19px; line-height: 1.2; }
.g-spec { font-size: 12.5px; color: var(--charcoal); letter-spacing: 0.01em; }
.g-by {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11.5px;
  color: var(--charcoal);
}
.g-ava {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--beige); color: var(--emerald);
  font-weight: 700; font-size: 9.5px; letter-spacing: 0.02em;
  flex: 0 0 auto;
}
.g-by .dot { opacity: .45; }

/* load-more */
.gal-more { text-align: center; margin-top: 56px; }

/* ---------- Detail modal ---------- */
.g-modal[hidden] { display: none; }
.g-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.g-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,23,20,0.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s ease;
}
.g-modal.open .g-modal-backdrop { opacity: 1; }
.g-modal-card {
  position: relative;
  z-index: 1;
  width: min(940px, 100%);
  max-height: 90vh;
  overflow: hidden;
  background: var(--ivory-warm);
  border-radius: 14px;
  box-shadow: 0 40px 100px rgba(10,23,20,0.5);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  transform: translateY(18px) scale(.98);
  opacity: 0;
  transition: transform .34s cubic-bezier(.2,.7,.2,1), opacity .34s ease;
}
.g-modal.open .g-modal-card { transform: none; opacity: 1; }
.g-modal-media {
  position: relative;
  background: var(--beige-soft);
  min-height: 380px;
}
.g-modal-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 3px 12px rgba(15,31,27,0.18);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 3;
  transition: transform .18s ease;
}
.g-modal-close:hover { transform: rotate(90deg); }
.g-modal-close svg { width: 18px; height: 18px; stroke: var(--emerald); }

.g-modal-body {
  padding: 40px 40px 36px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.g-modal-body .eyebrow { margin-bottom: 12px; }
.g-modal-body h2 { font-size: 30px; line-height: 1.12; }
.g-modal-spec { margin-top: 12px; color: var(--gold-text); font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.g-modal-desc { margin-top: 16px; font-family: var(--serif-2, Georgia, serif); font-style: italic; font-size: 19px; line-height: 1.5; color: var(--emerald); text-wrap: pretty; }
.g-modal-meta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.g-modal-loves {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 14px;
  color: #C0392B;
}
.g-modal-loves svg { width: 19px; height: 19px; fill: #C0392B; }

.g-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.g-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-deep);
  border: 1px solid var(--line-gold);
  border-radius: 100px;
  padding: 6px 13px;
}
.g-modal-actions { margin-top: auto; padding-top: 30px; display: flex; flex-direction: column; gap: 12px; }
.g-modal-actions .btn { width: 100%; }
.g-modal-note {
  margin-top: 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--charcoal);
  opacity: .8;
  display: flex;
  gap: 8px;
}
.g-modal-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; stroke: var(--gold); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .gal-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 880px) {
  .g-modal-card { grid-template-columns: 1fr; max-height: 92vh; }
  .g-modal-media { min-height: 280px; max-height: 42vh; }
}
@media (max-width: 760px) {
  .gal-grid { grid-template-columns: repeat(2, 1fr); }
  .gal-intro { padding: 56px 0 44px; }
  .gal-chip { padding: 12px 17px; }
  .g-love { height: 40px; padding: 0 14px 0 12px; }
  .gal-stat { padding: 0 26px; }  /* Filters stack as full-width groups whose chips wrap — no horizontal overflow,
     no collision with the screen edge. Bar is non-sticky here so height is fine. */
  /* Mobile: big header scrolls away; a slim glass filter bar pins in its place */
  .site-header { position: static; }
  .gal-toolbar { position: sticky; top: 0; z-index: 45; background: rgba(247,242,236,0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .gal-toolbar-inner { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 10px; padding-top: 11px; padding-bottom: 11px; }
  .gal-filters { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; padding: 2px 2px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent); }
  .gal-filters::-webkit-scrollbar { display: none; }
  .gal-fgroup { flex: 0 0 auto; flex-wrap: nowrap; align-items: center; gap: 8px; }
  .gal-fgroup > .gal-flabel { display: none; }
  .gal-divider { display: none; }
  .gal-sort { flex: 0 0 auto; margin-left: 2px; gap: 0; padding-left: 12px; border-left: 1px solid var(--line); }
  .gal-sort label { display: none; }
  .gal-select { flex: 0 0 auto; min-width: 0; padding: 9px 30px 9px 13px; font-size: 12.5px; }
  .gal-chip { padding: 11px 16px; }
  .g-info h3 { font-size: 17px; }
}
@media (max-width: 460px) {
  .gal-intro { padding: 34px 0 36px; }
  .gal-grid { grid-template-columns: 1fr; gap: 18px; }
  .g-info { padding: 18px 18px 18px; }
  .g-info h3 { font-size: 21px; }
  .g-spec { font-size: 12.5px; }
  .g-by { font-size: 12px; }
  .g-modal-body { padding: 26px 22px 24px; }
  .g-modal-body h2 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .g-card { opacity: 1; transform: none; transition: none; }
  .g-media img, .g-card, .g-love svg { transition: none; }
  .g-love.pop svg { animation: none; }
}
