:root {
  color-scheme: light;
  --page: #faf8f5;
  --ink: #2d251f;
  --muted: #675b53;
  --accent: #973e2a;
  --deep: #74301f;
  --tint: #f6ebe4;
  --line: #e7dfd7;
  --white: #fff;
  --font: "Instrument Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: #faf8f5f5;
  backdrop-filter: blur(14px);
}
.masthead .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 68px; gap: 16px; }
.brand { display: inline-flex; align-items: center; justify-self: start; gap: 11px; font-size: 18px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 33px; aspect-ratio: 1; border-radius: 50%; background: var(--accent); color: var(--white); font-size: 16px; }
.header-catalog, .nav-link { color: var(--accent); font-size: 14px; font-weight: 700; text-underline-offset: 5px; }
.header-catalog { padding: 12px; text-decoration: none; }
.header-catalog:hover { text-decoration: underline; }
.selection-trigger { display: inline-flex; align-items: center; justify-self: end; gap: 8px; min-height: 44px; padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); font-size: 14px; font-weight: 700; white-space: nowrap; }
.selection-trigger::before { content: ""; width: 12px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; background: repeating-linear-gradient(to bottom, currentColor 0 1px, transparent 1px 3px) center / 6px 7px no-repeat; }
.selection-trigger:hover { border-color: var(--accent); color: var(--accent); }

.hero { display: grid; grid-template-columns: 43% 57%; margin-top: 32px; padding: 12px; border-radius: 30px; background: #f0e8de; }
.hero-copy { align-self: center; padding: 28px clamp(24px, 4.1vw, 64px); }
h1 { font-size: clamp(36px, 4.8vw, 70px); font-weight: 800; line-height: 1.12; }
.hero h1 span { display: block; margin-top: 5px; color: var(--accent); }
.hero p { max-width: 19em; margin-top: 22px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.hero-link { display: inline-flex; align-items: center; gap: 20px; min-height: 48px; margin-top: 25px; padding: 9px 19px; border-radius: 999px; background: var(--accent); color: var(--white); font-size: 14px; font-weight: 800; text-decoration: none; }
.hero-link:hover { background: var(--deep); }
.hero-photo { position: relative; min-height: clamp(320px, 34vw, 438px); overflow: hidden; border-radius: 21px; background: #d9c5b2; }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 54%; }

.catalog { padding-block: 44px 68px; scroll-margin-top: 64px; }
.catalog-head, .catalog-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.25; }
.shared-head { margin-bottom: 24px; }
.shared-head h1 { font-size: clamp(28px, 5vw, 44px); }
.shared-count { margin-top: 8px; color: var(--muted); font-size: 14px; }
.search { position: relative; display: block; width: min(100%, 278px); }
.search::before, .search::after { position: absolute; pointer-events: none; content: ""; }
.search::before { top: 14px; left: 16px; width: 11px; height: 11px; border: 1.5px solid var(--muted); border-radius: 50%; }
.search::after { top: 26px; left: 28px; width: 5px; height: 1.5px; transform: rotate(45deg); background: var(--muted); }
.search input { width: 100%; height: 44px; padding: 0 15px 0 41px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--ink); font-size: 14px; }
.catalog-tools { margin-block: 16px 22px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { min-height: 44px; padding: 7px 15px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--muted); font-size: 14px; }
.filter:hover { border-color: var(--line); background: var(--white); color: var(--accent); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--white); font-weight: 700; }
.results, .empty { color: var(--muted); font-size: 14px; }
.results { white-space: nowrap; }
.empty { padding: 24px 0; line-height: 1.7; }
#empty .filter { margin-left: 5px; border-color: var(--line); background: var(--white); }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--white); transition: border-color .18s, box-shadow .18s; }
.card:hover, .card:focus-within { border-color: #ceb7a8; box-shadow: 0 8px 24px #39241912; }
.card-detail { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.card-detail:focus-visible { outline-offset: -4px; }
.card img { display: block; width: 100%; aspect-ratio: 1.27; object-fit: cover; background: var(--tint); }
.card-info { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 14px 16px; }
.card-info > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.card-name { display: block; font-size: 18px; font-weight: 800; line-height: 1.4; }
.card-meta, .card-price { display: block; margin-top: 5px; font-size: 13px; }
.card-meta { color: var(--muted); }
.card-price { color: var(--accent); font-weight: 800; }
.card-arrow { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--page); color: var(--muted); }
.card-detail:hover .card-arrow { background: var(--tint); color: var(--accent); }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 66px; }

