/* ==========================================================================
   STUDIO — categories.css
   Page-only styles for categories.html. Everything here is namespaced to this
   page's own blocks (.cindex, .cpan*, .mto*) so it can never leak into the kit.

   Rules kept, without exception:
     no gradients · hairlines instead of shadows · radii 8–12px ·
     150–220ms ease-out, no spring · logical properties only.
   ========================================================================== */

/* ==========================================================================
   THE INDEX STRIP — four quiet jump links to the four lines below.
   A flush ruled row: one hairline shared between neighbours, like .cards.
   ========================================================================== */
.cindex {
  margin-block-end: var(--sp-10);
}
.cindex__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border: var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
@media (min-width: 640px) {
  .cindex__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .cindex__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.cindex__item { display: flex; min-inline-size: 0; }

.cindex__link {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--sp-3);
  row-gap: var(--sp-1);
  inline-size: 100%;
  min-block-size: 76px;
  padding: var(--sp-5);
  background: var(--bg);
  /* a ring, not a border — neighbours collapse into one shared hairline */
  box-shadow: 0 0 0 1px var(--border);
  transition: background-color var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
.cindex__link:hover {
  background: var(--bg-hover);
  box-shadow: 0 0 0 1px var(--border-strong);
  z-index: 1;
}
.cindex__link:focus-visible { z-index: 2; }

.cindex__n {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  color: var(--text-accent);
  letter-spacing: var(--ls-label);
}
.cindex__name {
  font-size: var(--fs-h4);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-head);
  color: var(--text);
  transition: color var(--dur-2) var(--ease);
}
.cindex__link:hover .cindex__name { color: var(--text-accent); }

.cindex__count {
  grid-column: 2;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   THE LINE PANELS — one substantial tile per root category.
   Photo on one side, hierarchy on the other; the pair alternates down the
   page. Both sides are placed with GRID COLUMNS, which the browser reverses
   by itself in RTL — no left/right anywhere.
   ========================================================================== */
.cpans {
  display: grid;
  gap: var(--sp-8);
}

.cpan {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: var(--border-1);
  border-radius: var(--r-lg);
  background: var(--bg);
  overflow: hidden;
  scroll-margin-block-start: calc(var(--header-h) + var(--sp-6));
  transition: border-color var(--dur-2) var(--ease);
}
.cpan:hover { border-color: var(--border-strong); }

/* --- media ------------------------------------------------------------- */
.cpan__media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--bg-surface);
  border-block-end: var(--border-1);
  overflow: hidden;
}
.cpan__img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  /* the house crop: the marketing photos carry a burned-in phone number in
     the bottom ~10%. Spend the crop there and push the product up. */
  object-position: center 40%;
  transform: scale(1.12);
  transform-origin: center 32%;
  transition: transform var(--dur-4) var(--ease);
}
.cpan:hover .cpan__img { transform: scale(1.17); }

/* --- body -------------------------------------------------------------- */
.cpan__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-7) var(--sp-6) var(--sp-6);
  min-inline-size: 0;
}
@media (min-width: 640px) {
  .cpan__body { padding: var(--sp-8) var(--sp-8) var(--sp-7); }
}

.cpan__line { display: flex; align-items: center; gap: var(--sp-2); }

.cpan__name {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-head);
  line-height: var(--lh-head);
  margin-block-start: calc(var(--sp-2) * -1);
}
.cpan__link { color: var(--text); transition: color var(--dur-2) var(--ease); }
.cpan__link:hover { color: var(--text-accent); }

.cpan__count {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-block-start: calc(var(--sp-3) * -1);
}
/* the separator between "13 products" and "7 structures". It reads from the
   TEXT ramp, not the border ramp: --border-strong is #363C45 at night, which
   is ~1.6:1 on the ground — the dot simply vanished and the meta line ran
   together as "13 products 7 structures". */
.cpan__dot { color: var(--text-muted); }

.cpan__desc {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-secondary);
  max-inline-size: 58ch;
}

