/* Smoke and Vitriol — viewer theme */
:root {
  --bg:           #2a1f12;   /* dark earth */
  --bg-card:      #3a2a18;   /* card background, slightly lighter */
  --bg-card-hi:  #4a3520;
  --text:         #f0e0c2;   /* parchment_pale */
  --text-muted:   #c49a6a;   /* parchment_mid */
  --accent:       #d44a1a;   /* fire_orange */
  --accent-2:     #4d7a5c;   /* verdigris */
  --accent-3:     #e0c84a;   /* sulphur_mid */
  --line:         #8a4f2c;   /* copper_mid */
  --shadow:       rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Georgia', 'Iowan Old Style', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, #1c1410 0%, #2a1f12 100%);
  border-bottom: 2px solid var(--line);
  padding: 1.2rem 1.5rem 0.8rem;
  box-shadow: 0 4px 12px var(--shadow);
}

.title-row h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  color: var(--accent-3);
}

.subtitle {
  margin: 0.2rem 0 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

.stats {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}
.stats strong { color: var(--accent-3); font-weight: normal; }

.controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
}
.controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.controls select,
.controls input,
.controls button {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.35rem 0.6rem;
  font-family: inherit;
  font-size: 0.95rem;
  border-radius: 2px;
}
.controls input { min-width: 200px; }
.controls button {
  cursor: pointer;
  align-self: flex-end;
  background: var(--bg-card-hi);
}
.controls button:hover { background: var(--accent); color: var(--bg); }

main#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 1.2rem;
}
main#grid.size-bg {
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
}

.work-section {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-bottom: 0.4rem;
}
.work-section:first-child { margin-top: 0; }
.work-section h2 {
  font-size: 1.25rem;
  color: var(--accent);
  margin: 0 0 0.2rem;
  letter-spacing: 0.01em;
}
.work-section .work-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.6rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card:hover {
  background: var(--bg-card-hi);
  border-color: var(--accent-3);
  transform: translateY(-2px);
}

.card .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  align-items: center;
  background: #1c1410;
  padding: 0.3rem;
  border-radius: 2px;
}
.card .pair img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #0a0a0a;
}
.card .pair .raw img {
  image-rendering: auto;
}

.card .pair .label {
  position: absolute;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.card .meta .caption {
  color: var(--text);
  font-size: 0.85rem;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta .badge {
  display: inline-block;
  background: var(--bg-card-hi);
  color: var(--accent-3);
  border: 1px solid var(--line);
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
  text-transform: uppercase;
  border-radius: 2px;
  margin-right: 0.3rem;
}

/* Modal */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 4, 0.94);
  z-index: 100;
  overflow: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#modal.hidden { display: none; }

#modal-close {
  position: fixed;
  top: 1rem; right: 1rem;
  font-size: 2rem;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 3rem; height: 3rem;
  cursor: pointer;
  z-index: 101;
}
#modal-close:hover { background: var(--accent); }

.modal-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1400px;
  width: 100%;
}
.modal-inner .pane h3 {
  font-size: 1rem;
  color: var(--accent-3);
  margin: 0 0 0.5rem;
  text-align: center;
  font-weight: normal;
  letter-spacing: 0.02em;
}
.modal-inner .pane img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: #0a0a0a;
}
.modal-inner .pane:last-child img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Modal toolbar (side-by-side vs. compare slider toggle) */
.modal-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.modal-toolbar button {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 2px;
}
.modal-toolbar button.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.modal-toolbar button:hover:not(.active) {
  background: var(--bg-card-hi);
}

/* Compare slider stage */
.compare-stage {
  display: none;
  width: 100%;
  max-width: 900px;
}
.modal-inner.compare-mode { display: none; }
.modal-inner.compare-mode ~ .compare-stage { display: block; }

.compare-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;       /* matches pixelated 480x576 background */
  border: 1px solid var(--line);
  background: #0a0a0a;
  user-select: none;
  overflow: hidden;
}
.compare-wrap .compare-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.compare-wrap .compare-pixel-overlay {
  clip-path: inset(0 50% 0 0);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.compare-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 4px;
  background: var(--accent-3);
  cursor: ew-resize;
  transform: translateX(-50%);
}
.compare-handle-pip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.4rem;
  height: 2.4rem;
  background: var(--accent);
  color: var(--bg);
  border: 2px solid var(--accent-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  user-select: none;
}
.compare-handle:focus {
  outline: 2px solid var(--accent-3);
  outline-offset: 2px;
}
.compare-hint {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.modal-meta {
  margin-top: 1.5rem;
  max-width: 1400px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
}
.modal-meta dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1rem; }
.modal-meta dt { color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
.modal-meta dd { margin: 0; color: var(--text); word-break: break-all; }
.modal-meta a { color: var(--accent-3); }

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
footer code { color: var(--accent-2); background: var(--bg-card); padding: 0.1rem 0.4rem; border-radius: 2px; }
