/* =====================================================================
   Spawn Edge — the public catalogue at /items/

   Loaded after css/landing.css, which is where the palette, the type
   stack and the .signin pill come from. Nothing here invents a colour:
   every value below is one of the landing page's tokens, or an alpha of
   one of its literals.

   The page is read on a phone in a barn as often as on a desk, so the
   grid is one column early, the tap targets are large, and nothing
   depends on hover to be discoverable.
   ===================================================================== */

/* ------------------------------------------------------------- tokens */
.cat {
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', 'Courier New', monospace;

  /* surfaces, all drawn from --bg-sunken / --bg-void with alpha */
  --card:      rgba(9, 14, 21, 0.62);
  --card-hi:   rgba(13, 21, 30, 0.86);
  --sheet:     #080c12;
  --hair-soft: rgba(233, 238, 246, 0.08);

  --pad:  clamp(16px, 4.2vw, 44px);
  --maxw: 1320px;
  --r:    14px;
}

/* landing.css pins html and body to the viewport for a one-screen scene.
   This page scrolls, so it needs the height back — but the horizontal
   clip stays, because nothing here may ever scroll sideways. */
html:has(.cat), .cat { height: auto; min-height: 100%; }
.cat { background: var(--bg-base); }

/* the ground glow, held still behind the page. A fixed pseudo-element
   rather than background-attachment: fixed, which repaints the whole
   viewport on every scroll frame on a phone. */
.cat::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 62% at 50% -10%, rgba(24, 104, 94, 0.20) 0%, rgba(10, 14, 20, 0) 62%),
    radial-gradient(90% 48% at 12% 4%, rgba(21, 78, 104, 0.16) 0%, rgba(10, 14, 20, 0) 60%),
    var(--bg-base);
}

/* `hidden` has to beat the grid and flex displays below */
.cat [hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
  html:has(.cat) { scroll-behavior: smooth; }
}

.cat :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  padding: 12px 18px;
  background: var(--bg-sunken);
  border: 1px solid var(--hair);
  border-radius: 0 0 10px 0;
  color: var(--ink);
  font-size: 0.8125rem;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------- header */
.hdr {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(6, 9, 13, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
          backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--hair-soft);
}
.hdr__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--pad);
  padding-left: max(var(--pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}

.mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.34em;
  color: var(--ink);
  font-size: clamp(0.875rem, 1.6vmin, 1.0625rem);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.mark__a { color: #f4f8fd; }
.mark__b {
  color: var(--accent);
  margin-right: -0.2em;
  text-shadow: 0 0 18px rgba(46, 216, 160, 0.35);
}
.mark:hover .mark__b { color: var(--accent-hi); }

.hdr__nav { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------ pills, one family --
   .signin is landing.css's, reused as it stands. .pill is the same
   geometry for the things that are not links. */
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 11px 18px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.46);
  color: var(--ink);
  font-family: inherit;
  font-size: clamp(0.6875rem, 1.15vmin, 0.8125rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 220ms ease, border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
}
.pill:hover {
  color: var(--accent-hi);
  border-color: rgba(46, 216, 160, 0.46);
  background: rgba(8, 26, 24, 0.6);
  transform: translateY(-1px);
}
.pill:active { transform: translateY(0); }
.pill[disabled] { opacity: 0.55; cursor: default; transform: none; }

.pill--go {
  border-color: rgba(46, 216, 160, 0.5);
  background: rgba(18, 105, 95, 0.34);
  color: var(--accent-hi);
}
.pill--go:hover {
  border-color: rgba(143, 242, 208, 0.7);
  background: rgba(24, 128, 112, 0.46);
  color: #eafff7;
}
.pill--lg { padding: 15px 26px; }

/* ---------------------------------------------------------- the page */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 6vmin, 64px) var(--pad) 0;
  padding-left: max(var(--pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
}

.intro { max-width: 62ch; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}
.intro__h {
  margin: 0;
  font-size: clamp(2rem, 5.4vw, 3.4rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.015em;
}
.lede {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: clamp(0.9375rem, 1.9vw, 1.0625rem);
  line-height: 1.62;
}

/* --------------------------------------------------- search and chips */
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin: clamp(26px, 5vmin, 44px) 0 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hair-soft);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 420px;
}
.search__icon {
  position: absolute;
  left: 14px;
  color: var(--ink-soft);
  pointer-events: none;
}
.search__in {
  width: 100%;
  min-width: 0;
  padding: 13px 40px 13px 42px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.2;
  -webkit-appearance: none;
          appearance: none;
}
.search__in::placeholder { color: var(--ink-soft); opacity: 0.72; }
.search__in::-webkit-search-cancel-button { -webkit-appearance: none; }
.search__in:focus { border-color: rgba(46, 216, 160, 0.5); outline-offset: 1px; }
.search__x {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.search__x:hover { color: var(--accent-hi); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 15px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.4);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}
.chip:hover { color: var(--ink); border-color: rgba(46, 216, 160, 0.4); }
.chip[aria-pressed="true"] {
  color: #04120e;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.count {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------ the grid */
.catalogue { margin: 18px 0 0; outline: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--hair-soft);
  border-radius: var(--r);
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
}
.card:hover {
  border-color: rgba(46, 216, 160, 0.4);
  background: var(--card-hi);
  transform: translateY(-2px);
}
.card:active { transform: translateY(0); }

.card__shot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(18, 105, 95, 0.16), rgba(4, 7, 12, 0.6));
  border-bottom: 1px solid var(--hair-soft);
}
.card__shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card:hover .card__shot img { filter: brightness(1.06); }