/* --- the child / product list ------------------------------------------ */
.cpan__sub {
  padding-block-start: var(--sp-5);
  border-block-start: var(--border-1);
}
.cpan__sublabel { margin-block-end: var(--sp-3); }

.cpan__list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
/* the child-category list is short-named — two columns. The product list
   (a childless line) carries full product names and stays one column. */
@media (min-width: 520px) {
  .cpan__list--kids { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--sp-6); }
}
.cpan__item { min-inline-size: 0; }

.cpan__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-block-size: 44px;
  padding-block: var(--sp-2);
  border-block-end: var(--border-1);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  transition: color var(--dur-2) var(--ease);
}
.cpan__row:hover { color: var(--text-accent); }

.cpan__row-name {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.cpan__row-meta {
  flex: none;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cpan__chev {
  flex: none;
  inline-size: 14px;
  block-size: 14px;
  color: var(--text-muted);
  transition: transform var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.cpan__row:hover .cpan__chev { color: var(--text-accent); transform: translateX(2px); }
/* the row's chevron is mirrored by .mirror in RTL — so nudge it the other way */
[dir="rtl"] .cpan__row:hover .cpan__chev { transform: scaleX(-1) translateX(2px); }

/* the zero-product line (Labels & Sleeves) gets the made-to-order note */
.cpan__note {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-secondary);
}

/* --- foot -------------------------------------------------------------- */
.cpan__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-block-start: var(--sp-5);
  margin-block-start: auto;   /* pinned to the foot of the panel */
  border-block-start: var(--border-1);
}
.cpan__foot .btn--link { min-inline-size: 0; }
.cpan__foot .btn--link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- 2-up, alternating, from 900px ------------------------------------- */
@media (min-width: 900px) {
  .cpan {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    align-items: stretch;
  }
  .cpan__media {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: auto;
    min-block-size: 420px;
    border-block-end: 0;
    border-inline-end: var(--border-1);
  }
  .cpan__body {
    grid-column: 2;
    grid-row: 1;
    padding: var(--sp-9);
  }
  /* every other panel puts the photo on the other side — grid columns, so RTL
     mirrors the whole rhythm for free */
  .cpan:nth-child(even) .cpan__media {
    grid-column: 2;
    border-inline-end: 0;
    border-inline-start: var(--border-1);
  }
  .cpan:nth-child(even) .cpan__body { grid-column: 1; }
}

@media (min-width: 1200px) {
  .cpan__media { min-block-size: 460px; }
  .cpan__name { font-size: var(--fs-h2); }
  .cpan__desc { font-size: var(--fs-body); }
}

/* ==========================================================================
   MADE-TO-ORDER — the page's one dark band.
   ========================================================================== */
.mto {
  display: grid;
  gap: var(--sp-8);
  align-items: start;
}
@media (min-width: 960px) {
  .mto {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    column-gap: var(--sp-11);
  }
}

.mto__lead { display: grid; gap: var(--sp-4); min-inline-size: 0; }
.mto__title {
  font-size: var(--fs-h2);
  letter-spacing: var(--ls-head);
  line-height: var(--lh-head);
  max-inline-size: 22ch;
}
.mto__text {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-on-ink-mut);
  max-inline-size: 58ch;
}

.mto__panel {
  display: grid;
  gap: var(--sp-6);
  padding: var(--sp-7);
  border: 1px solid var(--border-on-ink);
  border-radius: var(--r-lg);
  min-inline-size: 0;
}

.mto__list { display: grid; gap: 0; list-style: none; margin: 0; padding: 0; }
.mto__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding-block: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-on-ink);
}
.mto__item + .mto__item { border-block-start: 1px solid var(--border-on-ink); }
.mto__item::before {
  content: "";
  flex: none;
  inline-size: 6px;
  block-size: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-block-start: 0.55em;
}

.mto__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.mto__actions .btn { flex: 1 1 auto; }
@media (min-width: 520px) {
  .mto__actions .btn { flex: 0 1 auto; }
}
