/* ============================================================
   WEEZGO — Theme Gallery
   Inherits design tokens from styles.css
   ============================================================ */

body.gallery { background: var(--bg); }

/* ---------- Sticky header w/ progress ---------- */
.gh {
  position: sticky; top: 0; z-index: 90; background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.gh-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 24px; }
.gh-left { display: flex; align-items: center; gap: 14px; }
.gh-left .divider { width: 1px; height: 26px; background: var(--border); }
.gh-left .crumb { font-size: 15px; font-weight: 600; color: var(--muted); }

/* progress steps */
.steps-mini { display: flex; align-items: center; gap: 6px; }
.smini { display: flex; align-items: center; gap: 9px; }
.smini .dot {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: #fff; border: 1.5px solid var(--border); color: var(--muted);
}
.smini.on .dot { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(22,163,74,.32); }
.smini.done .dot { background: var(--green-100); color: var(--green-700); border-color: transparent; }
.smini .lbl { font-size: 14px; font-weight: 600; color: var(--muted); }
.smini.on .lbl { color: var(--ink); }
.smini .bar { width: 30px; height: 2px; background: var(--border); border-radius: 2px; margin: 0 4px; }
@media (max-width: 880px) { .smini .lbl, .smini .bar { display: none; } }

.gh-right { display: flex; align-items: center; gap: 16px; }
.gh-right .save { font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- Gallery hero ---------- */
.g-hero { padding: 64px 0 40px; text-align: center; }
.g-hero h1 { font-size: 56px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; color: var(--ink); }
.g-hero p { font-size: 20px; color: var(--muted); max-width: 700px; margin: 18px auto 0; line-height: 1.65; }

/* ---------- Featured categories ---------- */
.cat-strip-head { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 20px; }
.cat-strip-head h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.cat-strip-head span { font-size: 14px; color: var(--muted); }
.cat-strip {
  display: flex; flex-wrap: nowrap; gap: 16px; overflow-x: auto; padding: 6px 2px 18px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.cat-strip::-webkit-scrollbar { display: none; }
.cat-tile {
  flex: 0 0 220px;
  height: 120px; border-radius: var(--radius); background: #fff; border: 1px solid var(--border);
  box-shadow: var(--sh-sm); padding: 18px 20px; cursor: pointer;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
  display: flex; flex-direction: column; justify-content: space-between;
}
.cat-tile:hover { transform: translateY(-4px) scale(1.03); box-shadow: var(--sh-md); border-color: var(--green-100); }
.cat-tile .emoji { width: 44px; height: 44px; border-radius: 12px; background: var(--green-50); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cat-tile h4 { font-size: 16px; font-weight: 700; color: var(--ink); }
.cat-tile .count { font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* ---------- Filter bar (sticky, floating) ---------- */
.filter-bar {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.05); padding: 22px 24px; margin: 8px 0 40px;
  position: sticky; top: 84px; z-index: 40;
}
.search-box { position: relative; margin-bottom: 18px; }
.search-box svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input {
  width: 100%; height: 56px; border-radius: 14px; border: 1px solid var(--border); background: #fff;
  padding: 0 18px 0 50px; font-family: inherit; font-size: 16px; color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.search-box input::placeholder { color: #9aa1ad; }
.search-box input:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(34,197,94,.12); }

.pills {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 10px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  padding: 9px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--body); transition: all .2s var(--ease); white-space: nowrap;
}
.pill:hover { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.pill.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(22,163,74,.28); }
.pill .n { opacity: .7; font-weight: 600; margin-left: 5px; }

/* ---------- Templates grid ---------- */
.grid-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 24px; }
.grid-head h2 { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; }
.grid-head .res { font-size: 15px; color: var(--muted); }
.grid-head .res b { color: var(--ink); font-weight: 700; }

.t-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
@media (max-width: 1024px) { .t-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .t-grid { grid-template-columns: 1fr; } }

.tpl {
  background: #fff; border: 1px solid var(--border); border-radius: 24px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.05); transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .25s;
  position: relative;
}
.tpl:hover { transform: translateY(-6px) scale(1.02); box-shadow: var(--sh-lg); }
.tpl.selected { border-color: var(--green-600); background: var(--green-50); box-shadow: 0 0 0 1px var(--green-600), var(--sh-md); }

.tpl-shot { position: relative; aspect-ratio: 16 / 10; }
.tpl-shot .ph { width: 100%; height: 100%; border: none; }
.tpl-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2; background: var(--green-100); color: var(--green-600);
  font-size: 13px; font-weight: 600; padding: 5px 13px; border-radius: 999px;
}
.tpl-check {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad); color: #fff; display: none; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(22,163,74,.4);
}
.tpl.selected .tpl-check { display: flex; }

/* hover overlay */
.tpl-overlay {
  position: absolute; inset: 0; z-index: 2; background: rgba(17,24,39,.65);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-direction: column;
  opacity: 0; transition: opacity .28s var(--ease); padding: 20px;
}
.tpl:hover .tpl-overlay { opacity: 1; }
.tpl-overlay .btn { width: 170px; max-width: 80%; }

