:root {
  color-scheme: dark;
  --background: #171317;
  --surface: #211a20;
  --surface-deep: #120f12;
  --ink: #f6e8d5;
  --muted: #c7b4a9;
  --gold: #e6b980;
  --line: #503b3e;
  --plum: #402738;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 75% 0%, #251923 0, transparent 43%), var(--background);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
}
body:has(dialog[open]) { overflow: hidden; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #efbf85; outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 6; padding: 10px 16px; background: var(--surface-deep); }
.shell { width: min(1280px, calc(100% - 80px)); margin-inline: auto; }

.site-header { background: #191419; border-bottom: 1px solid #453339; }
.header-inner { min-height: 69px; display: flex; align-items: center; gap: 36px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 1.24rem var(--serif); white-space: nowrap; }
.main-nav { align-self: stretch; display: flex; align-items: stretch; gap: 23px; }
.main-nav a { display: grid; align-items: center; padding-top: 2px; border-bottom: 2px solid transparent; font-size: .88rem; text-decoration: none; color: var(--muted); }
.main-nav a:hover, .main-nav a[aria-current] { color: var(--ink); }
.main-nav a[aria-current] { border-color: var(--gold); }
.private { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--gold); font-size: .8rem; white-space: nowrap; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 35px;
  min-height: 375px;
  display: grid;
  align-items: center;
  border: 1px solid #61454a;
  border-radius: 14px;
  background: #211720;
}
.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, #221821 0%, #241922 31%, rgba(35, 24, 32, .97) 36%, rgba(35, 24, 32, .73) 47%, transparent 68%),
              linear-gradient(0deg, rgba(19, 13, 16, .28), transparent 42%);
}
.hero::after { content: ''; position: absolute; inset: 8px; border: 1px solid #f0c59728; border-radius: 8px; z-index: -1; pointer-events: none; }
.hero-image { position: absolute; z-index: -2; inset: 0 0 0 auto; width: 69%; height: 100%; object-fit: cover; object-position: center 22%; }
.hero-copy { position: relative; width: min(51%, 580px); padding: 40px 0 42px clamp(35px, 4.6vw, 74px); }
.hero-ornament { display: flex; align-items: center; gap: 8px; color: var(--gold); font-size: .61rem; margin-bottom: 16px; }
.hero-ornament span { width: 25px; height: 1px; background: var(--gold); opacity: .68; }
.hero-ornament span:first-child { width: 12px; }
.hero h1 { font: 400 clamp(3.1rem, 5.1vw, 5.1rem)/.98 var(--serif); letter-spacing: -.059em; text-wrap: balance; }
.hero h1 em { display: block; font-weight: 400; color: var(--gold); }
.hero p { color: #ddc9bb; max-width: 31ch; margin-top: 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 15px;
  font-size: .87rem;
  font-weight: 620;
  text-decoration: none;
}
.primary { background: var(--gold); color: #281a20; }
.primary:hover { background: #f1cca0; }
.secondary { background: #2a2028; border-color: #715349; color: var(--ink); }
.secondary:hover { background: #3f2b37; border-color: var(--gold); }

.catalog { margin-top: 39px; }
.catalog:focus:not(:focus-visible) { outline: none; }
.catalog-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.catalog h2 { font: 400 clamp(2.15rem, 4vw, 2.8rem)/1.15 var(--serif); letter-spacing: -.032em; }
#result-count { margin-top: 6px; font-size: .86rem; color: var(--muted); min-height: 1.35em; }
.search-box {
  display: flex;
  align-items: center;
  color: var(--gold);
  gap: 9px;
  background: #231a22;
  border: 1px solid #614851;
  border-radius: 7px;
  padding: 0 11px 0 13px;
  width: min(100%, 360px);
  min-height: 44px;
}
.search-box:focus-within { border-color: var(--gold); }
.search-box input { background: transparent; color: var(--ink); border: 0; outline: 0; min-width: 0; width: 100%; padding-block: 10px; font-size: .9rem; }
.search-box input::placeholder { color: #bdaaa4; opacity: 1; }
.search-box svg { flex-shrink: 0; }
.search-box kbd { font: .8rem/1.3 var(--sans); border: 1px solid #644e55; border-radius: 4px; padding: 1px 6px; }
.catalog-controls { margin-top: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: .85rem;
}
.filter-chip span { display: inline-block; min-width: 1em; margin-left: 3px; color: var(--gold); font-size: .78rem; }
.filter-chip:hover { color: var(--ink); border-color: #9e7557; }
.filter-chip[aria-pressed="true"] { border-color: #a77756; color: var(--ink); background: var(--plum); }
.pack-filter { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; font-size: .86rem; color: var(--muted); min-height: 36px; }
.pack-filter:has(input:checked) { color: var(--gold); }
.pack-filter input { width: 17px; height: 17px; accent-color: var(--gold); margin: 0; }
.notes-access { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 17px; padding: 9px 12px 9px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.notes-access span { font-size: .9rem; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 19px; }
.card { min-width: 0; }
.card-link {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  border: 1px solid #563e43;
  border-radius: 9px;
  text-decoration: none;
  background: #261c24;
  overflow: hidden;
  transition: border-color .18s, background-color .18s;
}
.card-link:hover { border-color: #bf926a; background: #30222d; }
.card-image { width: 100%; height: auto; aspect-ratio: 2.15; object-fit: cover; border-bottom: 1px solid #865e48; background: #3e2a35; }
.card-copy { display: flex; flex-direction: column; gap: 5px; padding: 14px 16px 17px; }
.card-category { font-size: .75rem; color: var(--gold); font-weight: 650; letter-spacing: .034em; }
.card h3 { font: 400 clamp(1.24rem, 2.1vw, 1.54rem)/1.17 var(--serif); letter-spacing: -.015em; }
.card-summary { font-size: .89rem; color: var(--muted); }
.empty { margin-top: 20px; padding: 40px 18px; text-align: center; background: var(--surface); border: 1px dashed #674b54; border-radius: 8px; }
.empty h3 { font: 1.65rem var(--serif); }
.empty p { margin: 8px 0 18px; color: var(--muted); }

.site-footer { margin-top: 50px; min-height: 72px; display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer a { margin-left: auto; text-underline-offset: 4px; }

dialog { color: var(--ink); background: #231b22; border: 1px solid #78594e; border-radius: 10px; padding: 0; box-shadow: 0 22px 96px #000a; }
dialog::backdrop { background: #0b080cdd; }
.item-dialog { width: min(1050px, calc(100% - 36px)); max-height: calc(100dvh - 36px); }
.detail-bar, .image-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #2d202b;
  color: var(--gold);
  border-bottom: 1px solid #694b50;
  padding: 8px 18px;
}
.detail-bar span { font-size: .85rem; font-weight: 650; }
.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #79585e;
  border-radius: 6px;
  background: var(--surface);
  font: 1.68rem/1 var(--sans);
  color: var(--ink);
}
.icon-button:hover { background: var(--plum); }
.detail-grid { padding: clamp(16px, 3vw, 30px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 30px); align-items: start; }
.detail-copy h2 { font: 400 clamp(1.93rem, 3.5vw, 2.8rem)/1.04 var(--serif); letter-spacing: -.035em; }
.detail-copy p { margin-top: 13px; color: var(--muted); }
.detail-copy .origin { color: var(--gold); margin-top: 9px; font-size: .89rem; }
.detail-copy h3 { color: var(--ink); font: 1.25rem var(--serif); margin: 20px 0 8px; }
.detail-copy ul { margin: 0; padding-left: 1.2em; color: #e0cfc2; }
.detail-copy li + li { margin-top: 6px; }
.detail-copy blockquote { margin: 16px 0 0; border-left: 2px solid var(--gold); padding-left: 13px; color: #efcdad; font: italic 1.09rem/1.45 var(--serif); }
.detail-copy .materials { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; }
.materials li, .related a { border: 1px solid #634953; border-radius: 5px; background: #31232e; font-size: .82rem; padding: 4px 7px; margin: 0 !important; }
.related { display: flex; flex-wrap: wrap; gap: 6px; }
.related a { color: var(--ink); text-decoration: none; }
.related a:hover { border-color: var(--gold); }
.plate-panel { display: grid; gap: 10px; }
.plate-panel .filters { margin-bottom: 2px; }
.plate-frame { width: 100%; border: 1px solid #84624e; border-radius: 7px; overflow: hidden; display: block; background: var(--surface-deep); padding: 0; }
.plate-frame:hover { border-color: var(--gold); }
.plate-frame img { width: 100%; }
.plate-panel > .button { justify-self: start; }
.plate-note { color: var(--muted); font-size: .88rem; }
.plate-frame:disabled, .plate-panel > .button:disabled { cursor: wait; opacity: .65; }
.unlock-dialog { width: min(440px, calc(100% - 28px)); }
.unlock-form { display: grid; gap: 10px; padding: 23px; }
.unlock-form h2 { font: 400 2rem/1.1 var(--serif); }
.unlock-form p { color: var(--muted); }
.unlock-form label { font-size: .9rem; margin-top: 6px; }
.unlock-form input { width: 100%; border: 1px solid #79585e; border-radius: 6px; background: var(--surface-deep); color: var(--ink); padding: 9px 10px; }
.unlock-form .unlock-error { color: #ffc0ae; }
.unlock-form .button { margin-top: 6px; justify-self: start; }
.unlock-form .button:disabled { opacity: .65; cursor: wait; }
.image-dialog { width: min(1600px, calc(100% - 24px)); max-height: calc(100dvh - 24px); }
.image-toolbar h2 { font: 400 1.2rem var(--serif); color: var(--ink); }
.image-actions { display: flex; gap: 8px; align-items: center; }
.image-viewport { overflow: auto; max-height: calc(100dvh - 96px); overscroll-behavior: contain; background: var(--surface-deep); }
.image-viewport img { width: auto; max-width: 100%; height: auto; margin-inline: auto; }
.image-viewport.enlarged img { max-width: none; }

@media (max-width: 1000px) {
  .shell { width: calc(100% - 48px); }
  .catalog-controls { align-items: start; flex-direction: column; row-gap: 8px; }
  .hero { min-height: 350px; }
}
@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { flex-wrap: wrap; gap: 0 12px; padding-top: 9px; min-height: 86px; }
  .main-nav { order: 3; align-self: auto; width: 100%; min-height: 38px; }
  .main-nav a { font-size: .91rem; }
  .hero { margin-top: 18px; min-height: 390px; align-items: end; }
  .hero-image { width: 100%; height: 79%; object-position: center 40%; }
  .hero::before { background: linear-gradient(0deg, #211720 0%, #211720 24%, #211720ee 36%, #21172047 72%, #2117200d 100%); }
  .hero-copy { width: min(100%, 460px); padding: 72px 22px 27px; }
  .hero h1 { font-size: clamp(2.6rem, 8.5vw, 4.3rem); }
  .hero h1 em { display: inline; }
  .hero p { margin-top: 12px; }
  .hero-ornament { margin-bottom: 11px; }
  .hero-actions { margin-top: 16px; }
  .catalog { margin-top: 27px; }
  .catalog-header { flex-wrap: wrap; align-items: start; gap: 12px; }
  .search-box { width: 100%; }
  .search-box kbd { display: none; }
  .catalog-controls { margin-top: 14px; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
  .card-copy { padding: 10px 11px 12px; }
  .card-image { aspect-ratio: 1.65; }
  .card-summary { font-size: .83rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .item-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .image-toolbar { padding-inline: 10px; }
  .image-toolbar h2 { font-size: 1rem; }
  .image-toolbar .button { font-size: .79rem; padding-inline: 8px; }
}
@media (max-width: 380px) {
  .brand { font-size: 1.12rem; }
  .hero { min-height: 350px; }
  .hero-actions .button { padding-inline: 10px; }
  .card-image { aspect-ratio: 1.43; }
  .card-summary { font-size: .81rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
