/* =====================================================================
   Explore Designs: shop header, category tabs, design cards, CTA band.
   Design cards are also used by the design page (related designs).
   Requires tokens.css + site.css.
   ===================================================================== */

/* Fallback images stay transparent until loaded: no broken-image flash. */
img[data-fb] { opacity: 0; transition: opacity .5s var(--ease-out); }
img[data-fb].is-loaded { opacity: 1; }

/* ---- Header ------------------------------------------------------------- */
.shop { padding: clamp(56px, 8vw, 112px) 0 clamp(72px, 9vw, 128px); }
.shop-head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: var(--space-5) clamp(32px, 6vw, 96px);
  align-items: end;
  padding-bottom: clamp(36px, 5vw, 56px);
}
.shop-head .eyebrow { display: flex; align-items: center; gap: 14px; }
.shop-head .eyebrow::before { content: ""; width: 32px; height: 1px; background: currentColor; }
.shop-head h1 {
  margin-top: 20px;
  max-width: 14ch;
  color: var(--navy);
  font-size: clamp(2.375rem, 1.5rem + 3.2vw, 4rem);
}
.shop-head__aside .lead { max-width: 46ch; }
.shop-head__note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: var(--space-5);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--slate);
}
.shop-head__note .badge-concept { flex: none; }

/* ---- Tabs ----------------------------------------------------------------- */
.shop-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-5);
  margin-bottom: clamp(32px, 4vw, 48px);
  border-bottom: 1px solid var(--line-light);
}
.shop-tabs {
  display: flex;
  gap: clamp(4px, 1.6vw, 28px);
  margin-bottom: -1px;
  overflow-x: auto;
  scrollbar-width: none;
}
.shop-tabs::-webkit-scrollbar { display: none; }
.shop-tab {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: none;
  min-height: 48px;
  padding: 12px 6px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--slate);
  font-family: var(--font-label);
  font-weight: 500;
  font-size: .8125rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .25s var(--ease-out), border-color .25s var(--ease-out);
}
.shop-tab:hover { color: var(--navy); }
.shop-tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--navy); }
.shop-tab:focus-visible { outline-offset: -3px; border-radius: 6px; }
.shop-tab__count {
  font-family: var(--font-body);
  font-size: .6875rem;
  letter-spacing: 0;
  color: var(--ember-ink);
}
.shop-status {
  flex: none;
  font-size: var(--fs-small);
  color: var(--slate);
}

/* ---- Grid + cards ----------------------------------------------------------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 3.2vw, 48px) clamp(20px, 2.4vw, 36px);
  list-style: none;
}
.shop-grid > li { display: flex; }
/* Reserve the grid's height until JS fills it, so the CTA and footer do not jump (CLS).
   Not when loading failed (.is-failed) and not without JavaScript. */
.shop-grid:empty:not(.is-failed) { min-height: 2000px; }
@media (scripting: none) { .shop-grid:empty { min-height: 0 !important; } }

/* Load-failure and no-JS messages: visible at every width. */
.shop-message {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.shop-message[hidden] { display: none; }
.shop-message p { margin: 0; flex: 1 1 24ch; }
.shop-message--error { border-left: 4px solid var(--navy-700); }

.design-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  outline-offset: 4px;
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out);
}
.design-card:hover { color: var(--ink); box-shadow: var(--shadow-lift); }

.design-card__media {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--navy) linear-gradient(135deg, #0F1B2D, #1F3A5F);
  isolation: isolate;
}
.design-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.001);
  transition: opacity .5s var(--ease-out), transform .8s var(--ease-out);
}
.design-card__badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  background: var(--ember);
  box-shadow: 0 6px 16px -8px rgba(20, 12, 10, .6);
}

/* Hover layer: the phone screen on wood panels, shown only once it loaded. */
.design-card__alt {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background-color: var(--navy-950);
  background-image:
    radial-gradient(60% 70% at 50% 45%, rgba(242, 162, 58, .28), rgba(10, 19, 34, 0) 70%),
    repeating-linear-gradient(90deg, #0A1322 0 2px, #16263F 2px 5px, #1F3A5F 5px 12px, #1A2F4D 12px 20px, #13223A 20px 26px, #0A1322 26px 28px);
  opacity: 0;
  transition: opacity .5s var(--ease-out);
}
.design-card__phone {
  height: 86%;
  aspect-ratio: 9 / 19.5;
  padding: 5px;
  border-radius: 22px;
  background: #140c0a;
  box-shadow: 0 0 0 1px rgba(148, 170, 204, .25), 0 24px 40px -16px rgba(0, 0, 0, .8);
}
.design-card__phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 17px; }
.has-alt:hover .design-card__alt,
.has-alt:focus-visible .design-card__alt { opacity: 1; }

.design-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px 26px 26px;
}
.design-card__cat {
  font-family: var(--font-label);
  font-weight: 500;
  font-size: .6875rem;
  line-height: 1.4;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ember-ink);
}
.design-card__name {
  margin-top: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1.1875rem, 1.05rem + .45vw, 1.375rem);
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--navy);
}
.design-card__tagline {
  margin-top: 10px;
  font-size: .9375rem;
  line-height: 1.55;
  color: var(--slate);
}
.design-card__systems {
  margin-top: auto;
  padding-top: 18px;
  font-family: var(--font-label);
  font-weight: 500;
  font-size: .75rem;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--navy);
}
.design-card__systems::before {
  content: "";
  display: block;
  height: 1px;
  margin-bottom: 14px;
  background: var(--line-light);
}
.design-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-label);
  font-weight: 500;
  font-size: .8125rem;
  color: var(--ember-ink);
}
.design-card__more svg { transition: transform .3s var(--ease-out); }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .design-card:hover { transform: translateY(-4px); }
  .design-card:hover .design-card__cover { transform: scale(1.035); }
  .design-card:hover .design-card__more svg { transform: translateX(3px); }
}

/* ---- CTA band ----------------------------------------------------------------- */
.shop-cta { padding: clamp(56px, 7vw, 96px) 0; }
.shop-cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
}
.shop-cta h2 { margin-top: 14px; max-width: 18ch; color: var(--ivory); }
.shop-cta__actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* ---- Responsive --------------------------------------------------------------- */
@media (max-width: 1099.98px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-grid:empty:not(.is-failed) { min-height: 2900px; }
}
@media (max-width: 859.98px) {
  .shop-head { grid-template-columns: 1fr; align-items: start; }
  .shop-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 639.98px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-grid:empty:not(.is-failed) { min-height: 5800px; }
  .shop-bar { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .shop-tabs { gap: 2px; }
  .shop-tab { padding-inline: 10px; letter-spacing: .12em; }
  .shop-cta__actions .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  img[data-fb], .design-card, .design-card__cover, .design-card__alt, .shop-tab { transition: none; }
}

/* The plain list the worker pre-renders for crawlers and no-JS visitors (shop.js replaces it with cards). */
.shop-static { grid-column: 1 / -1; }
.shop-static a { display: block; padding: 16px 0; border-bottom: 1px solid var(--line-light); text-decoration: none; color: var(--ink); }
.shop-static b { font-family: var(--font-head); font-weight: 600; font-size: 1.125rem; margin-right: .5em; }
.shop-static span { color: var(--slate); }
