/* =========================================
   Maharat Web — Product Showcase
   ========================================= */

:root {
  --primary: #266CF8;
  --primary-dark: #1554d6;
  --primary-soft: #e9f0ff;
  --secondary: #0B1A3C;
  --secondary-light: #13275a;

  --text: #0B1A3C;
  --text-muted: #5b6785;
  --bg: #f5f7fc;
  --surface: #ffffff;
  --border: #e3e8f3;

  --tag-theme: #7c3aed;
  --tag-plugin: #0d9488;
  --tag-gateway: #ea580c;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 8px rgba(11, 26, 60, .06);
  --shadow: 0 12px 32px rgba(11, 26, 60, .10);
  --shadow-lg: 0 24px 60px rgba(11, 26, 60, .18);
  --header-h: 76px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.5; }
p { margin: 0; }

.container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 20px;
}

.text-gradient {
  background: linear-gradient(90deg, #6aa0ff, var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease),
              border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn:focus-visible { outline: 3px solid rgba(38, 108, 248, .45); outline-offset: 2px; }

.btn--sm { padding: 8px 18px; font-size: 14px; }
.btn--lg { padding: 14px 30px; font-size: 16px; }

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(38, 108, 248, .30);
}
.btn--primary:hover { background: var(--primary-dark); transform: translateY(-2px); }

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--outline:hover { background: var(--primary); color: #fff; }

.btn--ghost {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border-color: rgba(255, 255, 255, .25);
}
.btn--ghost:hover { background: rgba(255, 255, 255, .16); }

.btn--light { background: #fff; color: var(--primary); }
.btn--light:hover { background: var(--secondary); color: #fff; transform: translateY(-2px); }

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.header.is-scrolled {
  background: rgba(11, 26, 60, .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}

/* logo | centered nav | CTA */
.header__inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
}
.header__logo { justify-self: start; }
.header__logo img { height: 32px; width: auto; }
.header__cta { justify-self: end; }

.nav { display: flex; gap: 8px; }
.nav__link {
  color: rgba(255, 255, 255, .8);
  font-weight: 500;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 8px;
  transition: color .2s, background-color .2s;
}
.nav__link:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
}
.nav-toggle span {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform .3s var(--ease), opacity .3s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--header-h) + 90px) 0 150px;
  background:
    radial-gradient(900px 500px at 85% 0%, rgba(38, 108, 248, .45), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(38, 108, 248, .25), transparent 60%),
    var(--secondary);
  color: #fff;
  text-align: center;
}
.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.hero__inner { position: relative; max-width: 880px; }

.hero__badge {
  display: inline-block;
  padding: 6px 18px;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 500;
  color: #cfe0ff;
  border: 1px solid rgba(38, 108, 248, .5);
  background: rgba(38, 108, 248, .15);
  border-radius: 999px;
}
.hero__title {
  font-size: clamp(28px, 5vw, 50px);
  font-weight: 800;
  line-height: 1.45;
}
.hero__text {
  max-width: 680px;
  margin: 20px auto 0;
  font-size: 17px;
  color: rgba(255, 255, 255, .72);
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 36px;
}
.hero__stats {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 56px 0 0;
  padding: 0;
}
.hero__stats li {
  min-width: 150px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1);
}
.hero__stats strong { display: block; font-size: 30px; font-weight: 800; color: #fff; line-height: 1.3; }
.hero__stats span { font-size: 14px; color: rgba(255, 255, 255, .65); }

/* ---------- Section head ---------- */
.section-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.section-head__eyebrow {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.section-head__title { font-size: clamp(24px, 3.5vw, 36px); font-weight: 800; }
.section-head__text { margin-top: 10px; color: var(--text-muted); }

/* ---------- Products ---------- */
.products { position: relative; padding-bottom: 100px; }
.products > .container {
  position: relative;
  margin-top: -80px;
  padding-top: 48px;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}
.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all .25s var(--ease);
}
.filter:hover { color: var(--primary); border-color: var(--primary); }
.filter.is-active {
  color: #fff;
  background: var(--secondary);
  border-color: var(--secondary);
}
.filter__count {
  min-width: 24px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 22px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}
.filter.is-active .filter__count { background: var(--primary); color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

/* ---------- Card ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.card.is-hidden { display: none; }
.card.is-entering { animation: cardIn .45s var(--ease) both; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.card__media {
  position: relative;
  display: block;
  aspect-ratio: 1100 / 619;
  overflow: hidden;
  background: var(--secondary);
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease);
}
.card:hover .card__media img { transform: scale(1.05); }

.card__tag {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}
.card__tag--theme { background: var(--tag-theme); }
.card__tag--plugin { background: var(--tag-plugin); }
.card__tag--gateway { background: var(--tag-gateway); }

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 24px;
}
.card__title { font-size: 20px; font-weight: 800; }
.card__title a { transition: color .2s; }
.card__title a:hover { color: var(--primary); }
.card__subtitle {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
}
.card__desc {
  margin-top: 12px;
  font-size: 14.5px;
  color: var(--text-muted);
  flex: 1;
}
.card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.card__actions .btn { padding-inline: 12px; font-size: 14px; }
.card__actions .btn:only-child { grid-column: 1 / -1; }

.products__more { display: flex; justify-content: center; margin-top: 48px; }

/* Featured (themes) — wide cards spanning the first row */
.card--featured { grid-column: span 3; flex-direction: row; }
.card--featured .card__media { flex: 0 0 58%; aspect-ratio: 1100 / 619; }
.card--featured .card__body { justify-content: center; padding: 36px 40px; }
.card--featured .card__title { font-size: 30px; }
.card--featured .card__subtitle { font-size: 16px; }
.card--featured .card__desc { flex: 0; font-size: 16px; margin-top: 16px; }
.card--featured .card__actions { margin-top: 28px; max-width: 380px; }
.card--featured .card__actions .btn { padding: 13px 18px; font-size: 15px; }
.card--featured:nth-of-type(even) { flex-direction: row-reverse; }

/* When filtering, featured cards behave like regular ones */
.grid.is-filtered .card--featured { grid-column: span 1; flex-direction: column; }
.grid.is-filtered .card--featured .card__media { flex: none; }
.grid.is-filtered .card--featured .card__body { padding: 22px 24px 24px; justify-content: flex-start; }
.grid.is-filtered .card--featured .card__title { font-size: 20px; }
.grid.is-filtered .card--featured .card__subtitle { font-size: 14px; }
.grid.is-filtered .card--featured .card__desc { flex: 1; font-size: 14.5px; margin-top: 12px; }
.grid.is-filtered .card--featured .card__actions { max-width: none; margin-top: 22px; }
.grid.is-filtered .card--featured .card__actions .btn { padding: 11px 12px; font-size: 14px; }

/* ---------- Features ---------- */
.features { padding: 90px 0; background: var(--surface); }
.features__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.feature {
  padding: 30px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature__icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #5b93ff);
  box-shadow: 0 10px 22px rgba(38, 108, 248, .3);
}
.feature__icon svg { width: 26px; height: 26px; fill: #fff; }
.feature__title { font-size: 18px; font-weight: 700; }
.feature__text { margin-top: 8px; font-size: 14.5px; color: var(--text-muted); }

/* ---------- CTA ---------- */
.cta { padding: 90px 0; }
.cta__box {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 52px 56px;
  border-radius: 28px;
  color: #fff;
  background:
    radial-gradient(500px 300px at 0% 0%, rgba(255, 255, 255, .18), transparent 60%),
    linear-gradient(120deg, var(--primary), var(--secondary-light));
  box-shadow: var(--shadow-lg);
}
.cta__title { font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
.cta__text { margin-top: 8px; color: rgba(255, 255, 255, .82); }

/* ---------- Footer ---------- */
.footer { background: var(--secondary); color: rgba(255, 255, 255, .65); padding: 30px 0; }
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer__logo { height: 28px; width: auto; }
.footer__copy { font-size: 14px; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  box-shadow: 0 10px 24px rgba(38, 108, 248, .4);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all .3s var(--ease);
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--primary-dark); }
.to-top svg { width: 26px; height: 26px; fill: #fff; }

/* ---------- Reveal on scroll ---------- */
/* uses `translate` so it doesn't clash with hover `transform` */
.reveal { opacity: 0; translate: 0 24px; transition: opacity .7s var(--ease), translate .7s var(--ease), transform .35s var(--ease), box-shadow .35s var(--ease); }
.reveal.is-visible { opacity: 1; translate: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .card--featured { grid-column: span 2; }
  .card--featured .card__media { flex-basis: 52%; }
  .card--featured .card__body { padding: 28px; }
  .card--featured .card__title { font-size: 24px; }
  .features__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .header__inner { display: flex; }
  .header__cta { display: none; }
  .nav-toggle { display: flex; margin-inline-start: auto; }
  .header.menu-open { background: var(--secondary); }

  .nav {
    position: absolute;
    top: var(--header-h);
    inset-inline: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px 20px;
    background: var(--secondary);
    box-shadow: 0 16px 30px rgba(0, 0, 0, .25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all .3s var(--ease);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__link { padding: 12px 14px; }

  .card--featured,
  .card--featured:nth-of-type(even) { flex-direction: column; }
  .card--featured .card__media { flex: none; }
  .card--featured .card__desc { flex: 1; }
  .card--featured .card__actions { max-width: none; }

  .cta__box { flex-direction: column; text-align: center; padding: 40px 28px; }
}

@media (max-width: 640px) {
  :root { --header-h: 66px; }
  .header__logo img { height: 26px; }
  .hero { padding: calc(var(--header-h) + 56px) 0 120px; }
  .hero__text { font-size: 15.5px; }
  .hero__stats { gap: 10px; }
  .hero__stats li { min-width: 0; flex: 1; padding: 12px 8px; }
  .hero__stats strong { font-size: 24px; }
  .hero__stats span { font-size: 12.5px; }

  .grid,
  .grid.is-filtered { grid-template-columns: 1fr; gap: 22px; }
  .card--featured { grid-column: span 1; }
  .card--featured .card__body { padding: 22px 24px 24px; }
  .card--featured .card__title { font-size: 22px; }

  .filters { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 6px; margin-inline: -20px; padding-inline: 20px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filter { flex-shrink: 0; }

  .features__grid { grid-template-columns: 1fr; }
  .footer__inner { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; translate: none; }
}
