/* KABox — "It arrives in the box." Line-drawn axonometric box that opens.
   Theme with custom properties on .kab (or any ancestor):
   --kab-ink, --kab-ink2, --kab-paper (MUST match the section background), --kab-accent,
   --kab-h-font, --kab-h-size, --kab-h-weight, --kab-h-track, --kab-h-lh, --kab-stroke */
.kab {
  --kab-ink: #1d1d1f;
  --kab-ink2: #6e6e73;
  --kab-paper: #fff;
  --kab-accent: #8a1538;
  --kab-stroke: 1.1px;
  --kab-h-size: 28px;
  --kab-h-weight: 600;
  --kab-h-track: -.022em;
  --kab-h-lh: 1.12;
  container-type: inline-size;
  color: var(--kab-ink);
}
.kab-in { display: grid; gap: 0; }
.kab-copy { max-width: 30em; }
.kab-h { margin: 0; font-family: var(--kab-h-font, inherit); font-size: var(--kab-h-size); font-weight: var(--kab-h-weight); letter-spacing: var(--kab-h-track); line-height: var(--kab-h-lh); text-wrap: balance; }
.kab-p { margin: 10px 0 0; font-size: 15px; line-height: 1.45; color: var(--kab-ink2); max-width: 26em; text-wrap: pretty; }
.kab[lang="ar"] .kab-h { letter-spacing: 0; line-height: 1.45; }
.kab[lang="ar"] .kab-p { line-height: 1.75; }
.kab-note { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--kab-ink2); opacity: .85; }

/* ── stage ── */
.kab-stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1.1; max-height: 72vh; max-height: 72svh; margin-block: 14px 8px;
  touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  cursor: grab; direction: ltr;
}
.kab-stage.kab-drag { cursor: grabbing; }
.kab-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }

.kab-ln { stroke: var(--kab-ink); stroke-width: var(--kab-stroke); stroke-linejoin: round; stroke-linecap: round; fill: var(--kab-paper); }
.kab-paper { fill: var(--kab-paper); }
.kab-nofill { fill: none; }
/* a whisper of maroon on the suede */
.kab-suede { fill: #f8f1f3; fill: color-mix(in srgb, var(--kab-accent) 5.5%, var(--kab-paper)); }
.kab-suede2 { fill: #f3e8eb; fill: color-mix(in srgb, var(--kab-accent) 10%, var(--kab-paper)); }
.kab-leather-in { fill: #fbf6f7; fill: color-mix(in srgb, var(--kab-accent) 2.5%, var(--kab-paper)); }
.kab-stitch { fill: none; stroke: var(--kab-ink); stroke-width: .8px; stroke-dasharray: 2.6 2.4; stroke-linecap: butt; stroke-linejoin: round; opacity: 0; }
.kab-fine { fill: none; stroke: var(--kab-ink); stroke-width: .7px; stroke-opacity: .5; stroke-linecap: round; stroke-linejoin: round; }
.kab-logo path { fill: var(--kab-accent); }
.kab-card .kab-ln { stroke-width: .9px; }
.kab-seal { fill: var(--kab-accent); }
.kab-dside { stroke: rgba(0, 0, 0, .28); stroke-width: .6px; stroke-linejoin: round; }
.kab-dedge { fill: none; stroke: rgba(0, 0, 0, .22); stroke-width: .7px; vector-effect: non-scaling-stroke; }

/* ── callouts ── */
.kab-lead path { fill: none; stroke: var(--kab-ink); stroke-width: .75px; stroke-opacity: .62; stroke-linejoin: round; stroke-linecap: round; }
.kab-lead circle { fill: var(--kab-ink); }
.kab-label {
  position: absolute; transform: translateY(-.68em); opacity: 0;
  font-size: 11px; line-height: 1.36; font-weight: 500; letter-spacing: .005em; color: var(--kab-ink); text-decoration: none;
  text-wrap: balance;
}
.kab-label span { display: block; }
.kab-l2 { color: var(--kab-ink2); font-weight: 400; }
.kab-l2:empty { display: none; }
a.kab-label .kab-l2 { color: var(--kab-accent); text-decoration: underline; text-decoration-thickness: .5px; text-underline-offset: 3px; }
a.kab-label::after { content: ""; position: absolute; inset: -12px -10px; }      /* 44px-ish touch target */
a.kab-label:focus-visible, .kab-replay:focus-visible { outline: 1.5px solid var(--kab-accent); outline-offset: 4px; border-radius: 4px; }
.kab[lang="ar"] .kab-label { letter-spacing: 0; line-height: 1.55; font-size: 11.5px; direction: rtl; }
.kab-wide .kab-label { font-size: 12.5px; }
.kab[lang="ar"] .kab-wide .kab-label { font-size: 13px; }

.kab-replay {
  position: absolute; inset-inline-end: 0; bottom: 0; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; background: none; color: var(--kab-ink2); cursor: pointer; padding: 0; transition: opacity .3s, color .2s; -webkit-tap-highlight-color: transparent;
}
.kab-replay:hover { color: var(--kab-ink); }

/* ── tablet: centred, deliberate ── */
@container (min-width: 640px) {
  .kab-in { justify-items: center; text-align: center; }
  .kab-h { font-size: calc(var(--kab-h-size) * 1.3); }
  .kab-p { margin-inline: auto; font-size: 16px; }
  .kab-stage { width: min(100%, 720px); aspect-ratio: 1 / .86; margin-block: 20px 10px; }
}
/* ── desktop: box large on one side, copy on the other ── */
@container (min-width: 960px) {
  .kab-in { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); grid-template-rows: 1fr auto auto 1fr; column-gap: 40px; justify-items: start; text-align: start; align-items: start; }
  .kab-stage { grid-column: 1; grid-row: 1 / -1; width: 100%; aspect-ratio: 1 / .92; max-height: 82vh; margin: 0; }
  .kab-copy { grid-column: 2; grid-row: 2; }
  .kab-note { grid-column: 2; grid-row: 3; margin-top: 22px; }
  .kab-h { font-size: calc(var(--kab-h-size) * 1.85); }
  .kab-p { margin: 18px 0 0; font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { .kab-replay { display: none; } }
.kab-label-serial span { white-space: nowrap; }
