:root {
  --ivory: #f6f1e7;
  --paper: #fbf8f3;
  --ink: #141414;
  --muted: #3f3a34;
  --line: #141414;
  --silver: #8d97a3;
  --silver-deep: #5e6872;
  --danger: #7a2e2e;
  --serif: "Bodoni Moda", Didot, "Bodoni MT", "Times New Roman", serif;
  --sans: "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.55;
  background-color: var(--ivory);
  background-image: url("../hay.3ac0e7dc47a1.svg");
  background-repeat: repeat-y;
  background-size: min(100%, 920px) auto;
  background-position: center top;
}

button, input { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

img { max-width: 100%; }

::selection { background: var(--ink); color: var(--ivory); }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--ink);
  color: var(--ivory);
  padding: 8px 12px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.sky {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.masthead {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 0 8px;
}

.masthead-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
}

.masthead-bar:has(.masthead-action:empty) { display: none; }

.kicker, .eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}

.masthead-action {
  margin-left: auto;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: flex-end;
  text-align: right;
}

.brand {
  display: block;
  margin: 18px 0 0;
  text-align: center;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3.4rem, 14vw, 7.2rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
  text-decoration: none;
  /* Bodoni Moda's display optical size drops the H crossbar between pixels.
     A slightly smaller opsz keeps that hairline on a phone; the large wordmark uses opsz 48. */
  font-optical-sizing: none;
  font-variation-settings: "opsz" 32, "wght" 500;
}

@media (min-width: 720px) {
  .brand { font-variation-settings: "opsz" 48, "wght" 500; }
}

.needle {
  display: block;
  width: min(260px, 78%);
  height: 36px;
  margin: 12px auto;
  background: url("../needle.c316601dc33a.svg") center / contain no-repeat;
}

.needle.flip { transform: scaleX(-1); }

.content {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  flex: 1;
  padding-bottom: 48px;
}

.foot {
  margin-top: 48px;
  padding: 8px 16px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink);
}

.foot-name {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 0.9;
  letter-spacing: -0.03em;
}

.foot p { margin: 8px 0 0; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.72rem; }


.hero { padding: 36px 0 8px; text-align: center; }

.hero.tight { padding-bottom: 0; }

.hero .lede, .card .lede { margin-left: auto; margin-right: auto; }

.eyebrow { margin-bottom: 14px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(2.8rem, 9vw, 5.4rem);
  font-style: italic;
  line-height: 0.92;
}

h2 { margin: 0 0 12px; font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.05; }

h3 { margin: 0 0 6px; font-size: 1.55rem; font-style: italic; }

.lede {
  margin: 0 0 22px;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.actions, .inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--ivory);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}

