/* =========================================================
   Political Idioms — storefront components
   Grid geometry adapted from the Motion Lab lab-card system.
   ========================================================= */

/* ---------------------------------------------------------
   Product grid
   --------------------------------------------------------- */
.pi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 1.7vw, 1.5rem);
}

.pi-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.pi-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition:
    border-color 0.4s var(--ease-out),
    transform 0.5s var(--ease-out),
    box-shadow 0.5s var(--ease-out);
}

.pi-card:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-lg);
}

.pi-card__link { display: flex; flex-direction: column; height: 100%; }

/* Products photograph on white, so the tile behind them carries the
   colour. Each card gets a different slice of the iridescent range. */
.pi-card__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--grad-iris-soft);
}

.pi-card:nth-child(4n + 2) .pi-card__media { background: linear-gradient(150deg, rgba(158, 200, 245, 0.55), rgba(163, 228, 208, 0.5)); }
.pi-card:nth-child(4n + 3) .pi-card__media { background: linear-gradient(150deg, rgba(255, 233, 168, 0.6), rgba(255, 203, 164, 0.55)); }
.pi-card:nth-child(4n + 4) .pi-card__media { background: linear-gradient(150deg, rgba(245, 168, 200, 0.55), rgba(184, 166, 242, 0.5)); }

.pi-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}

.pi-card:hover .pi-card__media img { transform: scale(1.04); }

.pi-card__badge {
  position: absolute;
  top: 0.85rem; left: 0.85rem;
  padding: 0.28rem 0.66rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.pi-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.05rem 1.15rem 1.25rem;
}

.pi-card__type {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.pi-card__title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.pi-card__price { margin-top: 0.15rem; font-size: 0.94rem; color: var(--text-2); }

/* Loading skeletons */
.pi-skeleton {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface-3);
  aspect-ratio: 4 / 6.1;
  animation: piPulse 1.4s ease-in-out infinite;
}

@keyframes piPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.85; } }

.pi-empty {
  padding: 3rem 0;
  color: var(--text-3);
  text-align: center;
}

.pi-more { margin-top: clamp(1.8rem, 4vw, 2.8rem); text-align: center; }

/* ---------------------------------------------------------
   Collection tiles
   --------------------------------------------------------- */
.pi-collection {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 270px;
  padding: 1.7rem 1.6rem 1.5rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--ease-out), border-color 0.4s, box-shadow 0.5s;
}

.pi-collection::before {
  content: '';
  position: absolute;
  right: -22%;
  bottom: -34%;
  z-index: -1;
  width: 76%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--grad-iris);
  opacity: 0.5;
  transition: transform 0.6s var(--ease-out), opacity 0.4s;
}

.pi-collection:hover::before { transform: scale(1.16); opacity: 0.68; }

.pi-collection:hover {
  border-color: var(--line);
  box-shadow: var(--shadow-lg);
}

.pi-collection__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--text-3);
}

.pi-collection h3 { font-size: 1.5rem; }
.pi-collection p { color: var(--text-2); font-size: 0.9rem; }

.pi-collection__go {
  margin-top: auto;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ---------------------------------------------------------
   Filter rail
   Segment (All/Mens/Womens/Accessories) stays as pills — only ever
   a handful of options. Type + sort are native selects so the list
   of garment types never wraps into a messy multi-row pile, and the
   control stays a single compact row even on narrow screens.
   --------------------------------------------------------- */
.pi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: clamp(1.6rem, 3vw, 2.4rem);
}

/* Shop's filter rail nests two full-width rows (segments, controls)
   inside .pi-filters so they stack instead of joining admin's flat row. */
.pi-filters__row {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pi-filters__spacer { flex: 1; }

.pi-sort {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.84rem;
}

.pi-filter {
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.84rem;
  color: var(--text-2);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.pi-filter:hover { color: var(--ink); border-color: var(--line-strong); background: #fff; }

.pi-filter.is-active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
  font-weight: 600;
}

.pi-select-wrap {
  position: relative;
  flex: 1 1 170px;
  min-width: 140px;
}

.pi-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 0.45rem 2rem 0.45rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}

.pi-select:hover { border-color: var(--line-strong); }
.pi-select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.pi-select-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 0.9rem;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-2);
  border-bottom: 1.5px solid var(--text-2);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* Two dropdowns side by side rather than stacked, even on the
   smallest screens — keeps the filter rail to two tidy rows. */
