/* components.css — filter bar, product grid, cards, modal, video, PDP.
   Cards follow Apple's product-card pattern: white surface, hairline
   border + whisper shadow, media on a light grey well, and a gentle
   scale-on-hover that never breaks the layout. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ── filter bar ──────────────────────────────────────────── */

.filters {
  position: sticky; top: 48px; z-index: 40;
  display: flex; flex-wrap: wrap; gap: 0.75rem 1rem;
  align-items: center;
  padding-block: 0.875rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
@media (min-width: 1024px) { .filters { top: 56px; } }

.search { position: relative; flex: 1 1 240px; min-width: 0; }
.search input {
  width: 100%; min-height: 40px;
  padding: 0.5rem 1rem 0.5rem 2.625rem;
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--grey-50); color: var(--ink);
  font-size: var(--text-sm);
  transition: background-color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--subtle); }
.search input:focus {
  background: var(--white);
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}
.search svg {
  position: absolute; left: 0.875rem; top: 50%; translate: 0 -50%;
  width: 16px; height: 16px; color: var(--subtle); pointer-events: none;
}

.chips { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  min-height: 36px; padding: 0.375rem 0.9375rem;
  border-radius: var(--radius-pill);
  background: var(--white); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: var(--text-sm); font-weight: 500; white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
}
.chip:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--subtle); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--white);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.count { margin-left: auto; font-size: var(--text-xs); color: var(--subtle); white-space: nowrap; }

.empty { grid-column: 1 / -1; text-align: center; padding-block: 4rem; }
.empty h3 { margin-bottom: 0.5rem; }
.empty .lede { margin-inline: auto; }

/* ── product grid: 1-up iPhone → 2-up iPad → 4-up 13" ──────── */

.grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  grid-template-columns: 1fr;
  padding-block: clamp(1.5rem, 4vw, 2.5rem);
}
@media (min-width: 600px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(4, 1fr); } }


/* ── card ────────────────────────────────────────────────── */

.card {
  position: relative; isolation: isolate;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--white);
  overflow: hidden;
  box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--line);
  transition: box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
/* Hover lift is desktop-only: on iOS/touch there is no hover, and a sticky
   :hover would leave cards permanently raised. */
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .card:focus-within {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line);
  }
}
.card[hidden] { display: none; }

.card__link { display: flex; flex-direction: column; flex: 1; }
.card__link:focus-visible { outline: none; }
.card:focus-within { box-shadow: var(--shadow-md), inset 0 0 0 2px var(--blue); }

.card__media {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--grey-50);
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover .card__media img { transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .card__media img { transition: none; }
}

/* badges: solid pills, not glass — reads cleaner over photography */
.card__badges {
  position: absolute; top: 0.625rem; left: 0.625rem;
  display: flex; flex-wrap: wrap; gap: 0.375rem; max-width: 75%;
}
.card__badge {
  padding: 0.1875rem 0.5rem; border-radius: var(--radius-pill);
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--ink);
}
.card__badge--blue { background: var(--blue); color: var(--white); box-shadow: none; }

.card__clip {
  position: absolute; right: 0.625rem; bottom: 0.625rem;
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.25rem 0.5rem; border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.62);
  color: var(--white);
  font-size: 0.6875rem; font-weight: 500;
}
.card__clip svg { width: 11px; height: 11px; }

.card__body {
  display: flex; flex-direction: column; gap: 0.375rem;
  flex: 1; padding: 1rem 1rem 1.125rem;
}
.card__title { font-size: 1.0625rem; font-weight: 600; }

