:root {
  color-scheme: dark;
  --ink: #06151c;
  --ink-soft: #0b222c;
  --paper: #f0ede5;
  --paper-muted: #a9b1b2;
  --heather: #9f4d5c;
  --success: #b7d7c2;
  --error: #f3b3b9;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.holding-page,
.reveal-page {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 6rem);
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 43%, rgb(18 52 65 / 46%) 0%, transparent 42%),
    linear-gradient(145deg, var(--ink-soft) 0%, var(--ink) 55%, #041016 100%);
}

.holding-page::before,
.reveal-page::before,
.upload-page::before,
.control-page::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgb(240 237 229 / 2.2%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(240 237 229 / 1.6%) 1px, transparent 1px);
  background-size: 5rem 5rem;
  content: "";
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.holding-card {
  width: min(100%, 46rem);
  text-align: center;
}

h1,
h2,
p { text-wrap: balance; }

.site-title,
.reveal-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
  font-size: clamp(3rem, 11vw, 7.6rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.92;
}

h1 span,
.wordmark span { color: var(--heather); }

.rule {
  position: relative;
  width: min(13rem, 45vw);
  height: 1px;
  margin: clamp(2rem, 5vw, 3.25rem) auto 0;
  background: linear-gradient(90deg, transparent, rgb(240 237 229 / 42%), transparent);
}

.rule i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.42rem;
  height: 0.42rem;
  background: var(--heather);
  box-shadow: 0 0 0 0.35rem var(--ink-soft);
  transform: translate(-50%, -50%) rotate(45deg);
}

.corner-mark {
  position: absolute;
  width: clamp(2.5rem, 6vw, 4.5rem);
  height: clamp(2.5rem, 6vw, 4.5rem);
  opacity: 0.42;
}

.corner-mark--top {
  top: clamp(1.25rem, 4vw, 3rem);
  left: clamp(1.25rem, 4vw, 3rem);
  border-top: 1px solid var(--paper-muted);
  border-left: 1px solid var(--paper-muted);
}

.corner-mark--bottom {
  right: clamp(1.25rem, 4vw, 3rem);
  bottom: clamp(1.25rem, 4vw, 3rem);
  border-right: 1px solid var(--heather);
  border-bottom: 1px solid var(--heather);
}

.reveal-page { padding: clamp(1rem, 4vw, 3.5rem); }

.reveal-card {
  display: grid;
  width: min(100%, 74rem);
  min-height: min(78svh, 48rem);
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
  overflow: hidden;
  border: 1px solid rgb(240 237 229 / 18%);
  background: rgb(6 21 28 / 72%);
  box-shadow: 0 2rem 8rem rgb(0 0 0 / 35%);
}

.reveal-photo { min-height: 25rem; margin: 0; background: var(--ink); }
.reveal-photo img { width: 100%; height: 100%; object-fit: contain; background: var(--ink); }

.reveal-copy {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: clamp(2.5rem, 6vw, 6rem) clamp(1.5rem, 5vw, 4rem);
  text-align: center;
}

.reveal-copy:only-child { grid-column: 1 / -1; }
.reveal-copy h1 { font-size: clamp(3.4rem, 8vw, 6.8rem); }