@media (max-width: 640px) {
  .pi-filters__controls { flex-wrap: nowrap; }
  .pi-select-wrap { flex: 1 1 50%; min-width: 0; }
}

.pi-filters__count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------------------------------------------------------
   Product detail
   --------------------------------------------------------- */
.pi-pdp {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1.8rem, 4vw, 4rem);
  align-items: start;
}

.pi-gallery { position: sticky; top: calc(var(--nav-h) + 1.5rem); display: grid; gap: 0.8rem; }

.pi-gallery__main {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--grad-iris-soft);
  box-shadow: var(--shadow-sm);
  aspect-ratio: 4 / 5;
}

.pi-gallery__main img { width: 100%; height: 100%; object-fit: cover; }

.pi-gallery__thumbs { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.pi-gallery__thumb {
  width: 70px;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface-3);
  transition: border-color 0.25s;
}

.pi-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.pi-gallery__thumb.is-active { border-color: var(--ink); }

.pi-pdp__title { font-size: clamp(1.9rem, 3.6vw, 2.9rem); margin-bottom: 0.7rem; }
.pi-pdp__price { font-size: 1.35rem; font-family: var(--font-display); font-weight: 600; color: var(--price); }
.pi-pdp__vat { font-size: 0.8rem; color: var(--text-3); margin-top: 0.2rem; }
.pi-pdp__short { margin: 1.3rem 0 1.8rem; color: var(--text-2); }

.pi-option { margin-bottom: 1.5rem; }

.pi-option__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.pi-option__name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.pi-option__value { font-size: 0.88rem; color: var(--text); }

.pi-option__link { font-size: 0.8rem; color: var(--violet); text-decoration: underline; text-underline-offset: 3px; }

.pi-choices { display: flex; flex-wrap: wrap; gap: 0.55rem; }

/* The radio itself stays in the accessibility tree; the label is the target. */
.pi-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pi-choice { position: relative; display: inline-flex; }

.pi-choice__box {
  display: grid;
  place-items: center;
  min-width: 3.1rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}

.pi-choice__box:hover { border-color: var(--line-strong); color: var(--ink); }

.pi-choice input:checked + .pi-choice__box {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.pi-choice input:focus-visible + .pi-choice__box {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.pi-choice__swatch {
  width: 2.5rem;
  height: 2.5rem;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--swatch-ring);
  box-shadow: inset 0 0 0 2px #fff;
  cursor: pointer;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}

.pi-choice input:checked + .pi-choice__swatch {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 3px #fff;
  transform: scale(1.06);
}

.pi-choice input:focus-visible + .pi-choice__swatch {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

.pi-pdp__cta { margin: 2rem 0 1rem; }

.pi-pdp__delivery {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-3);
  margin-bottom: 2rem;
}

.pi-pdp__delivery svg { flex: none; color: var(--violet); }

/* Accordions */
.pi-acc { border-top: 1px solid var(--line); }
.pi-acc details { border-bottom: 1px solid var(--line); }

.pi-acc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
}

.pi-acc summary::-webkit-details-marker { display: none; }

.pi-acc summary::after {
  content: '';
  width: 9px; height: 9px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.3s var(--ease-out);
}

.pi-acc details[open] summary::after { transform: rotate(-135deg) translate(-3px, -3px); }
.pi-acc__body { padding: 0 0 1.2rem; color: var(--text-2); font-size: 0.92rem; }
.pi-acc__body p { margin-bottom: 0.7rem; }

/* ---------------------------------------------------------
   Cart lines (drawer + cart page)
   --------------------------------------------------------- */
.pi-item {
  position: relative;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 28px;
  gap: 0.9rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.pi-item:last-child { border-bottom: 0; }

.pi-item__media {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--grad-iris-soft);
  aspect-ratio: 4 / 5;
}

.pi-item__media img { width: 100%; height: 100%; object-fit: cover; }

.pi-item__body { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.pi-item__title { font-weight: 600; font-size: 0.92rem; }
.pi-item__opts { font-size: 0.8rem; color: var(--text-3); }

.pi-item__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: auto;
}

.pi-item__price { font-size: 0.9rem; }

.pi-item__remove {
  align-self: start;
  color: var(--text-3);
  padding: 0.2rem;
  transition: color 0.25s;
}

