/* =========================================================================
   VIVATECH — PREMIUM TEMPLATE MARKETPLACE
   Table of contents:
     1.  Reset & base
     2.  Design tokens (color, type, radius, motion)
     3.  Theme overrides (dark default / light)
     4.  Typography
     5.  Layout helpers
     6.  Buttons, badges, chips
     7.  Loader
     8.  Header (utility bar, navbar, mobile nav)
     9.  Hero (mesh, blobs, particles, constellation, stats)
     10. Section headers
     11. Category showcase
     12. Search bar + suggestions + filter chips
     13. Template cards + grids
     14. Load more
     15. Contact band
     16. Footer
     17. Back to top
     18. Modal
     19. Scroll reveal + keyframes
     20. Responsive
     21. Accessibility & reduced motion
   ========================================================================= */

/* ---------- 1. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: inherit; }
ul { list-style: none; }
svg { display: block; }

/* ---------- 2. Design tokens ---------- */
:root {
  --iris: #6C4CE0;
  --iris-light: #9B7BFF;
  --flame: #FF6B4A;
  --flame-deep: #E02900;
  --flame-text: #FF3F14;
  --gold: #FFB020;

  /* Category gradients: every pair is verified to hold >=4.5:1 contrast
     against white text/icons across its ENTIRE span (not just endpoints),
     so badges and thumbnail icons stay legible in both themes. */
  --grad-violet-1: #4C26D9;  --grad-violet-2: #2C04A9;
  --grad-blue-1: #1256DE;    --grad-blue-2: #04189F;
  --grad-teal-1: #096764;    --grad-teal-2: #198078;
  --grad-amber-1: #CC2900;   --grad-amber-2: #8F5F00;
  --grad-sky-1: #084472;     --grad-sky-2: #0078AD;
  --grad-emerald-1: #095D44; --grad-emerald-2: #16793A;
  --grad-medical-1: #0A5C53; --grad-medical-2: #107E6D;
  --grad-pink-1: #5A13D2;    --grad-pink-2: #940F51;
  --grad-slate-1: #52525B;   --grad-slate-2: #3F3E63;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-full: 999px;

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --ease: cubic-bezier(.16,1,.3,1);
  --fast: .2s;
  --med: .4s;

  --container: 1280px;
  --nav-h: 76px;
}

/* ---------- 3. Theme overrides ---------- */
[data-theme="dark"] {
  --bg: #0A0A12;
  --bg-soft: #0D0D18;
  --surface: #15141F;
  --surface-2: #1C1B29;
  --surface-3: #262536;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.18);
  --text: #F5F4F2;
  --text-muted: #A6A3B8;
  --text-faint: #8D8A9D;
  --glass-bg: rgba(21,20,31,.66);
  --shadow: 240 45% 3%;
  --scrim: rgba(6,6,12,.72);
  --blob-blend: screen;
  --blob-opacity: .55;
}

[data-theme="light"] {
  --bg: #F7F5F1;
  --bg-soft: #FBFAF7;
  --surface: #FFFFFF;
  --surface-2: #F1EEE7;
  --surface-3: #E8E4DA;
  --border: rgba(20,19,31,.09);
  --border-strong: rgba(20,19,31,.16);
  --text: #14131F;
  --text-muted: #58546A;
  --text-faint: #656175;
  --glass-bg: rgba(255,255,255,.7);
  --shadow: 240 15% 60%;
  --scrim: rgba(30,28,38,.4);
  --blob-blend: multiply;
  --blob-opacity: .18;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--med) var(--ease), color var(--med) var(--ease);
  overflow-x: hidden;
}

