:root {
  --bg: #0f1419;
  --bg-card: #1a222c;
  --text: #e8eef4;
  --muted: #9aabbc;
  --accent: #7cb87c;
  --accent-dim: #4a7a4a;
  --warn: #e8b86d;
  --danger: #d4726a;
  --link: #8ec8ff;
  --border: #2a3544;
  --max: 52rem;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 1.05rem;
}

a { color: var(--link); text-decoration-thickness: 1px; }
a:hover { color: #b8dcff; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

body[data-case-slug] {
  --max: min(72rem, 100%);
}

header.site {
  border-bottom: 1px solid var(--border);
  background: #0c1015;
  position: sticky;
  top: 0;
  z-index: 40;
}

header.site .wrap {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand span { color: var(--accent); }

nav a {
  margin-right: 0.9rem;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
}
nav a:hover { color: var(--text); }

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  line-height: 1.2;
  margin: 1.5rem 0 0.75rem;
}

.lede { color: var(--muted); font-size: 1.08rem; }

.badge-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.5rem; }

.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.accent { border-color: var(--accent-dim); color: var(--accent); }
.badge.warn { border-color: #8a6a30; color: var(--warn); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin: 1rem 0;
}

.card h2, .card h3 { margin-top: 0; }

.warn-box {
  border-left: 4px solid var(--warn);
  background: #2a2418;
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0 8px 8px 0;
}

.danger-box {
  border-left: 4px solid var(--danger);
  background: #2a1818;
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0 8px 8px 0;
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin: 1.25rem 0; }
.hero-cta { margin-top: 1rem; }

.button {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  background: var(--accent-dim);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.button:hover { filter: brightness(1.1); }
.button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text) !important;
}

.button.prominent {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.85rem 1.45rem;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #6db86d 0%, var(--accent-dim) 100%);
  box-shadow: 0 0 0 1px #8fd08f, 0 10px 28px rgba(76, 140, 76, 0.28);
}

.origin-banner {
  background: linear-gradient(160deg, #18241c 0%, var(--bg-card) 55%, #1a222c 100%);
  border: 1px solid #3a5a3a;
  border-radius: 12px;
  padding: 1.25rem 1.3rem 1.35rem;
  margin: 1.35rem 0 1.5rem;
}

.origin-banner h2 {
  margin: 0.2rem 0 0.55rem;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  line-height: 1.25;
}

.origin-banner p { margin: 0 0 1rem; color: var(--muted); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.35rem;
  font-weight: 700;
}

.essay h1 {
  font-size: clamp(1.85rem, 4.4vw, 2.45rem);
  line-height: 1.15;
  margin: 0.2rem 0 0.75rem;
}

.essay p {
  font-size: 1.08rem;
  line-height: 1.7;
  margin: 0 0 1.05rem;
}

.essay .lede {
  font-size: 1.18rem;
  margin-bottom: 1.5rem;
}

.author-bios {
  margin: 2.25rem 0 1.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.author-bios > h2 {
  font-size: 1.2rem;
  margin: 0 0 1rem;
}

.bio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem 1.1rem;
  margin: 0 0 1rem;
}

.bio-card h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.bio-card .dates {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0 0 0.65rem;
}

.bio-card p { font-size: 0.98rem; margin: 0 0 0.7rem; }

.bio-card ul {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.bio-card li {
  margin: 0.3rem 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.bio-card li strong { color: var(--text); }

ul.clean { padding-left: 1.2rem; }
ul.clean li { margin: 0.35rem 0; }

table.cases {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.cases th, table.cases td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--border);
}
table.cases th { color: var(--muted); font-weight: 600; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.thumb-grid figure {
  margin: 0;
  background: #11161c;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.thumb-grid img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background: #000;
}

.thumb-grid figcaption {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.4rem 0.45rem 0.55rem;
  line-height: 1.3;
}

.thumb-grid figure.selected {
  outline: 2px solid var(--accent);
}

.thumb-pick {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.thumb-pick input { accent-color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-dl {
  border: 1px solid var(--accent-dim);
  background: var(--accent-dim);
  color: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.header-dl:hover { filter: brightness(1.1); }

.dl-panel {
  display: none;
  position: absolute;
  right: 1rem;
  top: calc(100% + 0.4rem);
  width: min(26rem, calc(100vw - 2rem));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  z-index: 50;
}

.dl-panel.open { display: block; }

.dl-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.dl-panel .dl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.6rem 0;
}

.dl-panel .status {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--muted);
}

.dl-list {
  max-height: 14rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  margin: 0.5rem 0;
  font-size: 0.78rem;
}

.dl-list label {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin: 0.25rem 0;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
}

button.ghost:hover { border-color: var(--muted); }

.carousel-block {
  margin: 1.5rem 0 2rem;
}

.carousel-block h2 {
  margin: 0 1.25rem 0.4rem;
  font-size: 1.15rem;
}

.carousel-help {
  margin: 0 1.25rem 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.carousel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 1.25rem 0.65rem;
}

.viewer-frame {
  position: relative;
  width: 100%;
  height: min(86vh, 920px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #05070a;
}

.viewer-frame .slide,
.slide {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  touch-action: none;
  cursor: grab;
}

.slide:active { cursor: grabbing; }

.slide img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  backface-visibility: hidden;
}

.filmstrip {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  height: 86px;
  max-height: 86px;
  padding: 0.45rem 0.75rem;
  margin-top: 0.45rem;
  background: #0c1015;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  scrollbar-width: thin;
}

.filmstrip:active { cursor: grabbing; }

.filmstrip::-webkit-scrollbar { height: 10px; }
.filmstrip::-webkit-scrollbar-thumb {
  background: #3a4656;
  border-radius: 6px;
}

.film-item {
  flex: 0 0 80px;
  width: 80px;
  min-width: 80px;
  max-width: 80px;
  height: 60px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 5px;
  background: #111;
  cursor: pointer;
  overflow: hidden;
}

.film-item img {
  width: 80px !important;
  height: 60px !important;
  max-width: 80px !important;
  max-height: 60px !important;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.film-item.active {
  border-color: var(--accent);
}

.slide-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  font-size: 0.82rem;
  color: #e8eef4;
  pointer-events: none;
}

.zoom-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-size: 0.75rem;
  background: rgba(12,16,21,0.72);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  pointer-events: none;
}

footer.site {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

code, .path {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  background: #11161c;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