.eyebrow {
  margin: 0 0 1.5rem;
  color: var(--heather);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  margin-top: 2.25rem;
  padding: 0.8rem 1.35rem;
  border: 1px solid var(--heather);
  border-radius: 0;
  background: var(--heather);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: #b35a6b; }
.button:disabled { border-color: rgb(159 77 92 / 45%); background: rgb(159 77 92 / 45%); cursor: wait; }
.button:focus-visible, input:focus-visible, .sign-out-link:focus-visible { outline: 3px solid var(--paper); outline-offset: 3px; }
.button--secondary { border-color: rgb(240 237 229 / 45%); background: transparent; }
.button--secondary:hover { background: rgb(240 237 229 / 9%); }

.upload-page,
.control-page {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(1.25rem, 5vw, 4rem);
  isolation: isolate;
  background: linear-gradient(145deg, var(--ink-soft), var(--ink) 58%, #041016);
}

.login-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(1.25rem, 5vw, 4rem);
  background: linear-gradient(145deg, var(--ink-soft), var(--ink) 58%, #041016);
}

.login-card {
  width: min(100%, 32rem);
  padding: clamp(1.5rem, 6vw, 3.5rem);
  border: 1px solid rgb(240 237 229 / 18%);
  background: rgb(6 21 28 / 90%);
  box-shadow: 0 1.5rem 6rem rgb(0 0 0 / 28%);
}

.login-card h1 { margin: 0; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia, serif; font-size: clamp(2.6rem, 10vw, 4.5rem); font-weight: 400; letter-spacing: -0.045em; line-height: 0.98; }
.login-card .button { margin-top: 1rem; }
.sign-out-link { color: var(--paper-muted); font-size: 0.9rem; font-weight: 700; }

.gallery-page {
  min-height: 100svh;
  padding: clamp(1.25rem, 5vw, 4rem);
  background: linear-gradient(145deg, var(--ink-soft), var(--ink) 58%, #041016);
}

.gallery-shell { width: min(100%, 78rem); margin: 0 auto; }
.gallery-header { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.gallery-header h1, .confirm-card h1 { margin: 0; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia, serif; font-size: clamp(2.8rem, 8vw, 5.8rem); font-weight: 400; letter-spacing: -0.045em; line-height: 0.96; }
.gallery-heading .intro { margin-bottom: 0; }
.gallery-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 1.25rem; }
.gallery-download-all { flex: 0 0 auto; margin: 0; }
.gallery-view-toggle { display: inline-flex; margin: 0 0 1.5rem; border: 1px solid rgb(240 237 229 / 28%); }
.gallery-view-toggle__button { min-height: 2.8rem; padding: 0.65rem 1rem; border: 0; background: transparent; color: var(--paper-muted); font: inherit; font-weight: 700; cursor: pointer; }
.gallery-view-toggle__button + .gallery-view-toggle__button { border-left: 1px solid rgb(240 237 229 / 28%); }
.gallery-view-toggle__button--active { background: var(--paper); color: var(--ink); }
.gallery-view-toggle__button:focus-visible { position: relative; outline: 3px solid var(--paper); outline-offset: 3px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1.25rem; }
.gallery-grid[hidden], .gallery-browser[hidden] { display: none; }
.photo-card { overflow: hidden; border: 1px solid rgb(240 237 229 / 18%); background: rgb(6 21 28 / 86%); }
.photo-preview { position: relative; display: grid; width: 100%; height: 18rem; padding: 0; border: 0; border-radius: 0; place-items: center; overflow: hidden; background: var(--ink-soft); color: inherit; cursor: pointer; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; transition: transform 220ms ease; }
.photo-preview:hover img { transform: scale(1.025); }
.photo-preview:focus-visible { outline: 3px solid var(--paper); outline-offset: -5px; }
.photo-preview__label { position: absolute; right: 0.75rem; bottom: 0.75rem; padding: 0.45rem 0.65rem; background: rgb(6 21 28 / 88%); box-shadow: 0 0.25rem 1rem rgb(0 0 0 / 30%); color: var(--paper); font-size: 0.78rem; font-weight: 700; }
.photo-details { padding: 1rem; }
.photo-name { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.photo-meta { margin: 0.45rem 0 1rem; color: var(--paper-muted); font-size: 0.85rem; }
.photo-actions { display: flex; gap: 1rem; }
.photo-actions a { color: var(--paper); font-size: 0.9rem; font-weight: 700; }
.photo-actions .danger-link { color: var(--error); }
.gallery-browser { border: 1px solid rgb(240 237 229 / 18%); background: rgb(3 12 17 / 82%); scroll-margin-top: 1rem; }
.gallery-browser__header { padding: 1rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid rgb(240 237 229 / 14%); }
.gallery-browser__header h2 { max-width: 100%; margin: 0.2rem 0 0; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.gallery-browser__counter { margin: 0; color: var(--paper-muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.gallery-browser__stage { display: grid; min-height: min(60rem, 70svh); grid-template-columns: clamp(3rem, 7vw, 5rem) minmax(0, 1fr) clamp(3rem, 7vw, 5rem); align-items: center; }
.gallery-browser--single .gallery-browser__stage { grid-template-columns: minmax(0, 1fr); padding-inline: clamp(1rem, 7vw, 5rem); }
.gallery-browser__stage figure { display: grid; min-width: 0; height: 100%; max-height: 70svh; grid-template-rows: minmax(0, 1fr) auto; margin: 0; place-items: center; }
.gallery-browser__stage img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery-browser__stage figcaption { display: flex; width: 100%; justify-content: center; gap: 0.65rem; padding: 0.75rem 1rem 0; color: var(--paper-muted); font-size: 0.82rem; text-align: center; }
.gallery-browser__stage figcaption span + span::before { margin-right: 0.65rem; content: "·"; }
.gallery-browser__previous,
.gallery-browser__next { align-self: stretch; padding: 0; border: 0; background: transparent; color: var(--paper); cursor: pointer; }
.gallery-browser__previous span,
.gallery-browser__next span { font-family: Georgia, serif; font-size: clamp(3rem, 8vw, 5rem); font-weight: 300; line-height: 1; }
.gallery-browser__previous:hover,
.gallery-browser__next:hover { background: rgb(240 237 229 / 5%); }
.gallery-browser button:focus-visible,
.gallery-browser a:focus-visible { outline: 3px solid var(--paper); outline-offset: -3px; }
.gallery-browser__footer { display: flex; justify-content: center; padding: 0.75rem 1rem 1rem; }
.gallery-browser__footer .button { min-height: 2.75rem; margin: 0; padding: 0.55rem 1rem; }
.gallery-empty { padding: clamp(2rem, 7vw, 5rem); border: 1px solid rgb(240 237 229 / 18%); text-align: center; }
.gallery-empty h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 400; }
.gallery-empty p { color: var(--paper-muted); }
.gallery-page--confirm { display: grid; place-items: center; }
.confirm-card { width: min(100%, 38rem); padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid rgb(240 237 229 / 18%); background: rgb(6 21 28 / 90%); }
.confirm-card h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); }
.delete-preview { width: 100%; max-height: 24rem; margin: 1.5rem 0 1rem; object-fit: contain; background: var(--ink-soft); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.confirm-actions .button, .confirm-actions form { margin: 0; }
.button--danger { border-color: #b2404f; background: #b2404f; }
.button--danger:hover { background: #c94b5b; }

.upload-card,
.control-card {
  width: min(100%, 38rem);
  padding: clamp(1.5rem, 5vw, 3.5rem);
  border: 1px solid rgb(240 237 229 / 18%);
  background: rgb(6 21 28 / 86%);
  box-shadow: 0 1.5rem 6rem rgb(0 0 0 / 28%);
}

.upload-card h1,
.control-card h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Baskerville, Georgia, serif;
  font-size: clamp(2.7rem, 10vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.intro { max-width: 33rem; margin: 1.25rem 0 2rem; color: var(--paper-muted); font-size: 1.05rem; line-height: 1.6; }

form { display: grid; gap: 0.75rem; }
label { margin-top: 0.75rem; font-size: 0.95rem; font-weight: 700; }
input[type="text"], input[type="password"], input[type="file"] {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem;
  border: 1px solid rgb(240 237 229 / 35%);
  border-radius: 0;
  background: rgb(255 255 255 / 5%);
  color: var(--paper);
  font: inherit;
}
input[type="file"]::file-selector-button { margin-right: 0.75rem; padding: 0.5rem 0.7rem; border: 0; background: var(--paper); color: var(--ink); font-weight: 700; }
.optional, .help-text { color: var(--paper-muted); font-size: 0.9rem; font-weight: 400; line-height: 1.5; }
.help-text { margin: 0; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.selection-confirmation { margin: 0 0 1rem; padding: 0.8rem 1rem; border-left: 3px solid var(--success); background: rgb(183 215 194 / 10%); color: var(--success); line-height: 1.5; opacity: 0; transform: translateY(-0.25rem); transition: opacity 180ms ease, transform 180ms ease; }
.selection-confirmation[hidden] { display: none; }
.selection-confirmation--visible { opacity: 1; transform: translateY(0); }
.selection-confirmation--error { border-color: var(--error); background: rgb(243 179 185 / 10%); color: var(--error); }
.selected-photos { margin: 0 0 2rem; padding: 1rem; border: 1px solid rgb(240 237 229 / 18%); background: rgb(255 255 255 / 3%); }
.selected-photos[hidden] { display: none; }
.selected-photos__heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.selected-photos__heading h2 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 400; }
.selected-photos__heading span { color: var(--paper-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.selected-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.8rem; }
.selected-photo-card { overflow: hidden; border: 1px solid rgb(240 237 229 / 16%); background: var(--ink); }
.selected-photo-card__preview { display: grid; aspect-ratio: 1; place-items: center; overflow: hidden; background: var(--ink-soft); }
.selected-photo-card__preview img { width: 100%; height: 100%; object-fit: cover; }
.selected-photo-card__preview span { color: var(--paper-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.selected-photo-card__details { display: grid; gap: 0.35rem; padding: 0.65rem; }
.selected-photo-card__name { margin: 0; overflow: hidden; font-size: 0.8rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.selected-photo-card__size { margin: 0; color: var(--paper-muted); font-size: 0.75rem; }
.selected-photo-card progress { width: 100%; height: 0.45rem; border: 0; border-radius: 0; accent-color: var(--heather); }
.selected-photo-card progress::-webkit-progress-bar { background: rgb(240 237 229 / 12%); }
.selected-photo-card progress::-webkit-progress-value { background: var(--heather); }
.selected-photo-card progress::-moz-progress-bar { background: var(--heather); }
.selected-photo-card__status { min-height: 2.4em; margin: 0; color: var(--paper-muted); font-size: 0.75rem; line-height: 1.2; }
.selected-photo-card--saved .selected-photo-card__status { color: var(--success); }
.selected-photo-card--failed .selected-photo-card__status { color: var(--error); }
.selected-photo-card__retry { justify-self: start; padding: 0; border: 0; background: transparent; color: var(--paper); font: inherit; font-size: 0.75rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.add-photo-control { display: grid; margin: 0 0 2rem; }
.add-photo-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%); }
.add-photo-button { justify-self: start; margin: 0 0 0.75rem; }
.add-photo-input:focus-visible + .add-photo-button { outline: 3px solid var(--paper); outline-offset: 3px; }
.add-photo-control:has(.add-photo-input:disabled) .add-photo-button { border-color: rgb(159 77 92 / 45%); background: rgb(159 77 92 / 45%); cursor: not-allowed; }
.upload-status { margin: 0.35rem 0 0; color: var(--paper-muted); font-size: 0.9rem; line-height: 1.5; }

.notice { margin: 1.5rem 0; padding: 0.9rem 1rem; border-left: 3px solid currentColor; line-height: 1.5; }
.notice--success { background: rgb(183 215 194 / 10%); color: var(--success); }
.notice--error { background: rgb(243 179 185 / 10%); color: var(--error); }

.wordmark { margin: 0 0 0.75rem; color: var(--paper-muted); font-family: Georgia, serif; font-size: 1.1rem; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2rem 0; padding: 1rem 0; border-block: 1px solid rgb(240 237 229 / 15%); }
.status-pill { padding: 0.4rem 0.65rem; background: rgb(240 237 229 / 10%); font-size: 0.85rem; }
.status-pill--live { background: var(--heather); color: #fff; }
.control-section { padding-top: 1rem; }
.control-section + .control-section { margin-top: 2rem; border-top: 1px solid rgb(240 237 229 / 15%); }
.control-section h2 { margin: 0 0 0.6rem; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 400; }
.admin-preview { width: 100%; max-height: 22rem; margin: 0.75rem 0; object-fit: cover; }

@media (prefers-reduced-motion: no-preference) {
  .holding-card,
  .reveal-card,
  .upload-card,
  .control-card { animation: settle 900ms cubic-bezier(0.22, 1, 0.36, 1) both; }

  @keyframes settle {
    from { opacity: 0; transform: translateY(0.65rem); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (max-width: 46rem) {
  .reveal-card { grid-template-columns: 1fr; }
  .reveal-photo { min-height: 0; max-height: none; }
  .reveal-photo img { display: block; height: auto; }
  .reveal-copy { min-height: 44svh; }
  .gallery-header { align-items: stretch; flex-direction: column; }
  .gallery-header-actions { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .gallery-download-all { align-self: flex-start; }
  .gallery-browser__stage { min-height: 60svh; grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; }
  .gallery-browser__stage figure { max-height: 60svh; }
  .gallery-browser__stage figcaption { align-items: center; flex-direction: column; gap: 0.2rem; }
  .gallery-browser__stage figcaption span + span::before { content: none; }
}

@media (max-width: 30rem) {
  .site-title { letter-spacing: -0.04em; }
  .status-row { align-items: flex-start; flex-direction: column; }
}