/* ---------- 4. Typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.5rem); font-weight: 800; }
h2 { font-size: clamp(1.8rem, 4vw, 2.75rem); }
h3 { font-size: 1.25rem; }
p { color: var(--text-muted); }

.text-gradient {
  background: linear-gradient(120deg, var(--iris), var(--flame-text));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-mono);
  font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--iris-light);
  margin-bottom: .9rem;
}
[data-theme="light"] .eyebrow { color: var(--iris); }

/* ---------- 5. Layout helpers ---------- */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem; }
.section { padding-block: clamp(4rem, 8vw, 7rem); }
.section--alt { background: var(--bg-soft); }
.section__header { max-width: 640px; margin-bottom: 3rem; }
.section__lead { font-size: 1.05rem; max-width: 52ch; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--iris); color: #fff;
  padding: .8rem 1.2rem; border-radius: var(--r-sm); z-index: 999; font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- 6. Buttons, badges, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .9rem 1.7rem; border-radius: var(--r-full);
  font-weight: 700; font-size: .95rem; white-space: nowrap;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform var(--fast) var(--ease), box-shadow var(--med) var(--ease), border-color var(--fast), background var(--fast);
}
.btn i { font-size: .85em; }
.btn:active { transform: scale(.97); }

.btn--primary {
  background: linear-gradient(120deg, var(--iris), var(--flame-deep));
  color: #fff;
  box-shadow: 0 10px 30px -8px rgba(108,76,224,.55);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -8px rgba(108,76,224,.7); }

.btn--secondary {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn--secondary:hover { border-color: var(--iris-light); transform: translateY(-2px); }

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
}
.btn--outline:hover { background: var(--surface-2); border-color: var(--iris); }

.ripple {
  position: absolute; border-radius: 50%; background: currentColor; opacity: .28;
  transform: scale(0); animation: rippleAnim .6s var(--ease) forwards; pointer-events: none;
}

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: .35rem .75rem; border-radius: var(--r-full);
  background: linear-gradient(120deg, var(--grad-violet-1), var(--grad-violet-2));
  color: #fff;
}
.badge--ghost { background: var(--surface-3); color: var(--text-muted); }
.badge--responsive { background: var(--surface-3); color: var(--text-muted); }
.badge--responsive i { color: #2DD4A7; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 1rem;
  position: relative; overflow: hidden; isolation: isolate;
  transition: background var(--fast), color var(--fast), transform var(--fast);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.92); }

/* ---------- 7. Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity .5s var(--ease), visibility .5s;
}
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader__mark { position: relative; width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; }
.loader__mark i { font-size: 1.6rem; color: var(--iris-light); }
.loader__ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--iris);
  animation: spin 1s linear infinite;
}

/* ---------- 8. Header ---------- */
.site-header { position: sticky; top: 0; z-index: 500; }

.utility-bar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-faint);
}
.utility-bar__inner {
  max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 40px;
}
.utility-left { display: flex; gap: 1.5rem; }
.utility-left i { color: var(--iris-light); margin-right: .35rem; }
.utility-right { display: flex; align-items: center; gap: 1.5rem; }
.utility-right a:hover { color: var(--text); }
.utility-right i { color: var(--iris-light); margin-right: .35rem; }
.utility-socials { display: flex; gap: .8rem; }
.utility-socials a {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: .7rem;
}
.utility-socials a:hover { background: var(--iris); color: #fff; }

.navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.navbar__inner {
  max-width: var(--container); margin-inline: auto; padding-inline: 1.5rem;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 2rem;
}
.brand { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.brand__logo { width: 38px; height: 38px; object-fit: contain; border-radius: var(--r-sm); }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand__accent { color: var(--iris-light); }
[data-theme="light"] .brand__accent { color: var(--iris); }

.nav-links { display: flex; align-items: center; gap: 2.2rem; }
.nav-link { font-weight: 600; font-size: .95rem; color: var(--text-muted); position: relative; transition: color var(--fast); }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -6px; width: 0; height: 2px;
  background: linear-gradient(120deg, var(--iris), var(--flame)); transition: width var(--fast) var(--ease);
}
.nav-link:hover { color: var(--text); }
.nav-link:hover::after { width: 100%; }

.navbar__actions { display: flex; align-items: center; gap: .5rem; }
.icon-moon, .icon-sun { transition: opacity var(--fast), transform var(--fast); }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

.hamburger { display: none; flex-direction: column; gap: 5px; width: 42px; height: 42px; }
.hamburger span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform var(--fast), opacity var(--fast); margin-inline: auto; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  display: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
}
.mobile-nav.is-open { display: block; animation: fadeInUp .3s var(--ease); }
.mobile-nav__links { display: flex; flex-direction: column; gap: 1.1rem; margin-bottom: 1.3rem; }
.mobile-nav__links .nav-link { font-size: 1.05rem; }
.mobile-nav__contact { display: flex; flex-direction: column; gap: .6rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: .9rem; color: var(--text-muted); }
.mobile-nav__contact i { color: var(--iris-light); margin-right: .5rem; }