dialog { width: min(860px, calc(100% - 28px)); max-height: 90dvh; padding: 0; overflow: auto; overscroll-behavior: contain; border: 0; border-radius: 22px; background: var(--white); color: var(--ink); box-shadow: 0 24px 80px #2d251f38; }
dialog::backdrop { background: #2d251f99; }
.detail-layout { position: relative; display: grid; grid-template-columns: 1.08fr 1fr; }
.detail-gallery { padding: 18px; background: var(--page); }
.detail-photo { display: block; width: 100%; height: 360px; object-fit: contain; }
#zoom-trigger { display: block; width: 100%; padding: 0; border: 0; border-radius: 10px; background: none; cursor: zoom-in; }
.zoom { width: min(1080px, calc(100% - 24px)); background: var(--ink); }
.zoom img { display: block; max-width: 100%; max-height: 88dvh; margin: auto; object-fit: contain; }
.detail-notes { margin-top: 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; padding: 4px; overflow-x: auto; }
.thumb { flex: 0 0 56px; height: 54px; padding: 2px; border: 1px solid transparent; border-radius: 8px; background: var(--white); }
.thumb[aria-pressed="true"] { border-color: var(--accent); }
.thumb img { display: block; width: 100%; height: 100%; border-radius: 5px; object-fit: cover; }
.detail-copy { padding: 56px 30px 30px; }
.close { position: absolute; z-index: 1; top: 10px; right: 10px; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--ink); font-size: 24px; line-height: 1; }
.close:hover { background: var(--tint); }
.detail-type, .detail-info { color: var(--muted); font-size: 14px; line-height: 1.7; }
.detail h2 { margin: 6px 0 12px; overflow-wrap: anywhere; }
#detail-price { margin-top: 6px; color: var(--accent); font-size: 17px; font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.action { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--white); font-size: 14px; font-weight: 700; text-decoration: none; }
.action:hover { background: var(--deep); }
.action.secondary, .action[aria-pressed="true"] { border-color: var(--line); background: var(--white); color: var(--accent); }
.action.secondary:hover, .action[aria-pressed="true"]:hover { background: var(--tint); }
.card .card-add { gap: 7px; margin: auto 14px 14px; padding: 6px 8px; }
.card .card-add:hover { border-color: var(--accent); }
.card .card-add[aria-pressed="true"] { border-color: #e8cfc2; background: var(--tint); }
.card-add::before { content: ""; flex: 0 0 11px; height: 11px; background: linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat; }
.card-add[aria-pressed="true"]::before { flex-basis: 9px; height: 5px; margin-top: -3px; transform: rotate(-45deg); border-bottom: 1.5px solid; border-left: 1.5px solid; background: none; }
.feedback { margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.feedback:empty { display: none; }
.copy-field { display: block; width: 100%; margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--page); }

.selection { inset: 0 0 0 auto; width: min(460px, 100%); height: 100dvh; max-width: 100%; max-height: 100dvh; margin: 0; border-radius: 22px 0 0 22px; }
.selection-content { position: relative; padding: 30px 24px; }
.selection-content h2 { padding-right: 42px; font-size: 28px; }
.selection-list { margin: 12px 0 0; padding: 0; list-style: none; }
.selection-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.selection-item img { flex: none; width: 52px; height: 50px; border-radius: 8px; object-fit: cover; }
.remove { flex: none; min-height: 44px; margin-left: auto; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.remove:hover { background: var(--tint); }

@media (max-width: 930px) {
  .wrap { width: calc(100% - 48px); }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .hero-copy { padding-inline: clamp(16px, 3vw, 28px); }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .masthead .wrap { min-height: 62px; grid-template-columns: 1fr auto; gap: 8px; }
  .header-catalog { display: none; }
  .brand { font-size: 17px; }
  .selection-trigger { padding-inline: 12px; }
  .hero { grid-template-columns: 1fr; margin-top: 14px; padding: 8px; border-radius: 23px; }
  .hero-copy { padding: 20px 14px; }
  .hero h1 { font-size: clamp(26px, 7.6vw, 44px); }
  .hero h1 span { display: inline; white-space: nowrap; }
  .hero p { max-width: 24em; margin-top: 10px; font-size: 14px; }
  .hero-link { margin-top: 14px; }
  .hero-photo { min-height: clamp(148px, 45vw, 238px); border-radius: 16px; }
  .catalog { padding-block: 30px 44px; scroll-margin-top: 62px; }
  .shared-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .search { width: 100%; }
  .catalog-tools { align-items: stretch; flex-direction: column; gap: 10px; margin-block: 11px 14px; padding-bottom: 12px; }
  .filters { gap: 4px; }
  .filter { padding-inline: 11px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card { border-radius: 13px; }
  .card img { aspect-ratio: 1.2; }
  .card-info { padding: 10px; gap: 5px; }
  .card-name { font-size: 15px; }
  .card-arrow { flex-basis: 22px; height: 22px; font-size: 13px; }
  .card .card-add { margin: auto 9px 9px; font-size: 13px; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-copy { padding: 16px 16px 22px; }
  .detail-gallery { padding: 10px; }
  .detail-photo { height: min(35dvh, 290px); }
  .selection { width: 100%; border-radius: 0; }
}

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