/* ============================================================================
 * KTSD Shop - design system (client "ktsd-shop-m4s" / Yeezy-Supply minimalism)
 * Canonical spec: docs/design/ktsd-shop-design-spec.md
 * Monochrome, zero-radius, thin Helvetica Neue, hairline rules. No color/shadow.
 *
 * Redefines the EXISTING shop class vocabulary so the shell (header, lightbox,
 * cart drawer, toasts) AND every page that already uses these classes restyle
 * together, with the layout's JS (which reads IDs/classes) untouched.
 * ==========================================================================*/

:root {
  /* new semantic tokens */
  --ink: #1a1a1a;
  --paper: #ffffff;
  --faint: #bbbbbb;
  --faintest: #cccccc;
  --line: #e8e8e8;
  --line-soft: #f0f0f0;
  --wash: #f7f7f7;
  --shop-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* legacy aliases (referenced by existing markup + the layout's inline JS) */
  --bg: #ffffff;
  --surface: #f7f7f7;
  --text: #1a1a1a;
  --muted: #999999;
  --border: #e8e8e8;
  --danger: #cc0000;
  --accent: #1a1a1a;
}

/* ---- base / reset (scoped to .shop-body) ---- */
.shop-body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--shop-font);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.shop-body *, .shop-body *::before, .shop-body *::after { box-sizing: border-box; }
.shop-body h1, .shop-body h2, .shop-body h3, .shop-body h4 { font-family: var(--shop-font); font-weight: 300; line-height: 1.15; margin: 0; }
.shop-body a { color: inherit; text-decoration: none; transition: color .15s; }
.shop-body img { display: block; max-width: 100%; }
.shop-body p { margin: 0; }
.shop-body input::placeholder, .shop-body textarea::placeholder { color: var(--faint); }
.shop-body input[type=number]::-webkit-inner-spin-button, .shop-body input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.shop-body input[type=number] { -moz-appearance: textfield; }
.shop-body ::-webkit-scrollbar { width: 4px; height: 4px; }
.shop-body ::-webkit-scrollbar-track { background: var(--paper); }
.shop-body ::-webkit-scrollbar-thumb { background: var(--line); }

/* ---- layout primitives ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.shop-narrow { max-width: 640px; margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.page-header { padding: 40px 0 8px; }
.page-header h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 300; }
.empty-state { padding: 80px 24px; text-align: center; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.shop-rule { border: 0; border-top: 1px solid var(--line); margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); }
.shop-main { padding-top: 44px; min-height: calc(100vh - 180px); } /* offset under fixed navbar */

/* ---- header / navbar (3-col: logo | links | actions) ---- */
.shop-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--paper); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 44px; padding: 0 20px;
}
.shop-header__logo { display: flex; align-items: center; }
.shop-header__logo img { height: 30px; width: auto; object-fit: contain; }
.shop-header__nav { display: flex; gap: 28px; align-items: center; justify-content: center; }
.shop-header__nav a {
  font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border-bottom: 1px solid transparent; padding-bottom: 1px; white-space: nowrap;
}
.shop-header__nav a:hover { color: var(--ink); }
.shop-header__nav a.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.shop-header__actions { display: flex; justify-content: flex-end; align-items: center; gap: 20px; }
.shop-header__actions a, .shop-header__cart {
  font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center; gap: 5px; font-family: var(--shop-font); white-space: nowrap;
}
.shop-header__actions a:hover, .shop-header__cart:hover { color: var(--ink); }
.shop-header__cart { color: var(--ink); }
.shop-header__cart-count { font-size: 11px; color: var(--ink); }
@media (max-width: 720px) { .shop-header__nav { display: none; } }

/* ---- footer ---- */
.shop-foot { border-top: 1px solid var(--line); padding: 32px 24px; max-width: 1200px; margin: 56px auto 0; }
.shop-foot__row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 24px; }
.shop-foot__brand { display: flex; align-items: center; gap: 12px; }
.shop-foot__brand img { height: 22px; width: auto; object-fit: contain; opacity: .45; }
.shop-foot__copy { font-size: 10px; color: var(--faint); letter-spacing: .04em; }
.shop-foot__links { display: flex; gap: 24px; }
.shop-foot__links a { font-size: 10px; letter-spacing: .06em; color: var(--faint); }
.shop-foot__links a:hover { color: var(--ink); }

/* ---- buttons ---- */
.btn {
  display: inline-block; font-family: var(--shop-font); font-weight: 300; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; text-align: center; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--ink); border-radius: 0;
  padding: 12px 22px; transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--wash); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #333; border-color: #333; color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--wash); }
