:root {
  --paper: #f6f0e6;
  --paper-2: #fbf7f0;
  --ink: #3a2a22;
  --ink-soft: #6d584c;
  --line: #e3d5c4;
  --brass: #8d6840;
  --brass-deep: #6e4e2e;
  --rose: #7a3e3a;
  --shadow: 0 18px 40px rgba(70, 46, 28, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 340;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255, 252, 246, 0.9), transparent 60%),
    linear-gradient(180deg, rgba(90, 60, 40, 0.04) 1px, transparent 1px) 0 0 / 100% 28px,
    var(--paper);
  line-height: 1.45;
}

.sheet { max-width: 1120px; margin: 0 auto; padding: 28px 20px 72px; }
.mast { margin-bottom: 22px; }
.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--brass);
}
h1, h2, legend { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 54px); line-height: 1.05; font-weight: 560; }
h2 { margin: 0; font-size: 28px; }
.lede { margin: 10px 0 0; max-width: 46rem; color: var(--ink-soft); font-size: 17px; }
.mast-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; }

.card, .block, .press {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.gate { max-width: 460px; padding: 26px; }
label, legend { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input:not([type]), select, #code {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid #d9c8b4;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
input:focus, select:focus { outline: 2px solid #c4a27a; outline-offset: 1px; }
.hint { color: var(--ink-soft); font-size: 14px; margin: 8px 0 0; }
.alert { color: var(--rose); margin: 10px 0 0; }
.hidden { display: none !important; }

.btn, .text-btn {
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--ink);
  color: #f8f1e7;
  padding: 13px 22px;
  text-decoration: none;
  min-height: 48px;
}
.btn:hover { background: #241812; }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.text-btn {
  background: transparent;
  border: 0;
  color: var(--brass-deep);
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.gate .btn { margin-top: 16px; }

.block { padding: 22px; margin-bottom: 18px; }
.block-head { margin-bottom: 14px; }
.block-head p, .block > p { margin: 6px 0 0; color: var(--ink-soft); }

.theme-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
}
.theme {
  flex: 0 0 104px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fffdf9;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.theme[aria-checked="true"] { border-color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass); }
.theme img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  background: #efe4d4;
}
.theme strong {
  display: block;
  margin: 6px 2px 2px;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 560;
  line-height: 1.2;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
fieldset { border: 0; margin: 0; padding: 0; }
.choice, .stack-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label, .stack-choice label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--ink);
}
.stack-choice { flex-direction: column; }
.stack-choice label { width: 100%; }
.hours { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.year-label { margin-top: 14px; max-width: 160px; }
.cover-text { margin-top: 16px; border: 0; padding: 0; }
.cover-text legend { font-family: var(--serif); font-size: 18px; margin-bottom: 8px; }
.cover-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split-field { margin-top: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.section-tools { display: flex; gap: 18px; margin-bottom: 8px; }
.acc { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; overflow: hidden; }
.acc-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.acc-thumb {
  width: 42px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
  background: #efe4d4;
  flex: 0 0 auto;
}
.acc-name { font-family: var(--serif); font-size: 20px; font-weight: 560; }
.acc-count { margin-left: auto; color: var(--ink-soft); font-size: 14px; white-space: nowrap; }
.acc-mark { color: var(--brass-deep); transition: transform 0.15s ease; }
.acc.is-open .acc-mark { transform: rotate(90deg); }
.strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 12px 14px;
  scroll-snap-type: x mandatory;
}
.strip[hidden] { display: none; }
.shot {
  flex: 0 0 168px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink);
  cursor: pointer;
}
.shot img {
  width: 168px;
  height: 118px;
  object-fit: contain;
  background: #f3eadc;
  border-radius: 8px;
  border: 1px solid transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: zoom-in;
}
.shot.is-on img { box-shadow: inset 0 0 0 2px var(--brass); }
.shot label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.shot input { width: 18px; height: 18px; accent-color: var(--brass-deep); margin: 0; }
.shot b { font-size: 13px; font-weight: 560; text-align: center; line-height: 1.25; }
.shot small { display: block; color: var(--ink-soft); font-size: 12px; font-weight: 340; }

