/*
  BEASTMODE COLLECTIONS
  Owner: collections lane. Only loaded on collections.html.

  The chassis is the same site — same ground, same type, same hairlines — but
  the accent is re-pointed from the BeastMode red to an ember amber for this
  one page. Glass pumpkins next to a hard industrial red fight each other;
  warm amber sits with the orange and gold in the work instead of against it.
  Re-pointing --bmd-red at the root rather than restyling every component
  means the nav underline, buttons and rules all follow in one move.
*/

html[data-page="collections"] {
  --bmd-red:      #F0932B;
  --bmd-red-deep: #B4661A;
  --bmd-red-glow: rgba(240, 147, 43, 0.32);
}

/* contrast, measured the same way as tokens.css:
     #F0932B on --bmd-void   : 8.74:1  -- PASS AA any size
     --bmd-void on #F0932B   : 8.74:1  -- PASS AA any size
     #F0932B on --bmd-carbon : 8.36:1  -- PASS AA any size                   */

/* ------------------------------------------------------------------ grid */
.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-5, 1.5rem);
}

.cx-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 0;
}
.cx-card:focus-visible { outline: 2px solid var(--bmd-red); outline-offset: 4px; }

.cx-card__media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bmd-carbon);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
}
.cx-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s var(--ease-signature, cubic-bezier(0.16,1,0.3,1)),
              filter 0.4s ease;
  filter: saturate(0.92);
}
.cx-card:hover .cx-card__media img,
.cx-card:focus-visible .cx-card__media img {
  transform: scale(1.045);
  filter: saturate(1.05);
}
.cx-card__media::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow 0.3s ease;
  pointer-events: none;
}
.cx-card:hover .cx-card__media::after { box-shadow: inset 0 0 0 1px var(--bmd-red); }

.cx-card__badge {
  position: absolute;
  top: 0.7rem; right: 0.7rem;
  background: rgba(8, 9, 10, 0.82);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  padding: 0.28rem 0.5rem;
  font-size: 0.625rem;
  color: var(--bmd-red);
  backdrop-filter: blur(6px);
}

.cx-card__meta { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cx-card__name { font-weight: 600; color: var(--bmd-white); }
.cx-card__sub {
  color: var(--bmd-mist);
  font-size: 0.6875rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cx-empty { color: var(--bmd-mist); grid-column: 1 / -1; }

/* --------------------------------------------------------------- overlay */
.cx-detail {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.35s var(--ease-signature, cubic-bezier(0.16,1,0.3,1));
}
.cx-detail.is-open { opacity: 1; }

.cx-detail__scrim {
  position: absolute; inset: 0;
  background: rgba(5, 6, 7, 0.88);
  backdrop-filter: blur(10px);
}

.cx-detail__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 76rem);
  max-height: 100dvh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: clamp(1rem, 3vw, 2.5rem);
  transform: translateY(14px);
  transition: transform 0.45s var(--ease-signature, cubic-bezier(0.16,1,0.3,1));
}
.cx-detail.is-open .cx-detail__panel { transform: none; }

@media (max-width: 860px) {
  .cx-detail__panel { grid-template-columns: 1fr; align-content: start; }
}

.cx-close {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
  z-index: 3;
  width: 2.6rem; height: 2.6rem;
  font-size: 1.6rem;
  line-height: 1;
  background: var(--bmd-carbon);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  color: var(--bmd-mist);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.cx-close:hover { color: var(--bmd-red); border-color: var(--bmd-red); }
.cx-close:focus-visible { outline: 2px solid var(--bmd-red); outline-offset: 2px; }

/* ----------------------------------------------------------------- stage */
.cx-detail__stage { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }

.cx-stage {
  position: relative;
  aspect-ratio: 1;
  max-height: 74dvh;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(240,147,43,0.06), transparent 62%),
    var(--bmd-carbon);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  overflow: hidden;
  min-width: 0;
}

.spin__canvas {
  display: block;
  width: 100%; height: 100%;
  cursor: grab;
  touch-action: pan-y;   /* let the page scroll vertically; we take the X */
}
.cx-stage[data-grabbing="true"] .spin__canvas { cursor: grabbing; }
.spin__canvas:focus-visible { outline: 2px solid var(--bmd-red); outline-offset: -2px; }

.spin__hint {
  position: absolute;
  left: 50%; bottom: 1.1rem;
  transform: translateX(-50%);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--bmd-mist);
  background: rgba(8,9,10,0.7);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  padding: 0.35rem 0.7rem;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.spin__hint.is-gone { opacity: 0; transform: translateX(-50%) translateY(6px); }

.spin__load {
  position: absolute;
  left: 0; right: 0; top: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  transition: opacity 0.4s ease;
}
.spin__load i {
  display: block;
  height: 2px;
  width: 0;
  flex: 1;
  background: var(--bmd-red);
  transition: width 0.25s ease;
}
.spin__load-text {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.625rem;
  color: var(--bmd-mist);
  font-variant-numeric: tabular-nums;
}
.spin__load.is-done { opacity: 0; pointer-events: none; }