.pi-item__remove:hover { color: var(--danger); }

.pi-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 100px;
  overflow: hidden;
}

.pi-qty button {
  width: 28px; height: 28px;
  color: var(--text-2);
  font-size: 1rem;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}

.pi-qty button:hover { color: var(--ink); background: rgba(16, 19, 28, 0.06); }
.pi-qty span { min-width: 26px; text-align: center; font-size: 0.86rem; }

.pi-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.pi-total b { font-family: var(--font-display); font-size: 1.2rem; }
.pi-total--muted { color: var(--text-3); font-size: 0.88rem; }

/* ---------------------------------------------------------
   Cart page
   --------------------------------------------------------- */
.pi-cart {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.85fr);
  gap: clamp(1.6rem, 4vw, 3.5rem);
  align-items: start;
}

.pi-summary {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
  display: grid;
  gap: 0.9rem;
  padding: 1.6rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.pi-freeship { display: grid; gap: 0.5rem; }

.pi-freeship__bar {
  height: 5px;
  border-radius: 100px;
  background: rgba(16, 19, 28, 0.08);
  overflow: hidden;
}

.pi-freeship__bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--grad-iris);
  transition: width 0.5s var(--ease-out);
}

.pi-freeship__text { font-size: 0.8rem; color: var(--text-3); }

/* ---------------------------------------------------------
   Auth / account / admin shells
   --------------------------------------------------------- */
.pi-panel {
  max-width: 460px;
  margin-inline: auto;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.pi-panel h1 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.pi-panel__sub { color: var(--text-3); font-size: 0.9rem; margin-bottom: 1.6rem; }
.pi-panel__foot { margin-top: 1.3rem; font-size: 0.87rem; color: var(--text-3); text-align: center; }
.pi-panel__foot a { color: var(--violet); }

/* Google sign-in. We paint our own button face and lay the real Google
   Identity Services button over it at zero opacity, so the GSI iframe is
   never visible — no giant unstyled logo flash while it loads. The wrapper
   is hidden until JS confirms a client ID has been injected server-side. */
.pi-oauth { position: relative; height: 44px; margin-bottom: 1.3rem; display: none; }
.pi-oauth[data-enabled='true'] { display: block; }

.pi-oauth__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  height: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-1);
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.pi-oauth:hover .pi-oauth__face { border-color: var(--line); box-shadow: var(--shadow-sm); }
.pi-oauth:focus-within .pi-oauth__face { outline: 2px solid var(--violet); outline-offset: 2px; }

.pi-oauth__gsi {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  cursor: pointer;
}

.pi-oauth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.3rem;
  color: var(--text-3);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pi-oauth-divider::before,
.pi-oauth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.pi-oauth:not([data-enabled='true']) + .pi-oauth-divider { display: none; }

/* Wide variant for account and admin shells. */
.pi-panel--wide { max-width: none; }

.pi-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.pi-table th, .pi-table td { padding: 0.75rem 0.7rem; text-align: left; border-bottom: 1px solid var(--line-soft); }

.pi-table th {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}

.pi-table tbody tr:hover { background: rgba(16, 19, 28, 0.025); }

.pi-status {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--text-2);
}

.pi-status--paid { color: var(--ok); border-color: rgba(20, 125, 77, 0.35); background: rgba(20, 125, 77, 0.06); }
.pi-status--dispatched { color: var(--violet); border-color: rgba(107, 79, 216, 0.35); background: rgba(107, 79, 216, 0.06); }
.pi-status--pending { color: var(--warn); border-color: rgba(180, 113, 29, 0.35); background: rgba(180, 113, 29, 0.06); }
.pi-status--cancelled,
.pi-status--refunded { color: var(--danger); border-color: rgba(198, 47, 57, 0.35); background: rgba(198, 47, 57, 0.06); }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 1100px) {
  .pi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .pi-pdp { grid-template-columns: 1fr; }
  .pi-gallery { position: static; }
  .pi-cart { grid-template-columns: 1fr; }
  .pi-summary { position: static; }
}

@media (max-width: 700px) {
  .pi-grid,
  .pi-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pi-card__body { padding: 0.85rem 0.9rem 1rem; }
  .pi-card__title { font-size: 0.94rem; }
}

@media (max-width: 400px) {
  .pi-grid,
  .pi-grid--3 { grid-template-columns: 1fr; }
}