.card__excerpt {
  font-size: var(--text-sm); line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.specs { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-top: 0.125rem; }
.specs li {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0.1875rem 0.5rem; border-radius: var(--radius-sm);
  background: var(--grey-50);
  font-size: 0.6875rem; color: var(--muted);
}
.specs b { font-weight: 500; color: var(--subtle); }

.card__price {
  margin-top: auto; padding-top: 0.75rem;
  font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em;
  color: var(--ink);
}

.card__cta {
  display: inline-flex; align-items: center; gap: 0.25rem;
  min-height: var(--tap); margin-top: 0.125rem;
  font-size: var(--text-sm); font-weight: 500; color: var(--accent);
}
.card__cta svg {
  width: 15px; height: 15px;
  transition: transform var(--duration-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover .card__cta svg { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .card__cta svg { transition: none; } }

/* Quick view is a full-width secondary action, not a floating pill */
.card__quick {
  margin: 0 1rem 1rem; min-height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  background: var(--grey-50); color: var(--ink);
  font-size: var(--text-sm); font-weight: 500;
  transition: background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card__quick:hover { background: var(--grey-100); }
}

/* ── quick-view modal ────────────────────────────────────── */

.modal {
  border: 0; padding: 0;
  width: min(100% - 1.5rem, 860px);
  max-height: min(88dvh, 860px);
  border-radius: var(--radius-xl);
  background: var(--white); color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal[open] { animation: pop var(--duration-base) var(--ease-out); }
@keyframes pop { from { opacity: 0; scale: 0.97; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }

.modal__grid { display: grid; }
@media (min-width: 700px) { .modal__grid { grid-template-columns: 1fr 1fr; } }
.modal__media { background: var(--grey-50); aspect-ratio: 1 / 1; }
.modal__media img { width: 100%; height: 100%; object-fit: cover; }
.modal__body {
  display: flex; flex-direction: column; gap: 0.625rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  overflow-y: auto; max-height: 88dvh;
}
.modal__close {
  position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2;
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.modal__close svg { width: 14px; height: 14px; }
.modal__title { font-size: 1.5rem; }
.modal__price { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.spec-list { margin-top: 0.25rem; display: grid; gap: 0; }
.spec-list li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-block: 0.6875rem; border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}
.spec-list b { font-weight: 400; color: var(--subtle); }

/* ── video ───────────────────────────────────────────────── */

.video {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  overflow: hidden; border-radius: var(--radius-lg);
  background: var(--grey-50);
}
.video--compact { border-radius: var(--radius-md); }
.video video,
.video iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.video video { object-fit: cover; }

.video__facade {
  position: absolute; inset: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 0; background: var(--grey-50); color: var(--ink);
}
.video__facade img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.92;
  transition: opacity var(--duration-base) var(--ease-out);
}
.video__facade:hover img { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .video__facade img { transition: none; } }
.video__play {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: scale var(--duration-base) var(--ease-out);
}
.video__play svg { width: 20px; height: 20px; margin-left: 2px; }
@media (hover: hover) and (pointer: fine) {
  .video__facade:hover .video__play { scale: 1.06; }
}
@media (prefers-reduced-motion: reduce) { .video__play { transition: none; } }

/* ── PDP ─────────────────────────────────────────────────── */

.pdp { display: grid; gap: clamp(1.75rem, 4vw, 3.5rem); padding-block: clamp(1.5rem, 4vw, 3rem); }
/* iPad portrait stays stacked; landscape and 13" go side-by-side */
@media (min-width: 1024px) {
  .pdp { grid-template-columns: 1.05fr 1fr; align-items: start; }
}

/* badges sit in flow above the title on the PDP, unlike on a catalogue card */
.pdp__badges { position: static; max-width: none; margin: 0 0 0.75rem; }

.pdp__gallery { display: grid; gap: 0.75rem; }
.pdp__main {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--radius-xl); background: var(--grey-50);
  box-shadow: var(--shadow-xs);
}
.pdp__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.625rem; }
.pdp__thumb {
  padding: 0; aspect-ratio: 1 / 1; overflow: clip;
  border-radius: var(--radius-md); background: var(--grey-50);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow var(--duration-fast) var(--ease-out);
}
.pdp__thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; }
.pdp__thumb[aria-current] { box-shadow: inset 0 0 0 2px var(--blue); }
.pdp__thumb[aria-current] img { opacity: 1; }

/* Buy block becomes a sticky bar on 13" so the CTA is always reachable */
.pdp__info > * + * { margin-top: 1.5rem; }
.pdp__title { font-size: var(--text-title); }
.pdp__price { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.025em; }
.pdp__meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  font-size: var(--text-sm); color: var(--subtle);
}
.pdp__buy { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.pdp__buy .btn { flex: 1 1 180px; }

@media (min-width: 1024px) {
  .pdp__info { position: sticky; top: 88px; }
}

.accordion { border-top: 1px solid var(--line); }
.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: var(--tap); padding-block: 0.9375rem; cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after {
  content: "+"; font-size: 1.25rem; font-weight: 300; color: var(--subtle);
  transition: rotate var(--duration-base) var(--ease-out);
}
.accordion details[open] summary::after { rotate: 45deg; }
.accordion .accordion__body {
  padding-bottom: 1.25rem; color: var(--muted); font-size: var(--text-sm);
  line-height: 1.55;
}

/* ── toast ───────────────────────────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: max(1.5rem, env(safe-area-inset-bottom));
  translate: -50% 180%; z-index: 90;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.125rem; border-radius: var(--radius-pill);
  background: var(--black); color: var(--white);
  font-size: var(--text-sm); font-weight: 500;
  box-shadow: var(--shadow-lg);
  transition: translate var(--duration-base) var(--ease-out);
}
.toast[data-show] { translate: -50% 0; }
.toast svg { width: 15px; height: 15px; color: var(--blue); }

/* ── mobile drawer ───────────────────────────────────────── */

.drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 60;
  width: min(84%, 340px); padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  background: var(--white); border-left: 1px solid var(--line);
  translate: 100% 0;
  transition: translate var(--duration-base) var(--ease-out);
  display: flex; flex-direction: column; gap: 1rem;
  overflow-y: auto;
}
.drawer[data-open] { translate: 0 0; box-shadow: var(--shadow-lg); }
.drawer a {
  display: block; padding-block: 0.875rem;
  font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
}
.drawer__head { display: flex; justify-content: space-between; align-items: center; }
.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0; pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}
.scrim[data-open] { opacity: 1; pointer-events: auto; }
@media (min-width: 900px) {
  .drawer, .scrim, .hdr__burger { display: none; }
}

