/* ============================================================
   WEBSTORE — Main Stylesheet
   Dark mode default · Light mode via [data-theme="light"]
   Responsive: mobile / tablet / desktop
   ============================================================ */

/* ── 1. Tokens / CSS Variables ─────────────────────────────── */
:root {
  /* Dark theme (default) */
  --bg:           #0d0d12;
  --surface:      #16161e;
  --surface2:     #1e1e2a;
  --surface3:     #252534;
  --border:       #2c2c3e;
  --border-light: #38384e;
  --text:         #e6e6f0;
  --text-muted:   #7a7a96;
  --text-faint:   #4a4a60;
  --accent:       #818cf8;
  --accent-hover: #a5b4fc;
  --accent-dim:   rgba(129,140,248,.15);
  --danger:       #f87171;
  --success:      #4ade80;
  --warning:      #fbbf24;
  --btn-fg:       #fff;

  /* Layout */
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --shadow:       0 4px 24px rgba(0,0,0,.45);
  --shadow-sm:    0 2px 10px rgba(0,0,0,.3);
  --shadow-card:  0 2px 16px rgba(0,0,0,.5);

  /* Motion */
  --ease:         cubic-bezier(.4,0,.2,1);
  --dur:          .22s;

  /* Fonts */
  --font:         'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="light"] {
  --bg:           #f2f2f8;
  --surface:      #ffffff;
  --surface2:     #f6f6fc;
  --surface3:     #ebebf5;
  --border:       #dcdce8;
  --border-light: #ececf6;
  --text:         #12121e;
  --text-muted:   #6b6b84;
  --text-faint:   #b0b0c0;
  --accent:       #6366f1;
  --accent-hover: #4f52df;
  --accent-dim:   rgba(99,102,241,.1);
  --shadow:       0 4px 24px rgba(0,0,0,.1);
  --shadow-sm:    0 2px 10px rgba(0,0,0,.06);
  --shadow-card:  0 2px 16px rgba(0,0,0,.08);
}

/* ── 2. Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol { list-style: none; }

/* ── 3. Utility ────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── 4. Header ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,18,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

[data-theme="light"] .site-header {
  background: rgba(242,242,248,.88);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 16px;
}

.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Theme toggle button */
.btn-theme {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur), border-color var(--dur), transform var(--dur);
  color: var(--text);
  font-size: 1.1rem;
}

.btn-theme:hover {
  background: var(--surface3);
  transform: rotate(20deg);
}

.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ── 5. Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  padding: 14px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  transition: color var(--dur);
}

.breadcrumb a:hover { color: var(--accent-hover); }

.breadcrumb span { color: var(--text-faint); }

/* ── 6. Page Hero / Section heading ────────────────────────── */
.page-hero {
  padding: clamp(32px, 6vw, 64px) 0 clamp(24px, 4vw, 40px);
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.15;
  margin-bottom: 12px;
}

.page-hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.page-hero p {
  color: var(--text-muted);
  font-size: clamp(.9rem, 2vw, 1.05rem);
  max-width: 560px;
  margin-inline: auto;
}

/* ── 7. Product Grid ───────────────────────────────────────── */
.products-section { padding-bottom: clamp(40px, 8vw, 80px); }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

/* ── 8. Product Card ───────────────────────────────────────── */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--border-light);
}

/* Vertical / portrait image wrapper */
.card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: var(--surface2);
  overflow: hidden;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform .4s var(--ease);
}

.product-card:hover .card-thumb img {
  transform: scale(1.03);
}

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-faint);
}

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent);
}

.card-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .83rem;
  padding: 8px 14px;
  transition: background var(--dur), color var(--dur), transform var(--dur), box-shadow var(--dur);
  white-space: nowrap;
  line-height: 1;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--btn-fg);
  flex: 1;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(129,140,248,.35);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border-light);
}

/* ── 9. Product Detail Page ────────────────────────────────── */
.product-detail {
  padding-bottom: clamp(40px, 8vw, 80px);
}

