:root {
  color-scheme: dark;
  font-family: "Manrope", sans-serif;
  --ink: #111026;
  --paper: #f6f1e8;
  --panel: #211e42;
  --line: rgba(255,255,255,0.12);
  --violet: #8f6bff;
  --mint: #74f0bd;
  --peach: #ffb58f;
  --yellow: #f8dc67;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(79,67,99,0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,67,99,0.055) 1px, transparent 1px),
    var(--paper);
  background-size: 16px 16px;
}
button, input, textarea { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.museum-nav {
  position: sticky;
  z-index: 20;
  top: 16px;
  width: min(1180px, calc(100% - 32px));
  min-height: 66px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: white;
  background: rgba(22,20,48,0.92);
  box-shadow: 0 16px 48px rgba(17,16,38,0.18);
  backdrop-filter: blur(18px);
}
.museum-brand { height: 66px; display: flex; align-items: center; gap: 11px; padding: 0 20px; text-decoration: none; font-size: 14px; letter-spacing: 0.1em; }
.museum-brand strong { color: var(--mint); }
.brand-mark { width: 29px; height: 29px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; transform: rotate(45deg); }
.brand-mark i { display: block; border-radius: 2px; background: var(--violet); }
.brand-mark i:nth-child(2) { background: var(--mint); }
.brand-mark i:nth-child(3) { background: var(--peach); }
.brand-mark i:nth-child(4) { background: var(--yellow); }
.museum-nav nav { height: 66px; display: flex; align-items: center; gap: 4px; padding: 0 12px; border-left: 1px solid var(--line); }
.museum-nav nav a, .museum-nav nav span { padding: 12px 14px; border-radius: 10px; font: 500 9px "DM Mono", monospace; letter-spacing: 0.1em; text-decoration: none; }
.museum-nav nav a:hover { background: rgba(255,255,255,0.08); }
.museum-nav nav span { color: var(--ink); background: var(--mint); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 76px 0 96px; }
.eyebrow { color: #746d86; font: 500 9px "DM Mono", monospace; letter-spacing: 0.16em; }
.museum-hero { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 60px; align-items: end; padding: 48px 24px 64px; }
.museum-hero h1 { max-width: 760px; margin: 13px 0 20px; font-size: clamp(44px, 7vw, 82px); line-height: 0.98; letter-spacing: -0.055em; }
.museum-hero p { max-width: 650px; margin: 0; color: #70697e; font-size: 14px; line-height: 1.65; }
.museum-stats { display: grid; grid-template-columns: repeat(3, auto); gap: 28px; margin: 0; padding: 22px 26px; border: 1px solid rgba(17,16,38,0.1); border-radius: 18px; background: rgba(255,255,255,0.62); box-shadow: 0 18px 48px rgba(17,16,38,0.08); }
.museum-stats div { min-width: 78px; }
.museum-stats dt { font-size: 29px; font-weight: 800; letter-spacing: -0.04em; }
.museum-stats dd { margin: 4px 0 0; color: #8a8297; font: 500 7px "DM Mono", monospace; letter-spacing: 0.11em; }

.collection { padding: 0 24px; }
.collection > header { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding-bottom: 18px; border-bottom: 1px solid rgba(17,16,38,0.12); }
.collection h2 { margin: 7px 0 0; font-size: 24px; }
.collection > header p { max-width: 360px; margin: 0; color: #8a8297; font-size: 11px; line-height: 1.5; text-align: right; }
.museum-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; padding-top: 22px; }
.museum-empty { grid-column: 1/-1; padding: 64px 24px; border: 1px dashed rgba(17,16,38,0.18); border-radius: 18px; text-align: center; background: rgba(255,255,255,0.42); }
.museum-empty span { color: #81798e; font: 500 8px "DM Mono", monospace; letter-spacing: 0.12em; }
.museum-empty h3 { max-width: 520px; margin: 12px auto 22px; font-size: 24px; }
.museum-empty a { display: inline-grid; place-items: center; height: 40px; padding: 0 16px; border-radius: 10px; color: white; background: var(--ink); font: 600 8px "DM Mono", monospace; letter-spacing: 0.08em; text-decoration: none; }
.archive-card { position: relative; overflow: hidden; padding: 0; border: 1px solid rgba(17,16,38,0.1); border-radius: 19px; color: var(--ink); background: rgba(255,255,255,0.7); box-shadow: 0 15px 38px rgba(17,16,38,0.08); cursor: pointer; text-align: left; transition: transform 180ms ease, box-shadow 180ms ease; }
.archive-card:hover { transform: translateY(-4px); box-shadow: 0 22px 48px rgba(17,16,38,0.13); }
.archive-card canvas { width: 100%; aspect-ratio: 16/10; display: block; background: #efe7dc; image-rendering: pixelated; }
.archive-card-body { padding: 17px; }
.archive-card-top { display: flex; justify-content: space-between; gap: 10px; color: #81798e; font: 500 8px "DM Mono", monospace; letter-spacing: 0.1em; }
.archive-card h3 { min-height: 48px; margin: 10px 0 16px; font-size: 19px; line-height: 1.22; }
.archive-card footer { display: flex; align-items: center; justify-content: space-between; padding-top: 13px; border-top: 1px solid rgba(17,16,38,0.09); }
.mini-painters { display: flex; }
.mini-painters img { width: 28px; height: 28px; margin-right: -7px; border: 2px solid white; border-radius: 9px; object-fit: cover; background: white; }
.archive-card footer span { color: #81798e; font: 500 8px "DM Mono", monospace; }

dialog { width: min(1040px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; border: 1px solid rgba(255,255,255,0.14); border-radius: 24px; color: white; background: #17142f; box-shadow: 0 30px 100px rgba(12,10,27,0.55); }
dialog::backdrop { background: rgba(10,9,24,0.64); backdrop-filter: blur(10px); }
.close-dialog { position: sticky; z-index: 4; top: 14px; float: right; width: 38px; height: 38px; margin: 14px 14px -52px 0; border: 1px solid var(--line); border-radius: 11px; color: white; background: rgba(23,20,47,0.82); cursor: pointer; }
.archive-layout { display: grid; grid-template-columns: 1.2fr 0.8fr; }
.archive-art { min-height: 530px; display: grid; place-items: center; align-content: center; padding: 42px; background: #eee6da; }
#archive-canvas { width: 100%; max-width: 620px; aspect-ratio: 9/7; display: block; border-radius: 15px; background: #f4ede3; box-shadow: 0 18px 45px rgba(17,16,38,0.12); image-rendering: pixelated; }
.archive-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 16px; }
.archive-palette i { width: 17px; height: 17px; border: 1px solid rgba(17,16,38,0.16); border-radius: 5px; }
.archive-story { padding: 64px 38px 40px; }
.archive-story .eyebrow { color: var(--mint); }
.archive-story h2 { margin: 12px 0 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -0.035em; text-transform: uppercase; }
.archive-date { margin: 0 0 22px; color: rgba(255,255,255,0.48); font: 500 9px "DM Mono", monospace; }
.archive-painters { display: flex; align-items: center; padding: 13px 0 20px; border-bottom: 1px solid var(--line); }
.archive-painters img { width: 34px; height: 34px; margin-right: -8px; border: 2px solid #17142f; border-radius: 10px; object-fit: cover; }
.archive-painters span { margin-left: 18px; color: rgba(255,255,255,0.62); font-size: 10px; }
.archive-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 20px 0; }
.archive-facts div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,0.035); }
.archive-facts dt, .proof-card span { color: rgba(255,255,255,0.38); font: 500 7px "DM Mono", monospace; letter-spacing: 0.08em; }
.archive-facts dd { margin: 5px 0 0; font-size: 13px; font-weight: 700; }
.proof-card { display: grid; gap: 5px; padding: 15px; border-radius: 12px; color: #18152e; background: var(--mint); }
.proof-card span { color: rgba(24,21,46,0.58); }
.proof-card code { overflow: hidden; margin-bottom: 7px; font: 500 8px "DM Mono", monospace; text-overflow: ellipsis; white-space: nowrap; }
.proof-card code:last-child { margin-bottom: 0; }

.comments { padding: 34px 42px 42px; border-top: 1px solid var(--line); }
.comments > header { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.comments h2 { margin: 7px 0 0; font-size: 24px; }
.comments > header > span { color: rgba(255,255,255,0.38); font: 500 8px "DM Mono", monospace; }
.comment-list { display: grid; gap: 8px; margin: 20px 0; }
.comment { display: grid; grid-template-columns: 34px 1fr auto; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.035); }
.comment-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #18152e; background: var(--yellow); font-size: 11px; font-weight: 800; }
.comment strong { display: block; font-size: 10px; }
.comment p { margin: 4px 0 0; color: rgba(255,255,255,0.58); font-size: 11px; line-height: 1.5; }
.comment time { color: rgba(255,255,255,0.32); font: 500 7px "DM Mono", monospace; }
.comment-empty { padding: 18px; border: 1px dashed rgba(255,255,255,0.18); border-radius: 12px; color: rgba(255,255,255,0.45); font-size: 11px; text-align: center; }
#comment-form { display: grid; grid-template-columns: 0.34fr 1fr; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
#comment-form label { display: grid; gap: 6px; }
#comment-form label span { color: rgba(255,255,255,0.42); font: 500 8px "DM Mono", monospace; letter-spacing: 0.08em; }
#comment-form input, #comment-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; color: white; background: rgba(255,255,255,0.06); }
#comment-form input { height: 42px; padding: 0 12px; }
#comment-form textarea { min-height: 76px; padding: 11px 12px; resize: vertical; }
#comment-form input:focus, #comment-form textarea:focus { border-color: var(--mint); }
#comment-form > div { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
#comment-form p { margin: 0; color: rgba(255,255,255,0.38); font-size: 9px; }
#comment-form button { height: 39px; padding: 0 16px; border: 0; border-radius: 10px; color: #18152e; background: var(--mint); font: 700 8px "DM Mono", monospace; letter-spacing: 0.09em; cursor: pointer; }

@media (max-width: 900px) {
  .museum-hero { grid-template-columns: 1fr; gap: 30px; }
  .museum-stats { width: fit-content; }
  .museum-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .archive-layout { grid-template-columns: 1fr; }
  .archive-art { min-height: 420px; }
}

@media (max-width: 620px) {
  .museum-nav { top: 8px; width: calc(100% - 16px); margin-top: 8px; }
  .museum-brand { padding: 0 12px; font-size: 11px; }
  .brand-mark { width: 25px; height: 25px; }
  .museum-nav nav a, .museum-nav nav span { padding: 10px 8px; font-size: 7px; }
  main { width: 100%; padding-top: 45px; }
  .museum-hero { padding: 42px 20px 48px; }
  .museum-hero h1 { font-size: 44px; }
  .museum-stats { width: 100%; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 16px; }
  .museum-stats div { min-width: 0; }
  .museum-stats dt { font-size: 22px; }
  .collection { padding: 0 12px; }
  .collection > header { align-items: start; flex-direction: column; }
  .collection > header p { text-align: left; }
  .museum-grid { grid-template-columns: 1fr; }
  .archive-art { min-height: 330px; padding: 28px 18px; }
  .archive-story { padding: 38px 22px 28px; }
  .archive-facts { grid-template-columns: 1fr; }
  .comments { padding: 28px 20px; }
  #comment-form { grid-template-columns: 1fr; }
  #comment-form > div { align-items: stretch; flex-direction: column; }
  .comment { grid-template-columns: 34px 1fr; }
  .comment time { grid-column: 2; }
}

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