:root {
  --ink: #151515;
  --paper: #f3efe8;
  --card: #fbfaf7;
  --line: #d8d1c7;
  --muted: #756f68;
  --accent: #8d572c;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

.hero {
  min-height: 390px;
  padding: max(32px, env(safe-area-inset-top)) 20px 44px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    radial-gradient(circle at 85% 22%, rgba(194, 130, 72, .22), transparent 31%),
    linear-gradient(150deg, #0b0908, #2a211c);
  color: white;
}

.eyebrow, .detail-code {
  margin: 0 0 15px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .22em;
}

h1 {
  max-width: 640px;
  margin: 0;
  font-family: "Playfair Display", serif;
  font-size: clamp(42px, 12vw, 76px);
  line-height: .92;
  letter-spacing: -.045em;
}

h1 em { color: #e2b58c; font-weight: 600; }

.intro {
  max-width: 420px;
  margin: 24px 0 0;
  color: #d7d0ce;
  font-size: 15px;
}

main { padding: 22px 12px 60px; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto 18px;
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(243, 239, 232, .94);
  backdrop-filter: blur(12px);
}

.search {
  min-width: 0;
  flex: 1;
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: white;
}

.search span { font-size: 23px; transform: rotate(-15deg); }

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

#count {
  flex: 0 0 auto;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.catalog {
  max-width: 1180px;
  margin: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:active { transform: scale(.985); }

.card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e7e2dc;
}

.card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 5px 8px;
  border-radius: 99px;
  background: rgba(16, 16, 16, .78);
  color: white;
  font-size: 10px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.card-copy { padding: 12px 11px 14px; }

.code {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
}

.card h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.17;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-cta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

.detail {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
}

.detail::backdrop { background: rgba(0, 0, 0, .65); }

.detail-shell { min-height: 100%; position: relative; }

.close {
  position: fixed;
  z-index: 10;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 20, 20, .82);
  color: white;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.gallery { position: relative; background: #ded8d0; }

.stage {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.stage img, .stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #111;
}

.stage img { object-fit: cover; background: #ded8d0; }

.gallery-nav {
  position: absolute;
  top: calc(50vw - 22px);
  width: 38px;
  height: 44px;
  border: 0;
  border-radius: 99px;
  background: rgba(15, 15, 15, .72);
  color: white;
  font-size: 30px;
  cursor: pointer;
}

.previous { left: 8px; }
.next { right: 8px; }

.media-counter {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 9px;
  border-radius: 99px;
  background: rgba(15, 15, 15, .72);
  color: white;
  font-size: 11px;
}

.thumbs {
  padding: 9px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.thumbs::-webkit-scrollbar { display: none; }

.thumb {
  position: relative;
  width: 55px;
  height: 55px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #c9c1b9;
}

.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.video::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: white; background: rgba(0,0,0,.28); }

.copy { padding: 28px 20px max(48px, env(safe-area-inset-bottom)); }
.detail-code { color: var(--accent); }
.copy h2 { margin: 0 0 18px; font-family: "Playfair Display", serif; font-size: 34px; line-height: 1; }
.description, .features p { margin: 0; color: #37332f; font-size: 15px; line-height: 1.62; }
.features { margin-top: 28px; padding-top: 23px; border-top: 1px solid var(--line); }
.features h3 { margin: 0 0 11px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }

@media (min-width: 680px) {
  main { padding-inline: 24px; }
  .catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .card-copy { padding: 17px; }
  .card h2 { font-size: 18px; }
  .detail { width: min(1080px, calc(100% - 40px)); height: min(780px, calc(100% - 40px)); margin: auto; border-radius: 18px; }
  .detail-shell { min-height: 100%; display: grid; grid-template-columns: 58% 42%; }
  .gallery { min-width: 0; }
  .stage { aspect-ratio: auto; height: calc(100% - 74px); min-height: 600px; }
  .gallery-nav { top: calc(50% - 55px); }
  .copy { overflow-y: auto; padding: 70px 34px 40px; }
  .close { position: absolute; }
}

@media (min-width: 1020px) {
  .catalog { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(28, 24, 20, .12); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
}
