/* ---------------------------------------------------------------------------
   Product detail page (/devices/{slug}).

   Manufacturer-style layout: a large image with thumbnails on one side, the
   name, headline claims and the buy controls on the other, then the long
   description, the full spec table and related products underneath.

   Uses site.css tokens only, so it follows the light/dark toggle. Logical
   properties throughout so RTL mirrors itself. Never a bare .card selector.
--------------------------------------------------------------------------- */

.pd-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 108px 24px 80px;
}

/* ------------------------------------------------------------- crumbs --- */

.pd-crumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 26px;
}

.pd-crumbs a { color: var(--text-dim); text-decoration: none; }
.pd-crumbs a:hover { color: var(--accent); }
.pd-crumb-current { color: var(--text); font-weight: 600; }

/* -------------------------------------------------------------- layout --- */

.pd-top {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  margin-bottom: 20px;
}

/* ------------------------------------------------------------- gallery --- */

.pd-stage {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 18px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
}

.pd-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.25s ease;
}

.pd-flag {
  position: absolute;
  top: 16px;
  inset-inline-start: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.pd-thumbs {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pd-thumb {
  width: 84px;
  height: 66px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-raised);
  padding: 7px;
  cursor: pointer;
  transition: border-color 0.18s;
}

.pd-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumb:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.pd-thumb.is-on { border-color: var(--accent); }

/* ------------------------------------------------------------ buy side --- */

.pd-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 10px;
  margin-bottom: 14px;
}

.pd-name {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 12px;
}

.pd-tagline {
  font-size: 1.28rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 22px;
  max-width: 34ch;
}

.pd-highlights {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pd-highlights li {
  position: relative;
  padding-inline-start: 18px;
  color: var(--text-dim);
  line-height: 1.5;
}

.pd-highlights li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.pd-price-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pd-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.pd-price.is-quote { font-size: 1.15rem; font-weight: 600; color: var(--text-dim); }

.pd-stock { font-size: 0.92rem; color: var(--text-dim); }
.pd-stock.is-out { color: #d1495b; }

.pd-order { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }

.pd-qty {
  width: 78px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  text-align: center;
  padding: 12px 8px;
}

.pd-order-btn { flex: 1 1 240px; text-align: center; }
.pd-secondary { display: inline-block; margin-top: 12px; width: 100%; text-align: center; }

.pd-meta {
  margin: 26px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
}

.pd-meta dt { color: var(--text-dim); margin: 0; }
.pd-meta dd { margin: 0; font-family: ui-monospace, Consolas, monospace; color: var(--text); }

/* ------------------------------------------------------------ sections --- */

.pd-section { margin-top: 60px; }

.pd-section-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.pd-prose { max-width: 70ch; }
.pd-prose p { color: var(--text-dim); line-height: 1.7; margin: 0 0 1em; }

/* --------------------------------------------------------------- specs --- */

.pd-specs {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
}

.pd-spec-row {
  display: grid;
  grid-template-columns: minmax(180px, 32%) minmax(0, 1fr);
  gap: 18px;
  padding: 13px 20px;
}

.pd-spec-row:nth-child(odd) { background: var(--bg-raised); }

.pd-spec-row dt { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.pd-spec-row dd { margin: 0; color: var(--text); font-size: 0.95rem; }

/* -------------------------------------------------------------- facets --- */

.pd-facets { display: flex; flex-wrap: wrap; gap: 9px; }

.pd-facet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.87rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.pd-facet:hover { border-color: var(--accent); transform: translateY(-1px); }
.pd-facet-group { color: var(--text-dim); }

/* ------------------------------------------------------------- related --- */

.pd-related { text-decoration: none; color: inherit; display: flex; }
.pd-related .device-name { color: var(--text); }

/* ----------------------------------------------------------- responsive --- */

@media (max-width: 940px) {
  .pd-top { grid-template-columns: 1fr; gap: 32px; }
  .pd-tagline { max-width: none; }
}

@media (max-width: 560px) {
  .pd-page { padding-inline: 18px; padding-top: 92px; }
  .pd-spec-row { grid-template-columns: 1fr; gap: 4px; }
  .pd-order-btn { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-stage img, .pd-thumb, .pd-facet { transition: none; }
  .pd-facet:hover { transform: none; }
}