.btn-full { display: block; width: 100%; }
.btn[disabled], .btn-primary[disabled] { background: #888; border-color: #888; color: #fff; cursor: not-allowed; }
.btn-text { background: none; border: none; padding: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; cursor: pointer; }
.btn-text:hover { color: var(--ink); }

/* ---- product grid + card ---- */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.product-grid > * { background: var(--paper); }
@media (max-width: 900px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .product-grid { grid-template-columns: repeat(2, 1fr); } }
.product-card { display: block; padding: 16px; background: var(--paper); position: relative; }
.product-card__img, .product-card__placeholder {
  position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: center; padding: 10px; margin-bottom: 12px; overflow: hidden;
}
.product-card__img img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: opacity .2s; }
.product-card:hover .product-card__img img { opacity: .82; }
.product-card__placeholder { color: var(--faintest); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.product-card__name { font-size: 11px; font-weight: 300; color: var(--ink); margin-bottom: 3px; }
.product-card__price { font-size: 11px; font-weight: 300; color: var(--ink); }
.product-card__oos-badge {
  position: absolute; top: 8px; left: 8px; font-size: 9px; font-weight: 400; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); background: var(--paper); border: 1px solid var(--line); padding: 2px 6px;
}
.product-card--oos .product-card__img img { opacity: .5; }

/* ---- product detail ---- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 32px 0; }
@media (max-width: 760px) { .product-detail { grid-template-columns: 1fr; gap: 24px; } }
.product-detail__image { border: 1px solid var(--line-soft); aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.product-detail__image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-detail__name { font-size: 22px; font-weight: 300; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; }
.product-detail__price { font-size: 16px; color: var(--ink); margin-bottom: 20px; }
.product-detail__meta { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.product-detail__meta-row { display: flex; justify-content: space-between; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---- listings toolbar (sort + only-available) ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.toolbar__group { display: flex; align-items: center; gap: 14px; }
.toolbar .form-select { width: auto; padding: 6px 24px 6px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.checkbox-sq { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.checkbox-sq input { appearance: none; -webkit-appearance: none; width: 13px; height: 13px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); cursor: pointer; position: relative; flex-shrink: 0; }
.checkbox-sq input:checked { background: var(--ink); }
.checkbox-sq input:checked::after { content: ""; position: absolute; inset: 3px; background: var(--paper); }

/* ---- forms ---- */
.shop-form { max-width: 560px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 7px; }
.form-input, .form-select, textarea.form-input {
  width: 100%; font-family: var(--shop-font); font-weight: 300; font-size: 13px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 0; padding: 11px 12px; transition: border-color .15s;
}
.form-input:focus, .form-select:focus, textarea.form-input:focus { outline: none; border-color: var(--ink); }
textarea.form-input { resize: vertical; min-height: 110px; }

/* auth tabs (sign in / register) */
.auth-page { max-width: 420px; margin: 40px auto; padding: 0 24px; }
.auth-tabs { display: flex; border: 1px solid var(--line); margin-bottom: 24px; }
.auth-tab { flex: 1; text-align: center; padding: 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); cursor: pointer; background: var(--paper); }
.auth-tab.active { background: var(--ink); color: #fff; }

/* ---- checkout ---- */
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 48px; padding: 32px 0; }
@media (max-width: 820px) { .checkout-layout { grid-template-columns: 1fr; gap: 28px; } }
.checkout-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.checkout-summary { border: 1px solid var(--line); padding: 20px; align-self: start; }
.cart-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cart-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 400; text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.cart-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); }
.confirmation-page { max-width: 560px; margin: 60px auto; text-align: center; }
.order-number { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }

/* ---- flash banners ---- */
.shop-flash { font-size: 11px; letter-spacing: .04em; padding: 12px 16px; border: 1px solid var(--line); margin: 12px auto; max-width: 1200px; }
.shop-flash--notice { border-color: var(--ink); color: var(--ink); }
.shop-flash--alert { border-color: var(--danger); color: var(--danger); }