/* the mark that stands in for a picture that is not there */
.ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background:
    radial-gradient(58% 58% at 50% 62%, rgba(46, 216, 160, 0.13) 0%, rgba(4, 7, 12, 0) 70%);
}
.ph__svg { width: 46%; max-width: 132px; height: auto; opacity: 0.5; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px 17px;
  min-width: 0;
}
.card__name {
  display: block;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
}
.sku {
  display: block;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}
.card__desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-height: 4.9em;
  color: var(--ink-soft);
  font-size: 0.875rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--hair-soft);
  border-radius: 999px;
  background: rgba(233, 238, 246, 0.04);
  color: var(--ink-soft);
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.badge--cat {
  border-color: rgba(46, 216, 160, 0.28);
  background: rgba(18, 105, 95, 0.2);
  color: var(--accent-hi);
}
.badge--sp { font-style: italic; }

.stock {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  /* the card body is a column: this drops the stock line to the foot, so a
     row of cards lines its stock figures up however tall the copy above is */
  margin-top: auto;
  padding-top: 2px;
  color: var(--accent-hi);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}
.stock::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(46, 216, 160, 0.8);
}
.stock--out { color: var(--ink-soft); }
.stock--out::before { background: var(--ink-soft); box-shadow: none; }

/* ------------------------------------------------ loading and notices */
.ghost {
  height: 302px;
  border: 1px solid var(--hair-soft);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(13, 21, 30, 0.7) 0 58%, rgba(9, 14, 21, 0.5) 58% 100%);
  animation: ghostPulse 1.9s ease-in-out infinite;
}
.ghost:nth-child(2) { animation-delay: 0.12s; }
.ghost:nth-child(3) { animation-delay: 0.24s; }
.ghost:nth-child(4) { animation-delay: 0.36s; }
.ghost:nth-child(5) { animation-delay: 0.48s; }
.ghost:nth-child(6) { animation-delay: 0.6s; }
@keyframes ghostPulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.85; } }

.note {
  max-width: 56ch;
  margin: clamp(18px, 4vmin, 40px) auto;
  padding: clamp(24px, 4vmin, 38px);
  border: 1px solid var(--hair-soft);
  border-radius: var(--r);
  background: var(--card);
  text-align: center;
}
.note--bad { border-color: rgba(233, 238, 246, 0.16); }
.note__h { margin: 0; font-size: 1.25rem; font-weight: 600; }
.note__p { margin: 12px 0 20px; color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.6; }

/* ----------------------------------------------------------- the ask */
.ask {
  margin: clamp(46px, 9vmin, 96px) 0 clamp(30px, 6vmin, 60px);
  padding: clamp(28px, 5vmin, 52px) var(--pad);
  border: 1px solid rgba(46, 216, 160, 0.22);
  border-radius: calc(var(--r) + 6px);
  background:
    radial-gradient(80% 140% at 12% 0%, rgba(18, 105, 95, 0.28) 0%, rgba(6, 9, 13, 0) 70%),
    var(--card);
}
.ask__in { max-width: 62ch; }
.ask__h { margin: 0; font-size: clamp(1.35rem, 3.4vw, 1.9rem); font-weight: 600; line-height: 1.2; }
.ask__p { margin: 14px 0 24px; color: var(--ink-soft); font-size: 1rem; line-height: 1.62; }
.ask__act { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
.ask__alt { color: var(--ink-soft); font-size: 0.875rem; }
.ask__alt a { color: var(--accent-hi); text-underline-offset: 3px; }

.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px var(--pad) calc(30px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hair-soft);
}
.foot__p { margin: 0; color: var(--ink-soft); font-size: 0.8125rem; letter-spacing: 0.02em; }
.foot__p a { color: var(--ink); text-decoration: none; }
.foot__p a:hover { color: var(--accent-hi); }

