/* =============================================================================
   app.css — prosjekt-spesifikke komponenter som ikke hører hjemme i
   designsystemet (tokens/base/components/screens). Leser KUN tokens/roller.
   Lastes etter screens.css, før tema- og branding-lagene.
========================================================================== */

/* ---- Matrise-bestilling: antall per størrelse i ett rutenett ---- */
.matrise {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}
.matrise__celle {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-md);
}
.matrise__str {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
}
.matrise__str small {
  color: var(--ink-muted);
  font-weight: var(--weight-regular);
}
.matrise__celle input {
  width: 100%;
  padding: var(--space-3);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  color: var(--ink);
  background: var(--field-bg);
  border: var(--hairline) solid var(--field-line);
  border-radius: var(--radius-sm);
}
.matrise__celle input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--focus-ring);
}

/* ---- Størrelsesvalg: synlige «pills» i stedet for nedtrekksmeny ---- */
.product__sizes { flex-basis: 100%; }
.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.size { position: relative; cursor: pointer; }
/* Selve radioknappen skjules visuelt, men beholdes for tastatur/skjermleser. */
.size__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.size__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: var(--control-h);
  padding: 0 var(--space-4);
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-md);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  color: var(--ink);
  user-select: none;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.size__pill small { color: var(--ink-muted); font-weight: var(--weight-regular); }
.size:hover .size__pill { border-color: var(--line-strong); }
.size__input:checked + .size__pill {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-hover);
}
.size__input:focus-visible + .size__pill {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--focus-ring);
}
/* ---- Fargevalg: prikker over størrelsene ----
   Selve fargeverdien kommer fra data (leverandørens fargenavn slått opp i
   api/farger.py) og settes som --swatch på elementet. All styling ligger her. */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-2);
}
.swatch { position: relative; cursor: pointer; line-height: 0; }
.swatch__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.swatch__dot {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill, 999px);
  background: var(--swatch, var(--surface));
  border: var(--hairline) solid var(--line);
  box-shadow: inset 0 0 0 2px var(--surface);
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
/* Lyse farger forsvinner mot lys bakgrunn — de får en tydeligere kant. */
.swatch--lys .swatch__dot { border-color: var(--line-strong); }
.swatch:hover .swatch__dot { border-color: var(--line-strong); }
.swatch__input:checked + .swatch__dot {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 2px var(--accent);
}
.swatch__input:focus-visible + .swatch__dot {
  outline: none;
  border-color: var(--focus);
  box-shadow: inset 0 0 0 2px var(--surface), var(--focus-ring);
}
/* Ukjent fargenavn: ingen hex å vise, så navnet står som en pille i stedet. */
.swatch__navn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--space-3);
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: normal;
  color: var(--ink);
}
.swatch__input:checked + .swatch__navn {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-hover);
}

/* Utsolgt størrelse, eller størrelse som ikke finnes i valgt farge. */
.size--disabled { cursor: not-allowed; }
.size--disabled .size__pill {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: var(--ink-faint);
}
.size--disabled:hover .size__pill { border-color: var(--line); }