.product-header {
  padding: clamp(24px, 4vw, 48px) 0 clamp(20px, 3vw, 36px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 640px) {
  .product-header {
    grid-template-columns: 200px 1fr;
    align-items: start;
    gap: 32px;
  }
}

@media (min-width: 900px) {
  .product-header {
    grid-template-columns: 260px 1fr;
    gap: 48px;
  }
}

.product-cover {
  aspect-ratio: 9/16;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 260px;
  box-shadow: var(--shadow);
}

.product-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.product-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: var(--text-faint);
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-info .badge {
  align-self: flex-start;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(129,140,248,.25);
}

.product-info h1 {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -.4px;
  line-height: 1.2;
}

.product-info .price {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 800;
  color: var(--accent);
}

.product-info .description {
  font-size: .95rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 520px;
}

.product-info .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: .95rem;
  border-radius: var(--radius);
}

/* ── 10. Version Tabs ──────────────────────────────────────── */
.versions-section { margin-top: 8px; }

.versions-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: .75rem;
  margin-bottom: 16px;
}

.version-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 7px 16px;
  border-radius: 30px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 600;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--surface3);
  color: var(--text);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── 11. Image Gallery (horizontal scroll) ─────────────────── */
.version-panel { display: none; }
.version-panel.active { display: block; }

.gallery-scroll {
  display: flex;
  gap: clamp(10px, 2vw, 16px);
  overflow-x: auto;
  padding-bottom: 16px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  /* Hide scrollbar (style kept for usability) */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.gallery-scroll::-webkit-scrollbar { height: 4px; }
.gallery-scroll::-webkit-scrollbar-track { background: transparent; }
.gallery-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.gallery-item {
  flex-shrink: 0;
  width: clamp(120px, 25vw, 200px);
  aspect-ratio: 9/16;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
  scroll-snap-align: start;
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur);
}

.gallery-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
  transform: scale(1.02);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  pointer-events: none;
}

.gallery-empty {
  padding: 32px;
  color: var(--text-faint);
  font-size: .85rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  width: 100%;
}

/* ── 12. Lightbox ──────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 92dvh;
  max-width: 96vw;
}

.lightbox-img {
  max-height: 88dvh;
  max-width: 90vw;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
  user-select: none;
  /* vertical phone screenshots: constrain width */
  width: auto;
}

.lightbox-btn {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background var(--dur);
  z-index: 1000;
}

.lightbox-btn:hover { background: rgba(255,255,255,.22); }

.lightbox-close { top: 16px; right: 16px; font-size: 1.3rem; }
.lightbox-prev  { left: 16px;  top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 16px; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6);
  color: rgba(255,255,255,.8);
  font-size: .78rem;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .5px;
}

/* ── 13. No Versions / Empty States ────────────────────────── */
.empty-state {
  text-align: center;
  padding: clamp(40px, 8vw, 80px) 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h2   { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.empty-state p    { font-size: .9rem; }

/* ── 14. Divider ───────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: clamp(24px, 4vw, 40px) 0;
}

/* ── 15. Footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  margin-top: auto;
  color: var(--text-faint);
  font-size: .8rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-logo {
  font-weight: 700;
  color: var(--text-muted);
  font-size: .9rem;
}

.footer-logo span { color: var(--accent); }

/* ── 16. Responsive ────────────────────────────────────────── */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-body { padding: 10px 12px 12px; }
  .card-name { font-size: .85rem; }
  .card-price { font-size: .95rem; }
  .card-desc { font-size: .75rem; }

  .btn { padding: 7px 10px; font-size: .78rem; }

  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}

@media (min-width: 481px) and (max-width: 767px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ── 17. Transitions & Animations ─────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.product-card {
  animation: fadeUp .3s var(--ease) both;
}

/* Stagger cards */
.product-card:nth-child(1) { animation-delay: .04s; }
.product-card:nth-child(2) { animation-delay: .08s; }
.product-card:nth-child(3) { animation-delay: .12s; }
.product-card:nth-child(4) { animation-delay: .16s; }
.product-card:nth-child(5) { animation-delay: .20s; }
.product-card:nth-child(6) { animation-delay: .24s; }
.product-card:nth-child(7) { animation-delay: .28s; }
.product-card:nth-child(8) { animation-delay: .32s; }