/* =========================================================== the sheet */
.sheet {
  width: min(980px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(88vh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(46, 216, 160, 0.24);
  border-radius: 16px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 40px 90px rgba(2, 4, 8, 0.7);
}
.sheet::backdrop { background: rgba(3, 6, 11, 0.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet:not([open]) { display: none; }
.sheet--ask { width: min(560px, calc(100vw - 32px)); }

.sheet__in {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  max-height: inherit;
  overflow: hidden;
}
.sheet__in--one { display: block; overflow-y: auto; max-height: min(88vh, 900px); }

.sheet__x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(6, 10, 16, 0.72);
  color: var(--ink);
  cursor: pointer;
}
.sheet__x:hover { color: var(--accent-hi); border-color: rgba(46, 216, 160, 0.46); }

.sheet__media {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(4, 7, 12, 0.6);
  min-width: 0;
  overflow-y: auto;
}
.shot {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(18, 105, 95, 0.16), rgba(4, 7, 12, 0.6));
}
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--hair-soft);
  border-radius: 8px;
  background: rgba(4, 7, 12, 0.6);
  cursor: pointer;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-current="true"] { border-color: var(--accent); }
.thumb:hover { border-color: rgba(46, 216, 160, 0.5); }

.sheet__body {
  min-width: 0;
  padding: clamp(20px, 3vw, 32px);
  padding-right: clamp(20px, 3vw, 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet__h {
  margin: 0 42px 0 0;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.sku--lg { margin: 8px 0 0; font-size: 0.8125rem; }
.sheet__body .badges { margin-top: 14px; }
.sheet__body .stock { margin-top: 14px; padding-top: 0; }
.sheet__desc {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.specs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 18px;
  margin: 20px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--hair-soft);
  font-size: 0.875rem;
}
.specs dt { color: var(--ink-soft); }
.specs dd { margin: 0; overflow-wrap: anywhere; }
.sheet__note {
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.55;
  opacity: 0.85;
}
.sheet__act { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }

.sheet__sub {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.62;
}

/* ------------------------------------------------------------- form */
.form, .done { padding: clamp(22px, 4vw, 34px); }
.form__act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.f { margin-top: 18px; }
.f__l {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.f__req {
  color: var(--ink-soft);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}
.f__i {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--hair);
  border-radius: 10px;
  background: rgba(4, 7, 12, 0.66);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  -webkit-appearance: none;
          appearance: none;
}
.f__i:focus { border-color: rgba(46, 216, 160, 0.5); }
.f__t { resize: vertical; min-height: 96px; }
.f__i[aria-invalid="true"] { border-color: rgba(255, 138, 128, 0.7); }
.f__h { margin: 7px 0 0; color: var(--ink-soft); font-size: 0.75rem; line-height: 1.5; opacity: 0.85; }
.f__e { margin: 7px 0 0; color: #ffb4a8; font-size: 0.75rem; line-height: 1.5; }

.alert {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 138, 128, 0.4);
  border-radius: 10px;
  background: rgba(70, 20, 18, 0.35);
  color: #ffd6cf;
  font-size: 0.875rem;
  line-height: 1.55;
}

.done { text-align: center; }
.done__tick { color: var(--accent); margin-bottom: 6px; }
.done .sheet__h { margin: 0; }
.done__p {
  margin: 14px auto 26px;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.66;
}

/* ======================================================== responsive */
@media (max-width: 860px) {
  .sheet__in { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .sheet__media { max-height: none; overflow: visible; }
  .sheet__body { overflow: visible; }
  .sheet { max-height: 92vh; }
}

@media (max-width: 620px) {
  /* the wordmark takes the first line; the two pills share the second,
     which keeps both reachable without a third row */
  .hdr__in { justify-content: flex-start; }
  .hdr__nav { width: 100%; gap: 8px; }
  .hdr__nav > * { flex: 1 1 0; min-width: 0; }
  .cat .pill, .cat .signin { padding: 10px 12px; letter-spacing: 0.1em; }
  .cat .signin { justify-content: center; }
  .search { max-width: none; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  /* one column means one card fills the width, so the picture is given a
     shallower crop — three items reach the screen instead of one and a half */
  .card__shot { aspect-ratio: 3 / 2; }
  .ghost { height: 268px; }
  /* a bottom sheet on a phone: thumb-reachable, and the page stays put
     behind it */
  .sheet, .sheet--ask {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    margin: auto auto 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
}

/* a phone in a barn, held at arm's length: bigger tap targets */
@media (pointer: coarse) {
  .chip { padding: 11px 16px; }
}

/* ==================================================== reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cat *, .sheet * { animation: none !important; }
  .card, .pill, .chip, .search__in, .thumb { transition: none; }
  .card:hover, .pill:hover { transform: none; }
}