/* ---------- 9. Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(4rem, 10vw, 7rem);
  padding-bottom: clamp(4rem, 8vw, 6rem);
  overflow: hidden;
  isolation: isolate;
}
.hero__bg { position: absolute; inset: 0; z-index: -2;  background-image: url(bg.jpg); }
.hero__mesh {
  position: absolute; inset: -10%;
  background:
    radial-gradient(circle at 15% 20%, rgba(108,76,224,.35), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(255,107,74,.22), transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(47,155,240,.2), transparent 45%);
  filter: blur(10px);
}
[data-theme="light"] .hero__mesh {
  background:
    radial-gradient(circle at 15% 20%, rgba(108,76,224,.16), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(255,107,74,.12), transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(47,155,240,.12), transparent 45%);
}
.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 100%);
  opacity: .5;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(60px);
  mix-blend-mode: var(--blob-blend); opacity: var(--blob-opacity);
  animation: floatBlob 16s ease-in-out infinite;
}
.blob--1 { width: 380px; height: 380px; background: var(--iris); top: -8%; left: -5%; }
.blob--2 { width: 300px; height: 300px; background: var(--flame); top: 30%; right: -8%; animation-duration: 20s; animation-delay: -4s; }
.blob--3 { width: 260px; height: 260px; background: var(--grad-sky-1); bottom: -10%; left: 30%; animation-duration: 24s; animation-delay: -9s; }

.hero__particles { position: absolute; inset: 0; }
.hero__particles span {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: var(--iris-light); opacity: 0;
  animation: particleDrift 9s linear infinite;
}
.hero__particles span:nth-child(1)  { left: 6%;  animation-delay: 0s;   animation-duration: 8s; }
.hero__particles span:nth-child(2)  { left: 14%; animation-delay: 1.2s; animation-duration: 10s; background: var(--flame); }
.hero__particles span:nth-child(3)  { left: 22%; animation-delay: 2.4s; animation-duration: 7s; }
.hero__particles span:nth-child(4)  { left: 30%; animation-delay: .6s;  animation-duration: 11s; background: var(--gold); }
.hero__particles span:nth-child(5)  { left: 38%; animation-delay: 3s;   animation-duration: 9s; }
.hero__particles span:nth-child(6)  { left: 46%; animation-delay: 1.8s; animation-duration: 8.5s; background: var(--flame); }
.hero__particles span:nth-child(7)  { left: 54%; animation-delay: 2.6s; animation-duration: 10.5s; }
.hero__particles span:nth-child(8)  { left: 62%; animation-delay: .3s;  animation-duration: 7.5s; background: var(--gold); }
.hero__particles span:nth-child(9)  { left: 70%; animation-delay: 2s;   animation-duration: 9.5s; }
.hero__particles span:nth-child(10) { left: 78%; animation-delay: 1s;   animation-duration: 11.5s; background: var(--flame); }
.hero__particles span:nth-child(11) { left: 86%; animation-delay: 3.4s; animation-duration: 8s; }
.hero__particles span:nth-child(12) { left: 94%; animation-delay: .8s;  animation-duration: 10s; background: var(--gold); }
.hero__particles span:nth-child(13) { left: 10%; animation-delay: 4s;   animation-duration: 12s; }
.hero__particles span:nth-child(14) { left: 44%; animation-delay: 4.6s; animation-duration: 9s; background: var(--flame); }
.hero__particles span:nth-child(15) { left: 66%; animation-delay: 3.8s; animation-duration: 10.5s; }
.hero__particles span:nth-child(16) { left: 90%; animation-delay: 2.2s; animation-duration: 8.5s; }
.hero__particles span:nth-child(17) { left: 25%; animation-delay: 5s;   animation-duration: 11s; background: var(--gold); }
.hero__particles span:nth-child(18) { left: 76%; animation-delay: 4.2s; animation-duration: 9.5s; }

.hero__inner { text-align: center; max-width: 880px; margin-inline: auto; position: relative; z-index: 2; }
.hero__title { margin-bottom: 1.4rem; }
.hero__subtitle { font-size: clamp(1rem, 1.6vw, 1.2rem); max-width: 60ch; margin-inline: auto; margin-bottom: 2.3rem; }
.hero__ctas { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3.5rem; }

.hero__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; max-width: 720px; margin-inline: auto; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat__value {
  font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.3rem);
  background: linear-gradient(120deg, #e49e07, #FF3F14);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat__label { font-size: .8rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: .3rem; }

/* signature element: floating category constellation */
.constellation { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.constellation__chip {
  position: absolute; pointer-events: auto;
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--glass-bg); backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  padding: .55rem 1rem; border-radius: var(--r-full);
  font-size: .82rem; font-weight: 700; white-space: nowrap;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.25);
  animation: floatChip 7s ease-in-out infinite;
  transition: transform var(--fast) var(--ease), border-color var(--fast);
}
.constellation__chip:hover { transform: translateY(-4px) scale(1.05) !important; border-color: var(--iris-light); z-index: 5; }
.constellation__chip i { font-size: .95em; }
.constellation__chip-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: .68rem;
}