.tpl-info { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tpl-info h3 { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.tpl-info .cat { font-size: 14px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.tpl-info .rate { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.tpl-info .rate svg { color: #FBBF24; }

/* recommended */
.reco { margin-top: 88px; }
.reco-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.reco-head .spark { width: 30px; height: 30px; border-radius: 9px; background: var(--green-50); color: var(--green-600); display: flex; align-items: center; justify-content: center; }
.reco-head h2 { font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; }
.reco-sub { font-size: 15px; color: var(--muted); margin-bottom: 24px; }

/* empty state */
.empty { display: none; text-align: center; padding: 80px 20px; }
.empty.show { display: block; }
.empty .illo {
  width: 120px; height: 120px; border-radius: 28px; margin: 0 auto 28px; background: #fff;
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: #cdd2d9; box-shadow: var(--sh-sm);
}
.empty h3 { font-size: 26px; font-weight: 800; color: var(--ink); }
.empty p { font-size: 17px; color: var(--muted); max-width: 420px; margin: 12px auto 26px; line-height: 1.6; }

/* ---------- Sticky bottom CTA bar ---------- */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80; background: #fff;
  border-top: 1px solid var(--border); box-shadow: 0 -10px 30px rgba(17,24,39,.07);
  transform: translateY(120%); transition: transform .4s var(--ease); padding: 16px 0;
}
.cta-bar.show { transform: none; }
.cta-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.cta-bar .picked { display: flex; align-items: center; gap: 14px; }
.cta-bar .picked .thumb { width: 56px; height: 40px; border-radius: 9px; flex: none; border: none; }
.cta-bar .picked small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.cta-bar .picked strong { font-size: 17px; font-weight: 700; color: var(--ink); }
.cta-bar .right { display: flex; align-items: center; gap: 16px; }
.cta-bar .change { font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.cta-bar .change:hover { color: var(--green-600); }
@media (max-width: 600px) { .cta-bar .picked small { display: none; } .cta-bar .change { display: none; } }

/* ---------- Preview modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 120; background: rgba(17,24,39,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 28px;
  opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility .3s;
}
.modal-scrim.show { opacity: 1; visibility: visible; }
.modal {
  background: #fff; border-radius: 24px; width: min(1400px, 100%); height: 90vh; max-height: 900px;
  display: grid; grid-template-columns: 1fr 340px; overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.4);
  transform: scale(.94); transition: transform .3s var(--ease);
}
.modal-scrim.show .modal { transform: scale(1); }
@media (max-width: 900px) { .modal { grid-template-columns: 1fr; } .modal-side { display: none; } }

/* ---------- Gallery — iPad portrait (≤ 820px) ---------- */
@media (max-width: 820px) {
  .g-hero { padding: 44px 0 28px; }
  .g-hero h1 { font-size: 40px; letter-spacing: -1px; }
  .g-hero p  { font-size: 17px; }
  .grid-head h2 { font-size: 22px; }
  .reco-head h2 { font-size: 22px; }
}

/* ---------- Gallery — mobile (≤ 600px) ---------- */
@media (max-width: 600px) {
  /* 1 — Hide progress stepper + step counter */
  .steps-mini { display: none; }
  .gh-right   { display: none; }

  /* 2 — Tighter hero + smaller titles */
  .g-hero     { padding: 28px 0 18px; }
  .g-hero h1  { font-size: 26px; letter-spacing: -0.5px; }
  .g-hero p   { font-size: 15px; margin-top: 10px; }
  .cat-strip-head h2 { font-size: 17px; }
  .grid-head h2      { font-size: 18px; }
  .reco-head h2      { font-size: 18px; }

  /* 3 — Category subtitle can break to next row */
  .cat-strip-head { flex-wrap: wrap; gap: 4px; }

  /* 6 — Result count on its own row */
  .grid-head { flex-wrap: wrap; }
  .grid-head .res { flex: 0 0 100%; }
}

.modal-stage { background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.modal-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px; border-bottom: 1px solid var(--border); background: #fff; }
.modal-toolbar .mt-left { display: flex; align-items: center; gap: 10px; }
.modal-toolbar .badge { background: var(--green-100); color: var(--green-600); font-size: 13px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.modal-toolbar h3 { font-size: 18px; font-weight: 700; color: var(--ink); }
.device-seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 2px; }
.device-seg button { width: 38px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: all .2s; }
.device-seg button.on { background: #fff; color: var(--green-600); box-shadow: var(--sh-sm); }
.modal-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center; transition: background .2s; }
.modal-close:hover { background: #eceef1; }

.modal-viewport { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 28px; }
.device-shell { transition: width .4s var(--ease); width: 100%; }
.device-shell .browser { box-shadow: var(--sh-lg); }
.device-shell .ph { border: none; }
.device-shell .shot { aspect-ratio: 16/10; }
.device-shell.tablet { width: 620px; }
.device-shell.mobile { width: 320px; }
.device-shell.mobile .shot { aspect-ratio: 9/16; }
.device-shell.tablet .shot { aspect-ratio: 4/3; }

.modal-side { padding: 28px; display: flex; flex-direction: column; overflow-y: auto; }
.modal-side .ms-cat { font-size: 14px; font-weight: 600; color: var(--green-600); }
.modal-side h2 { font-size: 26px; font-weight: 800; color: var(--ink); margin: 4px 0 8px; letter-spacing: -.5px; }
.modal-side .ms-desc { font-size: 15px; color: var(--body); line-height: 1.6; margin-bottom: 22px; }
.ms-section-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 18px 0 12px; }
.ms-feats { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.ms-feats li { display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 500; color: var(--ink); }
.ms-feats .ic { width: 22px; height: 22px; border-radius: 50%; background: var(--green-100); color: var(--green-700); display: flex; align-items: center; justify-content: center; flex: none; }
.ms-pages { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-pages span { font-size: 13px; font-weight: 600; color: var(--body); background: var(--bg); border: 1px solid var(--border); padding: 5px 12px; border-radius: 8px; }
.modal-side .ms-actions { margin-top: auto; padding-top: 24px; display: flex; gap: 12px; }
.modal-side .ms-actions .btn { flex: 1; }