.cx-modes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.cx-mode {
  background: var(--bmd-carbon);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  color: var(--bmd-mist);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font-size: 0.625rem;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.cx-mode:hover { color: var(--bmd-white); }
.cx-mode[aria-selected="true"] {
  color: var(--bmd-void);
  background: var(--bmd-red);
  border-color: var(--bmd-red);
}
.cx-mode:focus-visible { outline: 2px solid var(--bmd-red); outline-offset: 2px; }

.cx-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.6rem;
  padding: 0.6rem;
  height: 100%;
  overflow-y: auto;
}
.cx-photo { margin: 0; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.cx-photo img {
  width: 100%;
  border-radius: 2px;
  display: block;
  background: var(--bmd-void);
}
.cx-photo figcaption { color: var(--bmd-mist); font-size: 0.625rem; }

.cx-video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

/* ------------------------------------------------------------------ card */
.cx-detail__card {
  background: var(--bmd-carbon);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  padding: clamp(1.1rem, 2.5vw, 1.8rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  align-self: start;
  min-width: 0;
}

.cx-flag {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.5625rem;
  letter-spacing: 0.12em;
  color: var(--bmd-void);
  background: var(--bmd-red);
  padding: 0.3rem 0.5rem;
  border-radius: 2px;
  align-self: flex-start;
}

.cx-name { margin: 0; }

.cx-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cx-chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.5625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bmd-mist);
  border: 1px solid var(--bmd-hairline);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.cx-facts { margin: 0; display: grid; gap: 0.55rem; }
.cx-fact { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; align-items: baseline; }
.cx-fact dt {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bmd-mist);
}
.cx-fact dd { margin: 0; color: var(--bmd-white); font-size: 0.875rem; min-width: 0; }
@media (max-width: 420px) {
  .cx-fact { grid-template-columns: 1fr; gap: 0.1rem; }
}

.cx-note {
  margin: 0;
  color: var(--bmd-mist);
  font-size: 0.9375rem;
  border-left: 1px solid var(--bmd-hairline);
  padding-left: 0.85rem;
}

.cx-inquire { align-self: flex-start; margin-top: 0.3rem; }

/* ------------------------------------------------------------------ form */
.cx-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 1px solid var(--bmd-hairline);
  padding-top: 1rem;
}
.cx-form[hidden] { display: none; }
.cx-form__lead { margin: 0; color: var(--bmd-mist); font-size: 0.875rem; }

.cx-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.cx-field span { color: var(--bmd-mist); }
.cx-field input,
.cx-field select,
.cx-field textarea {
  width: 100%;
  background: var(--bmd-void);
  border: 1px solid var(--bmd-hairline);
  border-radius: 2px;
  color: var(--bmd-white);
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.6rem 0.7rem;
}
.cx-field textarea { resize: vertical; }
.cx-field input:focus-visible,
.cx-field select:focus-visible,
.cx-field textarea:focus-visible {
  outline: 2px solid var(--bmd-red);
  outline-offset: 1px;
}

/* Honeypot: off-screen rather than display:none, because some bots skip
   anything hidden outright but will happily fill a field they can "see". */
.cx-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.cx-form__status { margin: 0; color: var(--bmd-red); font-size: 0.8125rem; min-height: 1.2em; }

@media (prefers-reduced-motion: reduce) {
  .cx-detail, .cx-detail__panel, .cx-card__media img { transition-duration: 0.01ms; }
}

/* --------------------------------------------------- controls row + speed */
.cx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.25rem;
  justify-content: space-between;
}

.cx-speed {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.cx-speed[hidden] { display: none; }
.cx-speed > span:first-child { color: var(--bmd-mist); font-size: 0.625rem; white-space: nowrap; }

.cx-speed input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(5rem, 16vw, 9rem);
  height: 2px;
  background: var(--bmd-ash);
  border-radius: 2px;
  cursor: pointer;
}
.cx-speed input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bmd-red);
  border: 0;
  cursor: grab;
}
.cx-speed input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bmd-red);
  border: 0;
  cursor: grab;
}
.cx-speed input[type="range"]:focus-visible { outline: 2px solid var(--bmd-red); outline-offset: 4px; }

.cx-speed__val {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.6875rem;
  color: var(--bmd-white);
  font-variant-numeric: tabular-nums;
  min-width: 2.6rem;
}

/* ------------------------------------------------- her own work, marked */
.cx-flag--laura {
  color: var(--bmd-void);
  background: var(--bmd-red);
}

.cx-card__own {
  position: absolute;
  left: 0.7rem; bottom: 0.7rem;
  background: var(--bmd-red);
  color: var(--bmd-void);
  border-radius: 2px;
  padding: 0.25rem 0.5rem;
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  font-weight: 600;
}