.scroll-cue {
  position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--border-strong); border-radius: var(--r-full);
  display: flex; justify-content: center; padding-top: 8px; z-index: 3;
}
.scroll-cue span { width: 4px; height: 8px; border-radius: 2px; background: var(--iris-light); animation: scrollCue 1.8s ease infinite; }

/* ---------- 11. Category showcase ---------- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.category-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.9rem; cursor: pointer; text-align: left;
  position: relative; overflow: hidden; isolation: isolate;
  transition: transform var(--med) var(--ease), border-color var(--fast), box-shadow var(--med);
  display: flex; flex-direction: column; gap: 1rem;
}
.category-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: 0 20px 45px -16px hsl(var(--shadow) / .4); }
.category-card__icon {
  width: 54px; height: 54px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #fff;
}
.category-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.category-card__count {
  font-family: var(--font-mono); font-size: .75rem; font-weight: 700; color: var(--text-muted);
  background: var(--surface-2); padding: .3rem .65rem; border-radius: var(--r-full);
}
.category-card h3 { font-size: 1.2rem; }
.category-card p { font-size: .88rem; line-height: 1.55; }
.category-card__cta { margin-top: auto; display: flex; align-items: center; gap: .4rem; font-size: .82rem; font-weight: 700; color: var(--iris-light); }
[data-theme="light"] .category-card__cta { color: var(--iris); }
.category-card:hover .category-card__cta i { transform: translateX(4px); }
.category-card__cta i { transition: transform var(--fast) var(--ease); }

/* ---------- 12. Search + filters ---------- */
.search-shell { margin-bottom: 2.5rem; }
.search-bar {
  position: relative; max-width: 640px; margin-inline: auto; margin-bottom: 1.6rem;
}
.search-bar__icon { position: absolute; left: 1.4rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-bar__input {
  width: 100%; padding: 1.05rem 3.2rem; border-radius: var(--r-full);
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 1rem; transition: border-color var(--fast), box-shadow var(--fast);
}
.search-bar__input:focus { outline: none; border-color: var(--iris); box-shadow: 0 0 0 4px rgba(108,76,224,.15); }
.search-bar__input::placeholder { color: var(--text-faint); }
.search-bar__clear { position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.search-bar__clear:hover { color: var(--text); }

.search-suggestions {
  position: absolute; top: calc(100% + .6rem); left: 0; right: 0; z-index: 40;
  background: var(--glass-bg); backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  padding: .5rem; max-height: 340px; overflow-y: auto;
  box-shadow: 0 20px 50px -16px hsl(var(--shadow) / .5);
}
.suggestion {
  display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border-radius: var(--r-sm);
  cursor: pointer; transition: background var(--fast);
}
.suggestion:hover, .suggestion.is-active { background: var(--surface-2); }
.suggestion__icon {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: .8rem;
}
.suggestion__name { font-weight: 700; font-size: .9rem; }
.suggestion__name mark { background: none; color: var(--iris-light); }
.suggestion__meta { font-size: .76rem; color: var(--text-faint); }
.suggestion__empty { padding: 1.2rem; text-align: center; color: var(--text-faint); font-size: .9rem; }

.filter-chips { display: flex; flex-wrap: wrap; gap: .65rem; justify-content: center; margin-bottom: 1.5rem; }
.chip {
  padding: .6rem 1.2rem; border-radius: var(--r-full); font-size: .85rem; font-weight: 700;
  border: 1.5px solid var(--border-strong); color: var(--text-muted);
  display: inline-flex; align-items: center; gap: .45rem;
  position: relative; overflow: hidden; isolation: isolate;
  transition: all var(--fast) var(--ease);
}
.chip:hover { border-color: var(--iris-light); color: var(--text); }
.chip.is-active {
  background: linear-gradient(120deg, var(--grad-violet-1), var(--grad-violet-2));
  border-color: transparent; color: #fff;
}
.chip__count { font-family: var(--font-mono); opacity: .8; font-size: .78em; }

.results-meta { text-align: center; font-size: .88rem; color: var(--text-faint); }
.results-meta strong { color: var(--text); }

/* ---------- 13. Template cards + grids ---------- */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.6rem; margin-top: 1rem; }
.template-grid--featured { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.template-grid--compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.template-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer;
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease), border-color var(--fast);
  display: flex; flex-direction: column;
}
.template-card:hover { transform: translateY(-8px); box-shadow: 0 26px 50px -18px hsl(var(--shadow) / .45); border-color: var(--border-strong); }

