/*
 * Shared by every RADAR page: design tokens, base elements, the header and
 * navigation, garments (the product card), dialogs and the concept bag, the
 * footer, page transitions and small utilities. Dark is the default theme;
 * [data-theme='light'] rules follow the part they adjust.
 */

/* Design tokens */
:root {
  --paper: #000;
  --ink: #f1f1f1;
  --muted: #999;
  --rule: #292929;
  --gutter: clamp(20px, 4vw, 64px);
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
:root[data-theme='light'] {
  --paper: #f3f2ee;
  --ink: #141414;
  --muted: #6b6b6b;
  --rule: #d9d8d3;
}

/* Base elements and utilities */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
body.locked {
  overflow: hidden;
}
a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: 0;
  padding: 0;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}
img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
::selection {
  background: #ddd;
  color: #000;
}
[data-theme='light'] ::selection {
  background: #222;
  color: #f3f2ee;
}
.mono {
  font: 11px/1.55 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.035em;
}
.muted {
  color: var(--muted);
}
.wrap {
  padding-inline: var(--gutter);
}
[hidden] {
  display: none !important;
}
/* The large page title ("COLLECTIONS", "CATALOGUE"). */
.page-title {
  font-size: clamp(48px, 8.5vw, 130px);
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.9;
  margin: 18px 0 0;
}
/* Label and value rows in a piece's readout (product page, catalogue contact
   panel). */
.readout-label {
  font: 10px var(--mono);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 2px;
}
.readout-value {
  margin: 0;
  font-size: 13px;
}
/* A dotted ring drawn as SVG (radar.ringSvg(), and the homepage locator):
   round dots come from a zero-length dash with round caps. Components set
   the stroke colour. */
.ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.ring-svg circle {
  fill: none;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-dasharray: 0 1;
}
/* A radar canvas filling its stage, behind everything in it. */
.radar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header and navigation */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-top: 30px;
  position: relative;
  z-index: 1;
}
.brand {
  display: block;
  width: 136px;
  height: auto;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
}
.brand img {
  height: auto;
  object-fit: contain;
}
[data-theme='light'] .brand img {
  filter: invert(0.92);
}
.nav {
  display: flex;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  gap: 32px;
  font: 11px var(--mono);
  letter-spacing: 0.06em;
}
.nav a {
  padding: 10px 0;
}
.nav a:hover {
  opacity: 0.6;
}
.nav a[aria-current='page'] {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.menu-button {
  display: none;
}
.theme-toggle {
  font: 11px var(--mono);
}
/* The product and catalogue pages' "← back" link, left of the logo. */
.crumb {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  font: 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 0;
}
.crumb:hover {
  opacity: 0.6;
}
@media (max-width: 1000px) {
  .nav {
    gap: 22px;
  }
}
/* Medium screens: the navigation moves onto its own row below the logo. */
@media (min-width: 701px) and (max-width: 900px) {
  .nav {
    grid-column: 1/-1;
    grid-row: 2;
    justify-self: center;
    margin-top: 18px;
    gap: 28px;
  }
}
/* Small screens: the navigation folds into a menu. */
@media (max-width: 700px) {
  .header {
    padding-top: 18px;
  }
  .brand {
    width: 108px;
  }
  .menu-button {
    display: block;
    font: 11px var(--mono);
    z-index: 3;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
  .nav {
    display: none;
    position: absolute;
    top: 88px;
    justify-self: stretch;
    left: var(--gutter);
    right: var(--gutter);
    background: #000;
    z-index: 2;
    border-top: 1px solid #444;
    padding: 20px 0;
  }
  .nav.open {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .nav a {
    font-size: 14px;
    padding: 10px 0;
  }
  [data-theme='light'] .nav {
    background: var(--paper);
    border-top-color: #c9c8c3;
  }
  .crumb {
    font-size: 10px;
  }
  .crumb-trail {
    display: none;
  }
}

/*
 * Garments: illustrative tees standing in a soft pool of light that
 * separates them from the radar field behind.
 */
.garment-space {
  height: clamp(240px, 34svh, 410px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  isolation: isolate;
  background: none;
}
/* The light, feathered to an oval inside its own box so it never ends in a
   hard edge on any card or stage. */
.garment-space:before {
  content: '';
  position: absolute;
  inset: -10% -12% -8%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 47%,
    #292929 0%,
    #202020 29%,
    #111 49%,
    rgba(0, 0, 0, 0) 73%
  );
  opacity: var(--focus-light, 1);
  transition: opacity 0.25s;
  -webkit-mask-image: radial-gradient(closest-side, #000 62%, transparent);
  mask-image: radial-gradient(closest-side, #000 62%, transparent);
}
.garment-space:has(.concept-tee.dark):before {
  background: radial-gradient(
    ellipse at 50% 47%,
    #505050 0%,
    #404040 27%,
    #252525 44%,
    #111 58%,
    rgba(0, 0, 0, 0) 76%
  );
}
/* In the light theme chalk garments need the stronger backdrop; washed black
   separates on its own. */
[data-theme='light'] .garment-space:before {
  background: radial-gradient(
    ellipse at 50% 47%,
    #d2d1cb 0%,
    #d9d8d2 29%,
    #e5e4df 49%,
    rgba(243, 242, 238, 0) 73%
  );
}
[data-theme='light'] .garment-space:has(.concept-tee.dark):before {
  background: radial-gradient(
    ellipse at 50% 47%,
    #e3e2dd 0%,
    #e9e8e3 35%,
    rgba(243, 242, 238, 0) 70%
  );
}
@media (prefers-reduced-motion: reduce) {
  .garment-space:before {
    transition: none;
  }
}
.signal-tag {
  position: absolute;
  top: 0;
  left: 0;
  color: #aaa;
  font: 9px var(--mono);
  letter-spacing: 0.05em;
  z-index: 1;
}
[data-theme='light'] .signal-tag {
  color: #666;
}
/* The tee: a gradient clipped to a T-shirt silhouette, with a collar and a
   faint hem line drawn by its pseudo-elements. */
.concept-tee {
  position: relative;
  width: 88%;
  height: 90%;
  max-width: 320px;
  background: linear-gradient(
    95deg,
    #b8b5ad,
    #e3dfd4 22%,
    #eee9df 48%,
    #c5c2ba 78%,
    #e2ded3
  );
  clip-path: polygon(
    23% 6%,
    38% 0,
    43% 6%,
    57% 6%,
    62% 0,
    77% 6%,
    100% 22%,
    88% 42%,
    76% 32%,
    77% 100%,
    23% 100%,
    24% 32%,
    12% 42%,
    0 22%
  );
}
.concept-tee:before {
  content: '';
  position: absolute;
  left: 39%;
  top: 0;
  width: 22%;
  height: 10%;
  border: 3px solid #aaa59b;
  border-radius: 0 0 50% 50%;
  background: #000;
}
.concept-tee:after {
  content: '';
  position: absolute;
  bottom: 2%;
  left: 24%;
  right: 24%;
  border-bottom: 1px solid #aaa;
  opacity: 0.35;
}
.concept-tee.dark {
  background: linear-gradient(
    95deg,
    #1c1c1c,
    #303030 25%,
    #424242 48%,
    #252525 78%,
    #333
  );
}
.concept-tee.dark:before {
  border-color: #444;
}
.concept-tee img {
  position: absolute;
  top: 27%;
  left: 28%;
  width: 44%;
  height: 44%;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.concept-tee.dark img {
  mix-blend-mode: normal;
}
/* Every product card is a block link whose image can't be dragged away. */
.product-card {
  display: block;
  -webkit-user-drag: none;
}
/* The caption sits on a solid band so the radar never shows through text. */
.piece-caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 4px 0;
  font-size: 14px;
  line-height: 1.4;
  position: relative;
  isolation: isolate;
  align-items: baseline;
  border-top: 1px solid #ffffff21;
  color: #f2f2ee;
}
.piece-caption:before {
  content: '';
  position: absolute;
  inset: 0 -6px -24px;
  background: #000;
  z-index: -1;
  pointer-events: none;
}
.piece-caption .mono {
  font-size: 11px;
  white-space: nowrap;
  color: #ddd;
}
.piece-caption del {
  color: #999;
  display: block;
  font-size: 9px;
}
.piece-meta {
  font: 9px var(--mono);
  color: #aaa;
  margin: 8px 4px 0;
  position: relative;
  line-height: 1.5;
}
[data-theme='light'] .piece-caption {
  border-top-color: rgba(0, 0, 0, 0.14);
  color: var(--ink);
}
[data-theme='light'] .piece-caption:before {
  background: var(--paper);
}
[data-theme='light'] .piece-caption .mono {
  color: #2a2a2a;
}
[data-theme='light'] .piece-caption del {
  color: var(--muted);
}
[data-theme='light'] .piece-meta {
  color: #5c5c5c;
}

/* Dialogs and the concept bag */
dialog {
  border: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  width: min(1160px, calc(100% - 64px));
  max-height: 90svh;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
}
[data-theme='light'] dialog::backdrop {
  background: rgba(20, 20, 20, 0.38);
}
.detail-bar {
  display: flex;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.bag-items {
  padding: 25px;
  max-height: 65svh;
  overflow: auto;
}
.bag-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 18px 0;
  border-bottom: 1px solid #333;
  font-size: 14px;
  align-items: center;
}
[data-theme='light'] .bag-row {
  border-bottom-color: var(--rule);
}
.bag-row a {
  flex: 1;
}
.bag-row a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.bag-size {
  color: var(--muted);
  min-width: 64px;
}
.bag-qty {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bag-qty button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  font: 12px var(--mono);
}
.bag-qty button:hover {
  border-color: var(--ink);
}
.bag-total {
  display: flex;
  justify-content: space-between;
  padding-top: 18px;
}
.bag-note {
  padding: 0 25px 25px;
  color: #999;
  font-size: 12px;
}
[data-theme='light'] .bag-note {
  color: var(--muted);
}
/* The header's bag button, which gives a brief radar ping when a piece is
   added. */
.bag-open {
  font: 11px var(--mono);
  position: relative;
}
.bag-open.pinged:after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  animation: bag-ping 0.7s ease-out;
}
@keyframes bag-ping {
  from {
    transform: scale(0.4);
    opacity: 0.9;
  }
  to {
    transform: scale(5);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bag-open.pinged:after {
    animation: none;
  }
}
@media (max-width: 700px) {
  .detail-bar {
    padding: 16px;
  }
  dialog {
    width: calc(100% - 24px);
    max-height: 92svh;
  }
  .bag-row {
    flex-wrap: wrap;
    gap: 12px 20px;
  }
  .bag-row a {
    flex-basis: 100%;
  }
}

/* Footer */
.field-footer {
  padding: 50px var(--gutter) 30px;
  border-top: 1px solid #333;
  display: flex;
  justify-content: space-between;
  gap: 25px;
  font: 10px/1.6 var(--mono);
  color: #888;
}
.field-footer a {
  color: #ddd;
  text-decoration: underline;
  text-underline-offset: 4px;
}
[data-theme='light'] .field-footer {
  border-top-color: var(--rule);
  color: var(--muted);
}
[data-theme='light'] .field-footer a {
  color: #222;
}
@media (max-width: 700px) {
  .field-footer {
    flex-direction: column;
    padding-bottom: 40px;
  }
}

/* Page to page: the clicked garment morphs into the product stage
   (cross-document view transitions). */
@view-transition {
  navigation: auto;
}
::view-transition-group(piece) {
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.3, 0.7, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* Development: marks stress-test data (core/dev-tools.js). */
.stress-badge {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 60;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  background: var(--ink);
  color: var(--paper);
  font: 10px var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.stress-badge button {
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

/* Data couldn't be loaded: a calm explanation and a retry, in place of the
   missing content (showLoadError() in core/data.js). */
.load-error {
  grid-column: 1/-1;
  min-height: 40svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  padding: 40px var(--gutter);
}
.wrap .load-error {
  padding-inline: 0;
}
.load-error h2 {
  font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.04em;
  margin: 0;
}
.load-error p {
  color: var(--muted);
  margin: 0 0 6px;
}
.load-retry {
  border: 1px solid var(--ink);
  padding: 12px 16px;
  font: 11px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.load-retry:hover {
  background: var(--ink);
  color: var(--paper);
}