.btn:hover { background: #000; }

.btn.submit {
  background: #1f7a4d;
  border-color: #1f7a4d;
  color: #f4faf6;
}

.btn.submit:hover { background: #18663f; border-color: #18663f; }

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover { background: rgba(20, 20, 20, 0.05); }

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn.danger:hover { background: rgba(122, 46, 46, 0.06); }

.btn:disabled { opacity: 0.45; cursor: progress; }

.stack-btn { width: 100%; }

.upload-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.upload-form .hint { margin: 0; }

.upload-actions {
  margin: 28px 0 8px;
}

.upload-actions .btn { width: 100%; }

.text-link, .button-link {
  background: none;
  border: 0;
  padding: 8px 0;
  min-height: 44px;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.who {
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.card, .steps, .album-block, .danger-zone { margin-top: 36px; }

.card {
  background: transparent;
  border: 0;
  padding: 8px 0 0;
  text-align: center;
}

.card::before,
.album-block::before,
.danger-zone::before,
.pass-top::after {
  content: "";
  display: block;
  width: min(260px, 78%);
  height: 36px;
  margin: 4px auto 18px;
  background: url("../needle.c316601dc33a.svg") center / contain no-repeat;
  transform: scaleX(var(--n1, 1));
}

.stack { display: flex; flex-direction: column; gap: 16px; text-align: left; }

.field-block { display: flex; flex-direction: column; gap: 8px; }

label {
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.optional { font-weight: 400; color: var(--muted); letter-spacing: 0.08em; }

.field {
  width: 100%;
  min-height: 52px;
  border-radius: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  padding: 0 14px;
  font-size: 16px;
  color: var(--ink);
}

.field::placeholder { color: #5c574f; }

.field:focus {
  outline: none;
  border-color: var(--silver-deep);
  box-shadow: inset 0 0 0 1px var(--silver-deep);
}

.hint, .code-line, .empty { color: var(--muted); }

.hint code, .banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.errorlist {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-weight: 600;
}

.flash { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; }

.flash li {
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--silver-deep);
  border-left: 3px solid var(--silver);
}

.flash-error { border-left-color: var(--danger); }

.banner {
  margin: 18px auto 0;
  max-width: 38rem;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--silver-deep);
  border-left: 3px solid var(--silver);
  color: var(--ink);
  text-align: left;
}

.steps {
  position: relative;
  list-style: none;
  margin: 42px 0 0;
  padding: 36px 0 0;
  display: grid;
  gap: 0;
  text-align: left;
}

.steps::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: min(260px, 78%);
  height: 36px;
  transform: translateX(-50%) scaleX(var(--n1, 1));
  background: url("../needle.c316601dc33a.svg") center / contain no-repeat;
}

.steps li {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
  padding: 22px 0 36px;
}

.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(230px, 72%);
  height: 34px;
  transform: translateX(-50%) scaleX(var(--n1, 1));
  background: url("../needle.c316601dc33a.svg") center / contain no-repeat;
}

.steps li > span {
  font-family: var(--serif);
  font-style: italic;
  font-size: 2.4rem;
  line-height: 0.9;
  color: var(--ink);
}

.steps p { margin: 0; color: var(--muted); }

.manage-layout { display: grid; gap: 8px; margin-top: 8px; }

.pass { padding-top: 28px; }

.pass-top, .pass-bottom { padding: 8px 0 0; }

.pass-top { border: 0; padding-bottom: 8px; }

.pass-top::after { margin-top: 18px; margin-bottom: 0; }

.qr {
  width: min(100%, 240px);
  height: auto;
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--ink);
}

.inline-form .field { flex: 1 1 180px; }

.stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 40px 0 28px;
  padding: 8px 0;
}

.stats::before,
.stats::after {
  content: "";
  position: absolute;
  left: 50%;
  width: min(230px, 72%);
  height: 34px;
  transform: translateX(-50%);
  background: url("../needle.c316601dc33a.svg") center / contain no-repeat;
}

.stats::before { top: -36px; transform: translateX(-50%) scaleX(var(--n1, 1)); }
.stats::after { bottom: -36px; transform: translateX(-50%) scaleX(var(--n2, 1)); }

.stats div { padding: 14px 8px; text-align: center; }