.thumb { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.template-grid--compact .thumb { aspect-ratio: 16 / 11; }
.thumb::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,.35) 1.5px, transparent 1.5px);
  background-size: 18px 18px; opacity: .35;
}
.thumb i { font-size: clamp(2.2rem, 5vw, 3rem); color: #fff; filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); position: relative; z-index: 1; transition: transform var(--med) var(--ease); }
.template-card:hover .thumb i { transform: scale(1.12) rotate(-4deg); }

/* Screenshot layer: a plain <img> sits above the icon/gradient fallback.
   It's transparent/absent until it loads, so the fallback shows instantly;
   if the file is missing, onerror removes the tag and the fallback stays
   visible permanently — no broken-image icon, no layout shift. */
.thumb__img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
}

.thumb__overlay {
  position: absolute; inset: 0; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  opacity: 0; transition: opacity var(--fast) var(--ease); z-index: 3;
}
.template-card:hover .thumb__overlay { opacity: 1; }
.thumb__btn {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.95); color: #14131F;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
  position: relative; overflow: hidden;
  transform: translateY(10px); transition: transform var(--fast) var(--ease), background var(--fast);
}
.template-card:hover .thumb__btn { transform: translateY(0); }
.thumb__btn:hover { background: #fff; color: var(--iris); }
.thumb__btn:nth-child(2) { transition-delay: .05s; }

.card-body { padding: 1.15rem 1.3rem 1.3rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.card-meta { display: flex; align-items: center; gap: .4rem; font-size: .74rem; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .03em; }
.card-meta__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-faint); }
.card-title { font-size: 1.05rem; font-weight: 700; font-family: var(--font-display); }
.card-foot { margin-top: auto; padding-top: .5rem; display: flex; align-items: center; justify-content: space-between; }
.card-foot__responsive { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; color: var(--text-faint); font-weight: 600; }
.card-foot__responsive i { color: #2DD4A7; }
.card-foot__arrow { color: var(--text-faint); transition: transform var(--fast) var(--ease), color var(--fast); }
.template-card:hover .card-foot__arrow { color: var(--iris-light); transform: translateX(3px); }

.load-more-wrap { display: flex; justify-content: center; margin-top: 2.8rem; }
#loadMoreBtn.is-hidden { display: none; }

/* gradient thumbnail variants */
.grad-violet  { background: linear-gradient(135deg, var(--grad-violet-1), var(--grad-violet-2)); }
.grad-blue    { background: linear-gradient(135deg, var(--grad-blue-1), var(--grad-blue-2)); }
.grad-teal    { background: linear-gradient(135deg, var(--grad-teal-1), var(--grad-teal-2)); }
.grad-amber   { background: linear-gradient(135deg, var(--grad-amber-1), var(--grad-amber-2)); }
.grad-sky     { background: linear-gradient(135deg, var(--grad-sky-1), var(--grad-sky-2)); }
.grad-emerald { background: linear-gradient(135deg, var(--grad-emerald-1), var(--grad-emerald-2)); }
.grad-medical { background: linear-gradient(135deg, var(--grad-medical-1), var(--grad-medical-2)); }
.grad-pink    { background: linear-gradient(135deg, var(--grad-pink-1), var(--grad-pink-2)); }
.grad-slate   { background: linear-gradient(135deg, var(--grad-slate-1), var(--grad-slate-2)); }

.badge.grad-violet, .badge.grad-blue, .badge.grad-teal, .badge.grad-amber, .badge.grad-sky,
.badge.grad-emerald, .badge.grad-medical, .badge.grad-pink, .badge.grad-slate { color: #fff; }

/* ---------- 15. Contact band ---------- */
.contact-band { padding-block: clamp(3.5rem, 7vw, 5.5rem); }
.contact-band__inner {
  background: linear-gradient(120deg, var(--iris), var(--flame-deep));
  border-radius: var(--r-xl);
  padding: clamp(2.2rem, 5vw, 3.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
  position: relative; overflow: hidden;
}
.contact-band__inner::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.5) 1.5px, transparent 1.5px);
  background-size: 22px 22px; opacity: .12;
}
.contact-band__text { position: relative; z-index: 1; color: #fff; max-width: 480px; }
.contact-band__text .eyebrow { color: #fff; }
.contact-band__text h2 { color: #fff; margin-bottom: .6rem; }
.contact-band__text p { color: #fff; }
.contact-band__actions { position: relative; z-index: 1; display: flex; gap: 1rem; flex-wrap: wrap; }
.contact-band .btn--primary { background: #fff; color: var(--iris); box-shadow: 0 10px 30px -8px rgba(0,0,0,.25); }
.contact-band .btn--secondary { background: rgba(0,0,0,.18); border-color: rgba(255,255,255,.4); color: #fff; }

/* ---------- 16. Footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding-top: clamp(3rem, 6vw, 4.5rem); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 2.5rem; padding-bottom: 3rem; }
.footer__blurb { font-size: .88rem; margin-block: 1.1rem; max-width: 34ch; }
.footer__socials { display: flex; gap: .7rem; }
.footer__socials a {
  width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; transition: background var(--fast), color var(--fast), transform var(--fast);
}
.footer__socials a:hover { background: var(--iris); color: #fff; transform: translateY(-3px); }
.footer__col h4 { font-size: .95rem; margin-bottom: 1.1rem; }
.footer__col h4.mt { margin-top: 1.4rem; }
.footer__col a, .footer__col button.footer-link {
  display: block; font-size: .88rem; color: var(--text-muted); margin-bottom: .7rem;
  transition: color var(--fast); text-align: left; width: 100%;
}
.footer__col a:hover, .footer__col button.footer-link:hover { color: var(--iris-light); }
.footer__contact { font-size: .85rem; color: var(--text-muted); margin-bottom: .55rem; display: flex; align-items: center; gap: .5rem; }
.footer__contact i { color: var(--iris-light); width: 14px; }

.newsletter-form { display: flex; gap: .5rem; margin-bottom: .6rem; }
.newsletter-form input {
  flex: 1; padding: .75rem 1rem; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); font-size: .85rem;
}
.newsletter-form input:focus { outline: none; border-color: var(--iris); }
.newsletter-form button {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(120deg, var(--iris), var(--flame-deep)); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.newsletter-note { font-size: .78rem; color: #2DD4A7; min-height: 1em; margin-bottom: .5rem; }

.footer__bottom { border-top: 1px solid var(--border); padding-block: 1.5rem; }
.footer__bottom-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; font-size: .82rem; color: var(--text-faint); }
.footer__bottom-inner a:hover { color: var(--iris-light); }

/* ---------- 17. Back to top ---------- */
.back-to-top {
  position: fixed; bottom: 1.8rem; right: 1.8rem; z-index: 300;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(120deg, var(--iris), var(--flame-deep)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px -8px rgba(108,76,224,.5);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity var(--med), visibility var(--med), transform var(--med);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-4px); }

/* ---------- 18. Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: var(--scrim); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  position: relative; animation: modalIn .35s var(--ease);
}
.modal__close {
  position: absolute; top: 1rem; right: 1rem; z-index: 3;
  background: rgba(0,0,0,.35); color: #fff;
}
.modal__close:hover { background: rgba(0,0,0,.55); }
.modal__thumb { position: relative; aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; }
.modal__thumb::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,.35) 1.5px, transparent 1.5px);
  background-size: 20px 20px; opacity: .35;
}
.modal__thumb i { font-size: 3.6rem; color: #fff; position: relative; z-index: 1; }
.modal__body { padding: 1.8rem 2rem 2.2rem; }
.modal__badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.modal__body h3 { margin-bottom: .7rem; font-size: 1.5rem; }
.modal__body p { margin-bottom: 1.6rem; }
.modal__actions { display: flex; gap: .8rem; flex-wrap: wrap; }

/* ---------- 19. Scroll reveal + keyframes ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.section__header.reveal, .contact-band__inner.reveal { transform: translateY(24px); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatBlob {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-25px) scale(1.08); }
  66% { transform: translate(-20px,20px) scale(.95); }
}
@keyframes floatChip {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  50% { transform: translate(0,-16px) rotate(1.5deg); }
}
@keyframes particleDrift {
  0% { transform: translateY(110%) scale(.6); opacity: 0; }
  10% { opacity: .8; }
  90% { opacity: .3; }
  100% { transform: translateY(-30%) scale(1); opacity: 0; }
}
@keyframes scrollCue { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(14px); opacity: 0; } }
@keyframes rippleAnim { to { transform: scale(3); opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ---------- 20. Responsive ---------- */
@media (max-width: 1024px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

@media (max-width: 1280px) {
  .constellation { display: none; }
}

@media (max-width: 860px) {
  .utility-bar { display: none; }
  .hero__stats { grid-template-columns: repeat(2, 1fr); row-gap: 1.8rem; }
  .contact-band__inner { flex-direction: column; text-align: center; }
  .contact-band__text { max-width: 100%; }
  .contact-band__actions { justify-content: center; }
}

@media (max-width: 640px) {
  :root { --nav-h: 68px; }
  .brand__name { font-size: 1.1rem; }
  .brand__logo { width: 32px; height: 32px; }
  .hero__ctas { flex-direction: column; width: 100%; }
  .hero__ctas .btn { width: 100%; }
  .footer__grid { grid-template-columns: 1fr; }
  .modal__body { padding: 1.4rem 1.2rem 1.8rem; }
  .newsletter-form { flex-direction: row; }
  .category-card { padding: 1.5rem; }
}

/* ---------- 21. Accessibility & reduced motion ---------- */
:focus-visible { outline: 2px solid var(--iris-light); outline-offset: 3px; }
button:focus-visible, a:focus-visible { border-radius: var(--r-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Custom scrollbar (progressive enhancement) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--iris); }
