:root {
	--archive-bg: #0b1614;
	--archive-panel: #13231f;
	--archive-paper: #e8dbc0;
	--archive-ink: #252019;
	--archive-line: #395147;
	--archive-jade: #3f9c7d;
	--archive-gold: #d4a95d;
	--archive-rust: #a94d39;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--archive-bg); }
button, input, select { font: inherit; }

.archive-page {
	min-height: 100dvh;
	padding-bottom: 112px;
	color: #edf0e7;
	background: linear-gradient(180deg, #10221e 0, #0b1614 360px);
	font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

.archive-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
	width: min(1500px, calc(100% - 48px));
	margin: 0 auto;
	padding: 28px 0 24px;
	border-bottom: 1px solid var(--archive-line);
}

.archive-identity { display: flex; align-items: center; gap: 18px; }
.archive-identity > a {
	display: grid; place-items: center; width: 42px; height: 42px;
	border: 1px solid #537066; border-radius: 50%; color: #f7e9c7;
	text-decoration: none; font-size: 22px;
}
.archive-identity span, .lineage-copy span, .artifact-meta > span, .comparison-stage header span, .artifact-lightbox header span {
	font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #9fb7ab;
}
.archive-identity h1 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 36px; letter-spacing: 0; }
.archive-summary { display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: baseline; text-align: right; }
.archive-summary strong { color: var(--archive-gold); font-family: 'IBM Plex Mono', monospace; font-size: 28px; }
.archive-summary span { font-size: 13px; }
.archive-summary small { grid-column: 1 / 3; color: #8fa299; font-size: 11px; }

.lineage-band {
	display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(520px, 1.3fr); gap: 42px;
	width: min(1500px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0;
}
.lineage-copy p { max-width: 540px; margin: 8px 0 0; color: #cad5ce; font-family: 'Playfair Display', serif; font-size: 19px; line-height: 1.45; }
.era-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--archive-line); }
.era-tabs button { display: grid; gap: 4px; padding: 14px; border: 0; border-right: 1px solid var(--archive-line); color: #b8c8bf; background: #142722; cursor: pointer; text-align: left; }
.era-tabs button:last-child { border-right: 0; }
.era-tabs button.active { color: #fff2d1; background: #245b4c; box-shadow: inset 0 -3px var(--archive-gold); }
.era-tabs span { font-size: 12px; }
.era-tabs b { font-family: 'IBM Plex Mono', monospace; font-size: 18px; }

.system-band { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 28px; width: min(1500px, calc(100% - 48px)); margin: 0 auto 28px; padding-top: 24px; border-top: 1px solid var(--archive-line); }
.system-band > div > span { color: var(--archive-gold); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.system-band > div p { margin: 6px 0 0; color: #9db0a6; font-family: 'Playfair Display', serif; font-size: 14px; line-height: 1.4; }
.system-band nav { display: flex; flex-wrap: wrap; gap: 7px; }
.system-band button { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 6px 10px; border: 1px solid #3d574d; border-radius: 4px; color: #bccbc3; background: #10201c; cursor: pointer; }
.system-band button.active { border-color: var(--archive-gold); color: #fff0ca; background: #285848; }
.system-band button span { font-size: 10px; }
.system-band button b { color: var(--archive-gold); font-family: 'IBM Plex Mono', monospace; font-size: 10px; }

.archive-tools {
	position: sticky; z-index: 5; top: 0; display: grid; grid-template-columns: minmax(240px, 1fr) 170px 180px auto auto auto auto auto;
	align-items: end; gap: 14px; padding: 14px max(24px, calc((100% - 1500px) / 2));
	border-block: 1px solid var(--archive-line); background: rgba(11, 22, 20, 0.96); backdrop-filter: blur(12px);
}
.archive-search, .category-select, .type-select { display: grid; gap: 5px; }
.archive-search span, .category-select span, .type-select span { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #96aaa0; }
.archive-search input, .category-select select, .type-select select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #496158; border-radius: 4px; color: #f4eddd; background: #14231f; outline: none; }
.archive-search input:focus, .category-select select:focus, .type-select select:focus { border-color: var(--archive-gold); }
.result-count { display: grid; justify-items: center; min-width: 64px; }
.result-count b { font-family: 'IBM Plex Mono', monospace; color: var(--archive-gold); }
.result-count span { color: #91a69b; font-size: 10px; text-transform: uppercase; }
.reset-filter, .swipe-launch, .shortlist-filter, .share-shortlist, .archive-empty button { height: 40px; padding: 0 13px; border: 1px solid #65796f; border-radius: 4px; color: #e8eee8; background: transparent; cursor: pointer; white-space: nowrap; }
.swipe-launch { border-color: var(--archive-gold); color: #201a0d; background: var(--archive-gold); font-weight: 700; }
.swipe-launch b { margin-left: 5px; font-family: 'IBM Plex Mono', monospace; }
.shortlist-filter { border-color: #806f4d; color: #f3dfb0; }
.shortlist-filter b { margin-left: 5px; color: var(--archive-gold); font-family: 'IBM Plex Mono', monospace; }
.shortlist-filter[aria-pressed="true"] { border-color: var(--archive-gold); color: #fff4d8; background: #534425; box-shadow: inset 0 -2px var(--archive-gold); }
.share-shortlist { border-color: #426e5d; color: #dbeae2; background: #17362d; }
.share-shortlist:disabled { cursor: default; opacity: .42; }
.shortlist-status { position: fixed; z-index: 30; right: 18px; bottom: 18px; margin: 0; padding: 10px 13px; border: 1px solid #806f4d; border-radius: 4px; color: #fff0c8; background: #1a2d27; box-shadow: 0 12px 34px rgba(0,0,0,.42); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 140ms ease, transform 140ms ease; }
.shortlist-status.visible { opacity: 1; transform: translateY(0); }

.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; width: min(1500px, calc(100% - 48px)); margin: 24px auto 0; }
.artifact-card { min-width: 0; overflow: hidden; border: 1px solid #31473f; border-radius: 6px; background: #111f1c; transition: border-color 140ms ease, transform 140ms ease; }
.artifact-card:hover { transform: translateY(-2px); border-color: #668073; }
.artifact-card.marked { border-color: var(--archive-gold); box-shadow: inset 0 0 0 1px var(--archive-gold); }
.artifact-card.kept { border-color: #7f6d45; background: #17241f; box-shadow: inset 0 3px #d4a95d; }
.artifact-image { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; padding: 0; border: 0; background: #07110f; cursor: zoom-in; }
.artifact-image img { width: 100%; height: 100%; object-fit: contain; }
.artifact-image > span { position: absolute; right: 7px; bottom: 7px; padding: 3px 5px; border-radius: 3px; color: #e8dfca; background: rgba(5, 12, 10, 0.8); font-family: 'IBM Plex Mono', monospace; font-size: 9px; }
.artifact-meta { display: grid; gap: 5px; padding: 13px 14px 14px; }
.artifact-meta h2 { margin: 0; overflow: hidden; color: #f1ead9; font-family: 'Playfair Display', serif; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.artifact-meta p { margin: 0; overflow: hidden; color: #80968b; font-family: 'IBM Plex Mono', monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.artifact-meta > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 5px; }
.artifact-meta small { color: #bdc9c2; }
.artifact-meta .artifact-tags { justify-content: flex-start; flex-wrap: wrap; margin-top: 2px; }
.artifact-tags small, .artifact-tags i { padding: 3px 5px; border-radius: 3px; color: #b7cbc1; background: #1b332c; font-size: 8px; font-style: normal; }
.artifact-tags i { color: #dbc58e; background: #302b20; }
.artifact-actions { display: flex; gap: 6px; margin: 0 !important; }
.artifact-meta button { min-height: 27px; padding: 4px 8px; border: 1px solid #547065; border-radius: 3px; color: #dce8e0; background: transparent; font-size: 10px; cursor: pointer; }
.artifact-meta button[data-good] { border-color: #766846; color: #e7d3a3; }
.artifact-meta button[data-good][aria-pressed="true"] { border-color: var(--archive-gold); color: #201a0d; background: var(--archive-gold); font-weight: 700; }

.archive-empty { display: grid; place-items: center; min-height: 380px; text-align: center; }
.archive-empty h2 { margin: 0; font-family: 'Playfair Display', serif; font-size: 30px; }
.archive-empty p { color: #9eb1a7; }

.load-more { display: grid; place-items: center; gap: 7px; margin: 28px auto 0; }
.load-more button { min-width: 180px; height: 42px; border: 1px solid var(--archive-gold); border-radius: 4px; color: #fff1cf; background: #1e4d40; cursor: pointer; }
.load-more span { color: #8fa299; font-family: 'IBM Plex Mono', monospace; font-size: 10px; }

.compare-dock { position: fixed; z-index: 12; left: 50%; bottom: 18px; display: flex; align-items: center; gap: 10px; width: min(760px, calc(100% - 28px)); padding: 8px; border: 1px solid #7b6945; border-radius: 6px; background: #182a24; box-shadow: 0 16px 40px rgba(0,0,0,.45); transform: translateX(-50%); }
.compare-dock > div { display: grid; min-width: 100px; padding: 0 8px; }
.compare-dock > div span { color: var(--archive-gold); font-size: 10px; text-transform: uppercase; }
.compare-dock > div b { font-size: 11px; }
.compare-dock > button:not(.clear-compare) { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 4px; border: 1px solid #3f574d; border-radius: 4px; color: #e9eee9; background: #0f1d19; text-align: left; cursor: pointer; }
.compare-dock img { width: 48px; height: 38px; object-fit: cover; }
.compare-dock button span { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.clear-compare { border: 0; color: #c6d1ca; background: transparent; cursor: pointer; }

.comparison-stage { position: fixed; z-index: 10; inset: 0; overflow: auto; padding: 28px; color: #edf0e7; background: #08110f; }
.comparison-stage > header { display: flex; align-items: center; justify-content: space-between; max-width: 1500px; margin: 0 auto 20px; }
.comparison-stage h2 { margin: 2px 0 0; font-family: 'Playfair Display', serif; font-size: 28px; }
.comparison-stage header button { padding: 9px 13px; border: 1px solid #60766b; border-radius: 4px; color: #edf0e7; background: transparent; cursor: pointer; }
.comparison-images { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; max-width: 1500px; margin: auto; }
.comparison-images figure { min-width: 0; margin: 0; }
.comparison-images figure > div { display: grid; place-items: center; height: calc(100dvh - 190px); min-height: 400px; border: 1px solid #334a41; background: #101c19; }
.comparison-images img { max-width: 100%; max-height: 100%; object-fit: contain; }
.comparison-images figcaption { display: grid; gap: 3px; padding: 10px 0; }
.comparison-images figcaption span, .comparison-images figcaption small { color: #94a89e; font-size: 10px; }
.comparison-images figcaption strong { font-family: 'Playfair Display', serif; font-size: 18px; }
.comparison-images figcaption small { overflow-wrap: anywhere; font-family: 'IBM Plex Mono', monospace; }

.artifact-lightbox { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(1, 7, 6, 0.9); }
.lightbox-dialog { display: grid; grid-template-rows: auto minmax(0,1fr) auto; width: min(1280px, 96vw); height: min(900px, 92dvh); border: 1px solid #52695f; background: #101d19; }
.artifact-lightbox header, .artifact-lightbox footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px; border-bottom: 1px solid #354b42; }
.artifact-lightbox footer { border-top: 1px solid #354b42; border-bottom: 0; }
.artifact-lightbox h2 { margin: 2px 0 0; font-family: 'Playfair Display', serif; font-size: 24px; }
.artifact-lightbox header button { border: 0; color: #f2e7cc; background: transparent; font-size: 28px; cursor: pointer; }
.artifact-lightbox footer button { padding: 8px 12px; border: 1px solid #71847a; border-radius: 4px; color: #e8eee9; background: transparent; cursor: pointer; }
.artifact-lightbox footer button[data-good][aria-pressed="true"] { border-color: var(--archive-gold); color: #201a0d; background: var(--archive-gold); font-weight: 700; }
.artifact-lightbox code { overflow: hidden; color: #8fa69a; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-image { display: grid; place-items: center; min-height: 0; overflow: hidden; background: #070e0c; }
.lightbox-image img { max-width: 100%; max-height: 100%; object-fit: contain; }

.swipe-review { position: fixed; z-index: 40; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; color: #edf0e7; background: #0b1714; }
.swipe-review > header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; min-height: 68px; padding: 12px 24px; border-bottom: 1px solid #314b41; background: rgba(8, 18, 15, .88); }
.swipe-review > header > div:first-child { display: grid; gap: 2px; }
.swipe-review > header span { color: #9eb1a7; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.swipe-review > header strong { font-family: 'IBM Plex Mono', monospace; font-size: 13px; }
.swipe-review-progress { display: flex; align-items: center; justify-content: center; gap: 16px; }
.swipe-review-progress b { color: var(--archive-gold); font-family: 'IBM Plex Mono', monospace; font-size: 15px; }
.swipe-review-progress i { width: min(260px, 24vw); height: 4px; overflow: hidden; background: #263b34; }
.swipe-review-progress i::after { display: block; width: var(--review-progress, 0%); height: 100%; background: var(--archive-gold); content: ''; transition: width 180ms ease; }
.swipe-review-close { justify-self: end; width: 40px; height: 40px; border: 1px solid #536c61; border-radius: 50%; color: #f1ead9; background: transparent; font-size: 24px; cursor: pointer; }
.swipe-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 22px; }
.swipe-card { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; width: min(860px, calc(100vw - 48px)); height: min(720px, calc(100dvh - 190px)); overflow: hidden; border: 1px solid #536b60; border-radius: 8px; background: #101e1a; box-shadow: 0 26px 70px rgba(0, 0, 0, .48); cursor: grab; touch-action: none; transform-origin: 50% 90%; transition: transform 200ms ease, opacity 200ms ease; user-select: none; }
.swipe-card.dragging { cursor: grabbing; transition: none; }
.swipe-card.exit-left { opacity: 0; transform: translateX(-115vw) rotate(-14deg) !important; }
.swipe-card.exit-right { opacity: 0; transform: translateX(115vw) rotate(14deg) !important; }
.swipe-card-image { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; background: #07100e; }
.swipe-card-image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.swipe-verdict { position: absolute; z-index: 2; top: 28px; padding: 9px 15px; border: 3px solid currentColor; border-radius: 5px; font-size: 24px; font-weight: 800; letter-spacing: .08em; opacity: 0; text-transform: uppercase; }
.swipe-verdict.pass { left: 24px; color: #df7766; transform: rotate(-8deg); }
.swipe-verdict.keep { right: 24px; color: #e0bd72; transform: rotate(8deg); }
.swipe-card-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; padding: 16px 18px; border-top: 1px solid #31483f; }
.swipe-card-copy > span { color: var(--archive-gold); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.swipe-card-copy h2 { grid-column: 1; margin: 0; overflow: hidden; font-family: 'Playfair Display', serif; font-size: 24px; text-overflow: ellipsis; white-space: nowrap; }
.swipe-card-copy p { grid-column: 1; margin: 0; overflow: hidden; color: #83998e; font-family: 'IBM Plex Mono', monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.swipe-card-copy small { grid-column: 2; grid-row: 1 / 4; align-self: center; padding: 5px 7px; border-radius: 3px; color: #c9d7cf; background: #1b332c; }
.swipe-controls { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 82px; padding: 10px 20px 16px; }
.swipe-controls button { display: grid; place-items: center; min-width: 132px; height: 48px; border: 1px solid #5f746a; border-radius: 4px; color: #e7ede8; background: #14241f; cursor: pointer; font-weight: 700; }
.swipe-controls button[data-review-choice="pass"] { border-color: #8d4d44; color: #f1b0a5; }
.swipe-controls button[data-review-choice="keep"] { border-color: #9b7b3e; color: #211a0b; background: var(--archive-gold); }
.swipe-controls button[data-review-undo] { min-width: 76px; color: #a9bab1; font-weight: 500; }
.swipe-controls button:disabled { cursor: default; opacity: .35; }
.swipe-complete { display: grid; place-items: center; width: min(680px, calc(100vw - 32px)); padding: 52px 28px; border: 1px solid #4b6459; border-radius: 8px; background: #11211c; text-align: center; }
.swipe-complete h2 { margin: 8px 0; font-family: 'Playfair Display', serif; font-size: 34px; }
.swipe-complete p { max-width: 460px; color: #9fb1a8; line-height: 1.5; }
.swipe-complete-stats { display: flex; gap: 12px; margin: 18px 0 24px; }
.swipe-complete-stats span { display: grid; min-width: 110px; padding: 12px; border: 1px solid #3c554a; }
.swipe-complete-stats b { color: var(--archive-gold); font-family: 'IBM Plex Mono', monospace; font-size: 22px; }
.swipe-complete-stats small { color: #91a49a; }
.swipe-complete button { height: 42px; padding: 0 16px; border: 1px solid var(--archive-gold); border-radius: 4px; color: #211a0b; background: var(--archive-gold); cursor: pointer; font-weight: 700; }

@media (max-width: 1200px) {
	.archive-tools { grid-template-columns: minmax(260px, 1fr) 180px 190px auto; }
	.archive-search { grid-column: 1; }
	.category-select { grid-column: 2; }
	.type-select { grid-column: 3; }
	.result-count { grid-column: 4; }
	.swipe-launch { grid-column: 1; grid-row: 2; }
	.shortlist-filter { grid-column: 2; grid-row: 2; }
	.share-shortlist { grid-column: 3; grid-row: 2; }
	.reset-filter { grid-column: 4; grid-row: 2; }
}

@media (max-width: 820px) {
	.archive-header { width: calc(100% - 28px); }
	.archive-summary { display: none; }
	.lineage-band { grid-template-columns: 1fr; gap: 20px; width: calc(100% - 28px); }
	.system-band { grid-template-columns: 1fr; gap: 14px; width: calc(100% - 28px); }
	.era-tabs { grid-template-columns: repeat(2, 1fr); }
	.era-tabs button:nth-child(2) { border-right: 0; }
	.era-tabs button:nth-child(-n+2) { border-bottom: 1px solid var(--archive-line); }
	.archive-tools { position: static; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; padding-inline: 14px; }
	.archive-search { grid-column: 1 / 4; grid-row: 1; }
	.category-select { grid-column: 1; grid-row: 2; }
	.type-select { grid-column: 2; grid-row: 2; }
	.shortlist-filter { grid-column: 3; grid-row: 2; }
	.swipe-launch { grid-column: 1; grid-row: 3; }
	.share-shortlist { grid-column: 2; grid-row: 3; }
	.result-count { display: none; }
	.reset-filter { grid-column: 3; grid-row: 3; }
	.artifact-grid { grid-template-columns: repeat(2, minmax(0,1fr)); width: calc(100% - 28px); gap: 12px; }
	.comparison-images { grid-template-columns: 1fr; }
	.comparison-images figure > div { height: 58dvh; }
}

@media (max-width: 520px) {
	.archive-page { padding-bottom: 130px; }
	.archive-header { padding-top: 18px; }
	.archive-identity h1 { font-size: 28px; }
	.lineage-copy p { font-size: 17px; }
	.archive-tools { grid-template-columns: minmax(0,1fr) auto; }
	.archive-search { grid-column: 1 / 3; grid-row: 1; }
	.category-select { grid-column: 1; grid-row: 2; }
	.type-select { grid-column: 1; grid-row: 3; }
	.shortlist-filter { grid-column: 2; grid-row: 2; }
	.swipe-launch { grid-column: 1; grid-row: 4; }
	.share-shortlist { grid-column: 2; grid-row: 4; }
	.reset-filter { grid-column: 2; grid-row: 3; }
	.artifact-grid { grid-template-columns: 1fr; }
	.compare-dock { flex-wrap: wrap; }
	.compare-dock > div { width: 100%; }
	.comparison-stage { padding: 16px; }
	.comparison-stage > header { align-items: flex-start; gap: 12px; }
	.artifact-lightbox { padding: 8px; }
	.lightbox-dialog { width: 100%; height: 96dvh; }
	.artifact-lightbox footer { align-items: stretch; flex-direction: column; }
	.swipe-review > header { grid-template-columns: 1fr auto; padding-inline: 14px; }
	.swipe-review-progress { grid-column: 1 / 3; grid-row: 2; }
	.swipe-review-progress i { width: min(220px, 55vw); }
	.swipe-stage { padding: 10px; }
	.swipe-card { width: calc(100vw - 20px); height: calc(100dvh - 214px); }
	.swipe-card-copy { padding: 12px; }
	.swipe-card-copy h2 { font-size: 20px; }
	.swipe-controls { gap: 8px; min-height: 72px; padding-inline: 10px; }
	.swipe-controls button { min-width: 0; flex: 1; }
	.swipe-controls button[data-review-undo] { flex: 0 0 64px; }
}