/* ---- lightbox (product quick-view; IDs/structure preserved, JS-driven) ---- */
.lb { position: fixed; inset: 0; z-index: 200; display: none; }
.lb.is-open { display: block; }
.lb__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.lb__close { position: absolute; top: 16px; right: 18px; z-index: 2; background: none; border: none; font-size: 18px; color: var(--ink); cursor: pointer; }
.lb__panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(880px, 94vw); max-height: 90vh; overflow: auto; background: var(--paper); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .lb__panel { grid-template-columns: 1fr; } }
.lb__img-wrap { aspect-ratio: 1 / 1; border-right: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: 28px; }
.lb__img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb__no-img { color: var(--faintest); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.lb__side { padding: 32px; display: flex; flex-direction: column; gap: 16px; }

/* ---- cart drawer (IDs/structure preserved, JS-driven) ---- */
.cd { position: fixed; inset: 0; z-index: 100; display: none; }
.cd.is-open { display: block; }
.cd__backdrop { position: absolute; inset: 0; }
.cd__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100vw); background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .2s ease; }
.cd.is-open .cd__panel { transform: translateX(0); }
.cd__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.cd__head-title { font-size: 10px; font-weight: 300; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.cd__close { background: none; border: none; cursor: pointer; font-size: 16px; color: var(--faint); }
.cd__body { flex: 1; overflow-y: auto; }
.cd__empty { padding: 60px 20px; text-align: center; display: flex; flex-direction: column; gap: 20px; align-items: center; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--faintest); }
.cd__item { display: grid; grid-template-columns: 48px 1fr; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); align-items: start; }
.cd__item-img, .cd__item-img-ph { width: 48px; height: 48px; border: 1px solid var(--line-soft); padding: 3px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cd__item-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cd__item-name { font-size: 11px; color: var(--ink); margin-bottom: 2px; }
.cd__item-price { font-size: 11px; color: var(--ink); }
.cd__item-stepper { display: flex; align-items: center; gap: 12px; }
.cd__item-stepper button { background: none; border: none; cursor: pointer; font-size: 14px; line-height: 1; color: var(--ink); }
.cd__item-remove { background: none; border: none; cursor: pointer; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faintest); padding: 6px 0 0; }
.cd__foot { padding: 16px 20px; border-top: 1px solid var(--line); }
.cd__foot-row { display: flex; justify-content: space-between; margin-bottom: 16px; }
.cd__foot-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.cd__foot-total { font-size: 11px; color: var(--ink); }

/* ---- toasts ---- */
.toast-rack { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; font-size: 11px; letter-spacing: .04em; padding: 12px 18px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast--show { opacity: 1; transform: translateY(0); }
.toast--error { background: var(--danger); }

/* ---- hero (landing) ---- */
.hero { padding: 64px 0 40px; }
.hero__title { font-size: clamp(32px, 6vw, 56px); font-weight: 300; line-height: 1.05; letter-spacing: -.01em; }
.hero__sub { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-top: 16px; }

/* ---- helpers / pills ---- */
.pill { display: inline-block; font-size: 9px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); border: 1px solid var(--line); padding: 3px 8px; }
.u-label { font-size: 11px; font-weight: 400; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.u-eyebrow { font-size: 10px; font-weight: 400; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

/* ---- utilities (kept compatible with existing markup) ---- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-sm { font-size: 11px; }
.text-upper { text-transform: uppercase; letter-spacing: .08em; }
.text-muted { color: var(--muted); }

/* ============================================================================
 * Motion - subtle micro-interactions (#kang-motion-pass)
 * Understated to match the monochrome aesthetic: short durations, tiny
 * movements, no bounce/elastic easings. All neutralised under
 * prefers-reduced-motion at the bottom of this block.
 * ==========================================================================*/

/* ---- scroll reveal (driven by reveal_controller.js) ----
 * The hidden initial state is applied by the controller adding `.reveal`, so
 * with JS off nothing is ever hidden (no-JS fallback shows everything). When
 * the element enters the viewport the controller adds `.reveal--in`. */
/* !important: the reveal is a cross-cutting animation utility that must beat
 * component rules which land later in the cascade at equal specificity - e.g.
 * application.css's `.product-grid .product-card` (#101) sets transform/opacity
 * on cards and otherwise wins by load order, leaving the card visible so the
 * reveal never animates. `.reveal--in` is declared after `.reveal`, so for a
 * revealed element (which carries both classes) the !important `--in` values win. */
.shop-body .reveal {
  opacity: 0 !important;
  transform: translateY(14px) !important;
  transition: opacity .42s ease, transform .42s ease;
  will-change: opacity, transform;
}
.shop-body .reveal--in {
  opacity: 1 !important;
  transform: none !important;
  will-change: auto;
}

/* ---- button micro-interactions ----
 * Lift 1px on hover, settle back + slightly dim on active. Only `transform` and
 * `opacity` are new here; the background/color transitions are restated so the
 * single `transition` declaration covers all four properties.
 * (Product-card hover/active motion lives in application.css alongside the #101
 * grid-card polish, where the higher .product-grid specificity wins the cascade
 * - duplicating it here would be dead CSS.) */
.btn {
  transition: background .15s, color .15s, border-color .15s, transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); opacity: .9; }

/* ---- reduced motion: neutralise the reveal + button motion added above ----
 * (#101's reduced-motion block in application.css neutralises the card motion.) */
@media (prefers-reduced-motion: reduce) {
  .shop-body .reveal,
  .shop-body .reveal--in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
  .btn,
  .btn:hover,
  .btn:active {
    transform: none;
    opacity: 1;
    transition: background .15s, color .15s, border-color .15s;
  }
}
