:root {
  color-scheme: light;
  --ink: #0a0a0a;
  --muted: #6e6e6e;
  --line: rgba(10, 10, 10, 0.14);
  --line-on-dark: rgba(255, 255, 255, 0.16);
  --paper: #ffffff;
  --surface: #ffffff;
  --accent: #0a0a0a;
  --accent-2: #0a0a0a;
  --soft: #f0f0f0;
  --shadow: 0 18px 44px rgba(30, 28, 24, 0.1);
  --font-display: "Mulett", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

@font-face {
  font-family: "Mulett";
  src: url("./assets/fonts/MulettLight.otf") format("opentype");
  font-weight: 300;
  font-display: swap;
}

::selection {
  background: var(--ink);
  color: #ffffff;
}

.font-display {
  font-family: var(--font-display);
}

.font-mono-label {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-on-dark);
  background: rgba(10, 10, 10, 0.92);
  color: #ffffff;
  padding: 18px 28px;
  backdrop-filter: blur(16px);
}

.source {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-mark {
  color: #ffffff;
  font-weight: 500;
}

.site-footer {
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line-on-dark);
  background: var(--ink);
  padding: 32px;
}

.site-footer .brand-mark {
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 760;
  line-height: 1.05;
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 38px;
  padding: 0 14px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.topbar button {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #ffffff;
}

.topbar button:hover {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--ink);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: wait;
  opacity: 0.58;
}

main {
  padding: 20px 28px 48px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(10, 10, 10, 0.16);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  margin-bottom: 20px;
}

.summary div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
}

.summary div + div {
  border-left: 1px solid var(--line-on-dark);
}

.summary strong {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
}

.summary span {
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.catalog-status {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  margin-bottom: 14px;
  padding: 15px 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.catalog-status[hidden] {
  display: none;
}

.catalog-status strong,
.catalog-status span {
  display: block;
}

.catalog-status strong {
  font-size: 15px;
}

.catalog-status span {
  color: var(--muted);
  font-size: 13px;
}

.loader,
.status-mark {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
}

.loader {
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.status-mark {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #b74e35;
  color: white;
  font-weight: 760;
}

.catalog-status.is-error {
  border-color: rgba(183, 78, 53, 0.35);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 14px;
}

.catalog.is-loading {
  pointer-events: none;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.media {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 1px;
  aspect-ratio: 1.25;
  background: var(--line);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f5f5f2;
  cursor: zoom-in;
}

.media img:first-child {
  grid-row: span 2;
}

.card-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.card-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

h2 {
  min-height: 52px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.22;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.specs div {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

dd {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
}

.swatch {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  background: var(--swatch, #ddd);
}

.card-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.card-footer button {
  display: grid;
  place-items: center;
  min-width: 0;
  border-radius: 0;
  font-size: 11px;
}

.secondary-action {
  background: white;
  color: var(--ink);
}

.secondary-action:hover {
  background: var(--soft);
  border-color: var(--accent);
  color: var(--ink);
}

.skeleton-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  padding-bottom: 16px;
}

.skeleton-media,
.skeleton-line,
.skeleton-grid {
  position: relative;
  overflow: hidden;
  background: #eeeae2;
}

.skeleton-media {
  aspect-ratio: 1.25;
}

.skeleton-line {
  height: 14px;
  width: 52%;
  margin: 14px 16px 0;
  border-radius: 0;
}

.skeleton-line.wide {
  width: 72%;
  height: 22px;
  margin-top: 18px;
}

.skeleton-grid {
  height: 82px;
  margin: 16px 16px 0;
  border-radius: 0;
}

.skeleton-media::after,
.skeleton-line::after,
.skeleton-grid::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.25s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 14, 12, 0.42);
}

.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  border-radius: 0;
  padding: 0;
  font-size: 14px;
}

.detail {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 22px;
  padding: 22px;
}

.detail-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-images img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 0;
  background: #f4f3ef;
  cursor: zoom-in;
}

.detail-copy {
  padding-right: 34px;
}

.detail-copy h2 {
  min-height: 0;
  margin-bottom: 10px;
  font-size: 30px;
}

.detail-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
}

.detail-grid .detail-field-wide {
  grid-column: 1 / -1;
}

.detail-grid dd {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.color-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 5px 9px;
  font-size: 12px;
}

#imageDialog {
  width: min(1180px, calc(100vw - 28px));
  background: #111;
  border-color: #111;
}

.image-viewer {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 54px;
  align-items: center;
  min-height: min(78vh, 820px);
  padding: 18px;
}

#largeImage {
  display: block;
  width: 100%;
  max-height: min(78vh, 820px);
  object-fit: contain;
}

.nav-image {
  width: 42px;
  min-height: 60px;
  border-color: rgba(255, 255, 255, 0.22);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 34px;
  line-height: 1;
  padding: 0;
}

.image-counter {
  color: rgba(255, 255, 255, 0.76);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 0 18px 18px;
  text-align: center;
}

.fade-in {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

@media (max-width: 900px) {
  .controls,
  .summary,
  .detail {
    grid-template-columns: 1fr;
  }

  .summary div + div {
    border-left: 0;
    border-top: 1px solid var(--line-on-dark);
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  main {
    padding: 16px;
  }

  .catalog {
    grid-template-columns: 1fr;
  }

  .detail {
    padding: 14px;
  }

  .detail-copy {
    padding-right: 0;
  }

  .image-viewer {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    min-height: 68vh;
    padding: 10px;
  }

  .nav-image {
    width: 32px;
    min-height: 48px;
  }

}