.stats dt {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stats dd {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 2rem;
  font-style: italic;
  color: var(--ink);
}

.indexer { margin-top: 18px; display: grid; gap: 12px; justify-items: center; }

.track {
  width: 100%;
  height: 2px;
  background: #ddd4c6;
}

.bar { height: 100%; background: var(--ink); width: 0; }

.file-btn { position: relative; }

.file-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.photo-grid.matches { grid-template-columns: 1fr; }

.pass .inline-form {
  flex-direction: column;
  align-items: stretch;
}

.photo-grid figure, .tile {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #e7e0d4;
  aspect-ratio: 1;
}

.photo-grid img, .tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile { display: block; }

.badge {
  position: absolute;
  left: 0;
  bottom: 0;
  background: var(--ivory);
  color: var(--ink);
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.badge.bad { color: var(--danger); }

.remove {
  position: absolute;
  top: 0;
  right: 0;
  border: 0;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  background: var(--ivory);
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.danger-zone {
  padding-top: 8px;
  text-align: center;
}

.camera { display: grid; gap: 14px; justify-items: center; }

.camera[hidden] { display: none; }

.viewfinder {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #0e0e0e;
  border: 1px solid var(--ink);
}

.viewfinder video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.oval {
  position: absolute;
  inset: 10% 16%;
  border: 1px solid rgba(246, 241, 231, 0.9);
  border-radius: 50%;
  pointer-events: none;
}

.shutter {
  min-width: 84px;
  min-height: 84px;
  padding: 0 18px;
  border: 1px solid var(--silver);
  border-radius: 50%;
  background: var(--ink);
  color: var(--ivory);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.shot-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.shot-strip img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  background: #e7e0d4;
}

.viewer {
  width: 100vw;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0e0e0e;
  color: var(--ivory);
}

.as-typed {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
}

.btn.identity {
  flex-direction: column;
  gap: 3px;
  min-height: 64px;
}

.btn .btn-kicker {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.event-list,
.event-list li { text-align: center; justify-items: center; }

.choice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.choice-list li,
.choice-list form { width: auto; }

.btn.identity { width: auto; }

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}

.event-list li {
  display: grid;
  gap: 4px;
  padding: 18px 0;
  border-bottom: 1px solid var(--silver);
}

.event-list li:last-child { border-bottom: 0; }

.role {
  margin: 0;
  color: var(--silver-deep);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.event-link {
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  line-height: 1;
  text-decoration: none;
}

.event-link:hover { color: var(--silver-deep); }

.selfie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px;
  text-align: left;
}

.selfie-grid figure {
  margin: 0;
  display: grid;
  gap: 8px;
}

.selfie-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e7e0d4;
}

.saved-faces { justify-content: center; }

.piles {
  display: flex;
  flex-wrap: wrap;
  gap: 42px;
  justify-content: center;
  margin-top: 8px;
}

.pile {
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 180px;
  color: var(--ink);
  text-decoration: none;
}

.pile-fan {
  position: relative;
  width: 168px;
  height: 156px;
}

.pile-fan img {
  position: absolute;
  width: 112px;
  height: 136px;
  object-fit: cover;
  background: #e7e0d4;
  border: 1px solid var(--ink);
  left: 28px;
  top: 10px;
}

.pile-fan img:nth-child(1) { transform: rotate(-8deg) translate(-18px, 6px); }
.pile-fan img:nth-child(2) { transform: none; z-index: 1; }
.pile-fan img:nth-child(3) { transform: rotate(8deg) translate(18px, 6px); z-index: 2; }
.pile-fan img:only-child { transform: none; left: 28px; top: 10px; }

.pile-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.7rem;
  line-height: 1;
}

.pile-count {
  color: var(--silver-deep);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.viewer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0e0e0e;
}

.viewer-count, .viewer-close, .viewer-nav { position: absolute; z-index: 2; }

.viewer-count {
  top: calc(14px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.viewer-close {
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  min-height: 44px;
  border: 1px solid var(--ivory);
  padding: 0 14px;
  background: transparent;
  color: var(--ivory);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.viewer-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 72px;
  border: 0;
  background: transparent;
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 2.4rem;
}

.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }

:focus-visible {
  outline: 2px solid var(--silver-deep);
  outline-offset: 3px;
}

@media (max-width: 560px) {
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form .btn, .actions .btn { width: 100%; }
}

@media (min-width: 640px) {
  .photo-grid.matches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 800px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-grid.matches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manage-layout { grid-template-columns: minmax(280px, 360px) 1fr; gap: 48px; align-items: start; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li {
    grid-template-columns: 1fr;
    padding: 8px 28px 0 0;
  }
  .steps li:last-child { padding-right: 0; }
  .steps li:not(:last-child)::after {
    left: auto;
    right: -8px;
    bottom: auto;
    top: 18px;
    width: 22px;
    height: 120px;
    transform: scaleX(var(--n1, 1));
    background-image: url("../needle-vertical.e25fd3b54d67.svg");
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}

@media print {
  body, .sky { background: white; }
  .no-print, .foot, .album-block, .danger-zone { display: none !important; }
  .card { box-shadow: none; }
}