.press {
  position: sticky;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
}
.press-kicker { margin: 0; letter-spacing: 0.16em; text-transform: uppercase; font-size: 11px; color: var(--brass); }
.press-title { margin: 4px 0 0; font-family: var(--serif); font-size: 22px; }
.bar { height: 8px; border-radius: 99px; background: #eadfD2; margin-top: 10px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--brass); transition: width 0.3s ease; }
.press-actions { display: flex; flex-direction: column; gap: 8px; min-width: 180px; align-items: stretch; }
.builds-left { margin: 0; text-align: center; }
footer { margin-top: 22px; color: var(--ink-soft); font-size: 14px; }
.quiet-link { color: var(--brass-deep); }
.sheet-quiet { padding-bottom: 48px; }
.code-list { list-style: none; padding: 0; margin: 16px 0 0; }
.code-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.code-value { font-family: var(--serif); font-size: 28px; letter-spacing: 0.03em; margin: 4px 0 0; }
.table-wrap { overflow-x: auto; }
table.codes { width: 100%; border-collapse: collapse; font-size: 14px; }
table.codes th, table.codes td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-stack { display: grid; gap: 16px; }
.admin-form { display: grid; gap: 10px; }
.quarter-ranges { margin-top: 12px; display: grid; gap: 8px; }
.quarter-row, .listing-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.quarter-row select, .listing-row input[type="text"], .listing-id { width: auto; min-width: 7rem; }
.listing-themes { display: flex; flex-wrap: wrap; gap: 8px 12px; }
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid #d9c8b4;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
}
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

@media (max-width: 860px) {
  .sheet { padding-bottom: 280px; }
  .split { grid-template-columns: 1fr; }
  .press { flex-direction: column; align-items: stretch; }
  .press-title { font-size: 20px; }
  .press-actions { min-width: 0; }
  .mast-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 860px) {
  .sheet-quiet { padding-bottom: 48px; }
}

@media (max-width: 520px) {
  .sheet { padding: 18px 14px 96px; }
  .sheet-quiet { padding-bottom: 40px; }
  .theme { flex-basis: 88px; }
  .hours, .cover-lines { grid-template-columns: 1fr; }
}

body.preview-open { overflow: hidden; }

.preview-lens {
  position: fixed;
  z-index: 40;
  width: min(640px, 48vw);
  height: min(460px, 62vh);
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid #fffaf4;
  box-shadow: 0 18px 46px rgba(36, 22, 14, 0.32);
  background: #f3eadc;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
}
.preview-lens.is-on {
  visibility: visible;
  opacity: 1;
  transform: none;
}
.preview-lens img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(28, 18, 14, 0.86);
  cursor: zoom-out;
}
.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 28px));
  height: min(900px, calc(100vh - 28px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.lightbox-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  pointer-events: none;
}
.lightbox-stage img {
  max-width: 100%;
  max-height: calc(100% - 52px);
  object-fit: contain;
  background: #f3eadc;
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  pointer-events: auto;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
}
.lightbox-stage img.is-zoomed { cursor: grab; }
.lightbox-stage img.is-dragging { cursor: grabbing; }
.lightbox-close,
.lightbox-nav {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #f6f0e6;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.lightbox-close {
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
}
.lightbox-nav {
  top: 50%;
  width: 48px;
  height: 48px;
  font-size: 32px;
  line-height: 1;
  transform: translateY(-50%);
}
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
.lightbox-nav[hidden] { display: none; }
.lightbox-close:hover,
.lightbox-nav:hover { background: #fff; }
.lightbox-caption,
.lightbox-hint {
  position: fixed;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  color: #f6f0e6;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.lightbox-caption {
  bottom: 28px;
  font-family: var(--serif);
  font-size: 18px;
}
.lightbox-hint {
  bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.01em;
  opacity: 0.86;
}

@media (max-width: 860px) {
  .lightbox-nav.prev { left: 8px; }
  .lightbox-nav.next { right: 8px; }
  .lightbox-caption { font-size: 16px; max-width: calc(100vw - 120px); }
}
