:root {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #20242c;
  background: #f7f8fa;
  font-size: 16px;
  --wine: #722b39;
  --line: #d9dce2;
  --muted: #5b6471;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--wine);
}
button,
input,
select {
  font: inherit;
}
button,
.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: #20242c;
  padding: 0.65rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  gap: 0.4rem;
}
button:hover,
.button:hover {
  border-color: var(--wine);
  background: #f6eff1;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary {
  background: var(--wine);
  border-color: var(--wine);
  color: white;
}
.primary:hover {
  background: #55212c;
  color: white;
}
.danger {
  color: #a12028;
}
input,
select {
  min-height: 46px;
  padding: 0.7rem 0.8rem;
  border: 1px solid #abb2bd;
  border-radius: 5px;
  background: white;
  max-width: 100%;
  color: inherit;
}
input[type="checkbox"] {
  min-height: 20px;
  width: 20px;
  accent-color: var(--wine);
}
label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem max(5vw, 20px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  font-weight: bold;
  color: #292a2e;
}
.brand small {
  display: block;
  font-family: system-ui, sans-serif;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.3rem;
}
.mark {
  background: var(--wine);
  color: white;
  padding: 0.6rem;
  border-radius: 5px;
  font-size: 1.5rem;
}
nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
nav a {
  font-size: 0.9rem;
  color: #444c58;
  text-underline-offset: 5px;
}
main {
  max-width: 1400px;
  padding: 2.7rem max(5vw, 20px) 4rem;
  margin: auto;
  min-height: 70vh;
}
h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 4vw, 3.1rem);
  margin: 0.6rem 0 1rem;
  line-height: 1.15;
}
h2 {
  font-size: 1.3rem;
}
p {
  line-height: 1.6;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wine);
  font-weight: 650;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}
.toolbar label:first-child {
  flex: 1;
  min-width: 220px;
}
.toolbar select {
  min-width: 150px;
}
.summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
}
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover {
  border-color: var(--wine);
}
.card img,
.cover-empty {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: #e7e9ef;
}
.cover-empty {
  display: grid;
  place-items: center;
  color: #666e7c;
  font-size: 0.9rem;
}
.card-body {
  padding: 1rem;
}
.card h2 {
  margin: 0.4rem 0;
  font-family: Georgia, serif;
  font-size: 1.45rem;
  font-weight: 400;
}
.card p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.tag {
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
}
.empty {
  text-align: center;
  padding: 4rem 1.5rem;
  border: 1px dashed #b8bfca;
  border-radius: 6px;
  margin: 1rem 0;
  background: white;
}
.empty h2 {
  font-family: Georgia, serif;
  font-size: 1.8rem;
  font-weight: 400;
}
.empty p {
  max-width: 500px;
  margin: 1rem auto;
  color: var(--muted);
}
.back {
  display: inline-block;
  margin-bottom: 1rem;
  text-underline-offset: 4px;
}
.photos {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.photo-button {
  border: 0;
  padding: 0;
  display: block;
  min-height: 0;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: #e3e6eb;
}
.photo-button img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}
.admin-form {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  margin: 1.5rem 0;
}
.fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1rem;
}
.actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.check {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
}
.drop {
  border: 2px dashed #a7aebb;
  background: #fff;
  padding: 2rem;
  text-align: center;
  border-radius: 6px;
  margin: 1.5rem 0;
}
.drop.drag {
  border-color: var(--wine);
  background: #f6eff1;
}
.drop input {
  border: 0;
  font-size: 0.9rem;
  max-width: 100%;
  padding: 0.6rem;
}
.photo-tools {
  background: white;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 5px 5px;
}
.photo-tools p {
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  margin: 0 0 0.5rem;
}
.photo-tools .actions {
  margin: 0.4rem 0;
  gap: 0.4rem;
}
.photo-tools button {
  padding: 0.45rem 0.55rem;
  font-size: 0.8rem;
  flex: 1;
}
.photo-tools .filename {
  min-height: 2.5em;
}
.local {
  background: #e9edf6;
  color: #364969;
  padding: 0.7rem 1rem;
  border-radius: 5px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.help {
  max-width: 780px;
}
.help h2 {
  margin-top: 2rem;
}
.help li {
  margin: 0.8rem 0;
  line-height: 1.6;
}
.error {
  padding: 1rem;
  border-left: 4px solid #a12028;
  background: #fff0f0;
}
progress {
  width: 100%;
  height: 20px;
  accent-color: var(--wine);
}
footer {
  border-top: 1px solid var(--line);
  padding: 1.6rem max(5vw, 20px);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.skip {
  position: absolute;
  top: -100px;
  background: white;
  padding: 1rem;
}
.skip:focus {
  top: 0;
  z-index: 10;
}
:focus-visible {
  outline: 3px solid #1876c6;
  outline-offset: 3px;
}
#notice {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #20242c;
  color: white;
  border-radius: 6px;
  max-width: 90vw;
  padding: 1rem 1.5rem;
  z-index: 20;
  display: none;
}
#notice.show {
  display: block;
}
dialog#viewer {
  border: 0;
  padding: 0;
  background: #111317;
  color: white;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
}
dialog::backdrop {
  background: #111317;
}
#viewer figure {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 4rem 4rem 3rem;
  gap: 1rem;
}
#full-photo {
  max-width: 100%;
  max-height: calc(100dvh - 10rem);
  object-fit: contain;
}
#caption {
  text-align: center;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
#viewer button {
  position: absolute;
  background: #252930;
  color: white;
  border-color: #606875;
  font-size: 2rem;
  width: 48px;
  height: 48px;
  padding: 0;
}
#viewer .close {
  right: 1rem;
  top: 1rem;
}
#viewer .prev {
  left: 0.7rem;
  top: 48%;
}
#viewer .next {
  right: 0.7rem;
  top: 48%;
}
.viewer-error {
  color: #fbb;
}
body:has(dialog[open]) {
  overflow: hidden;
}
@media (max-width: 650px) {
  header {
    padding: 1rem;
    gap: 1rem;
    align-items: flex-start;
  }
  .brand {
    font-size: 1rem;
  }
  .mark {
    font-size: 1.2rem;
  }
  nav {
    flex-direction: column;
    gap: 0.7rem;
    align-items: flex-end;
  }
  nav a {
    font-size: 0.8rem;
  }
  main {
    padding: 1.7rem 1rem 3rem;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .card-body {
    padding: 0.75rem;
  }
  .card h2 {
    font-size: 1.2rem;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .photos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .photo-button img {
    height: 160px;
  }
  .photo-tools .actions {
    flex-wrap: wrap;
  }
  .photo-tools button {
    flex-basis: 40%;
  }
  .admin-form {
    padding: 1rem;
  }
  .toolbar {
    gap: 0.7rem;
  }
  .toolbar label:first-child {
    min-width: 100%;
  }
  footer {
    flex-direction: column;
  }
  #viewer figure {
    padding: 4rem 0 5rem;
  }
  #full-photo {
    max-height: calc(100dvh - 10rem);
  }
  #viewer .prev,
  #viewer .next {
    top: auto;
    bottom: 0.7rem;
  }
  .drop {
    padding: 1.2rem 0.7rem;
  }
}

/* Keep covers and scanned documents complete. */
.card img, .cover-empty { aspect-ratio: 1; object-fit: contain; padding: 0.65rem; background: #e9e5de; }
.photo-button img { object-fit: contain; padding: 0.3rem; }
.album-description { max-width: 720px; white-space: pre-line; color: var(--muted); }
.description-field { margin-top: 1rem; }
textarea { font: inherit; padding: 0.8rem; border: 1px solid #abb2bd; border-radius: 5px; resize: vertical; width: 100%; }
.arrange-hint { color: var(--muted); font-size: 0.9rem; margin: 1.4rem 0; }
.album-downloads { margin: 1.4rem 0; }
.album-downloads .download-help { font-size: 0.9rem; }
#download-selection:not([hidden]) { padding: 1rem; border: 1px solid var(--muted); border-radius: 0.5rem; }
.button[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.photo-button.download-selectable { position: relative; }
.download-check { position: absolute; top: 0.65rem; right: 0.65rem; display: grid; place-items: center; width: 2rem; height: 2rem; border: 2px solid white; border-radius: 0.3rem; color: transparent; background: #222; }
.download-chosen .download-check { background: #8b2e44; color: white; }
.photo-button.download-chosen { outline: 4px solid #d6a294; outline-offset: -4px; }
.arrange-handle { cursor: grab; width: 100%; margin-bottom: 0.5rem; }
.arrange-handle:active { cursor: grabbing; }
.reorder-target { outline: 3px solid var(--wine); outline-offset: 3px; }
#image-stage { width: 100%; min-height: 0; flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; }
#full-photo { max-width: 100%; max-height: 100%; object-fit: contain; }
#viewer.zoomed #image-stage { display: block; }
#viewer.zoomed #full-photo { max-width: none; max-height: none; width: auto; height: auto; min-width: 150%; }
#viewer .viewer-actions { position: absolute; top: 1rem; left: 1rem; right: 5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; }
#viewer .viewer-actions button { position: static; font-size: 0.95rem; width: auto; padding: 0.5rem 1rem; }
#viewer .viewer-actions a { color: #f1ece4; font-size: 0.85rem; text-underline-offset: 4px; }
#viewer figure { padding-top: 5rem; }
.public-gallery { background: #171819; color: #f4f1eb; --muted: #b9b6b0; --line: #3a3a3a; --wine: #e5b6a6; }
.public-gallery header { background: #171819; }
.public-gallery .brand, .public-gallery nav a { color: #f4f1eb; }
.public-gallery .mark { background: #823c48; }
.public-gallery .card { background: transparent; border-color: transparent; }
.public-gallery .card:hover { border-color: #8c8277; background: #242526; }
.public-gallery .card img { background: #292a2a; border-radius: 8px; }
.public-gallery .card-body { padding: 0.9rem 0.35rem; }
.public-gallery .card h2 { font-family: inherit; font-size: 1.15rem; font-weight: 550; line-height: 1.4; }
.public-gallery button, .public-gallery .button, .public-gallery input, .public-gallery select { color: #f4f1eb; background: #242526; }
.public-gallery .photo-button { background: #282929; }
.public-gallery .empty { background: #242526; }
.public-gallery .error { background: #49282e; }
.public-gallery .skip { color: #161616; }
@media (max-width: 650px) {
  .card img { padding: 0.3rem; }
  .public-gallery .card h2 { font-size: 1rem; }
  .summary { font-size: 0.8rem; }
  #viewer figure { padding-top: 8rem; }
}
#viewer .viewer-actions a { display: inline-flex; align-items: center; min-height: 44px; font-size: 1rem; }
#viewer.zoomed #image-stage { cursor: grab; touch-action: none; user-select: none; }
#viewer.zoomed #image-stage.panning { cursor: grabbing; }
#pan-help { color: #ddd; font-size: 0.9rem; text-align: center; }
.position-label { flex-direction: row; align-items: center; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.6rem; }
.position-label select { min-width: 72px; }
#photos { scroll-margin-top: 1rem; }
.public-gallery a.primary { background: #823c48; color: white; border-color: #aa6975; }

/* A contact sheet keeps large albums visual, with one shared set of controls. */
.upload-drawer { border: 1px solid var(--line); border-radius: 8px; background: white; }
.upload-drawer > summary { cursor: pointer; padding: 1rem; font-weight: 650; }
.upload-drawer .drop { margin: 0; border: 0; }
.arranger { display: block; }
.arrange-bar { position: sticky; top: 0; z-index: 10; background: #f7f8fa; padding: 0.8rem 0; border-bottom: 1px solid #bcc1c9; box-shadow: 0 6px 12px #20242c12; }
.arrange-bar-top, .arrange-controls { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.arrange-bar-top { margin-bottom: 0.5rem; display: grid; grid-template-columns: 1fr auto auto; }
.arrange-bar-top #arrange-save { grid-row: 2; grid-column: 1 / -1; min-height: 1.4em; }
.arrange-bar-top strong { font-size: 1.15rem; margin-right: auto; }
#arrange-save { font-size: 0.9rem; max-width: 35rem; }
.arrange-bar p { font-size: 0.85rem; color: var(--muted); margin: 0.6rem 0 0; }
.arrange-controls button { font-size: 0.9rem; padding: 0.5rem 0.65rem; }
.arrange-controls label { flex-direction: row; align-items: center; font-weight: 500; font-size: 0.85rem; }
.arrange-controls select { padding: 0.4rem; min-height: 44px; }
#carry-photos { width: 255px; max-width: 100%; min-height: 50px; border: 2px solid var(--wine); background: #f2e5e8; color: #55212c; cursor: grab; touch-action: none; }
#carry-photos:disabled { border-color: var(--line); cursor: default; }
#carry-preview { display: flex; }
#carry-preview:empty { display: none; }
#carry-preview img { width: 30px; height: 30px; object-fit: contain; background: white; border: 1px solid #c8a5ac; border-radius: 3px; }
#carry-preview img + img { margin-left: -8px; }
.selected-more { position: relative; }
.selected-more summary { cursor: pointer; padding: 0.6rem; min-height: 44px; }
.selected-more[open] { background: white; border: 1px solid var(--line); padding: 0.3rem; }
.arrange-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 14px; padding: 1.2rem 4px; }
.arrange-grid.size-small { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); gap: 12px; }
.arrange-grid.size-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.arrange-tile { position: relative; display: block; aspect-ratio: 1; min-width: 0; width: 100%; padding: 5px; border: 2px solid #c7cbd2; border-radius: 6px; background: #e8e7e4; cursor: grab; user-select: none; scroll-margin-top: 210px; }
.arrange-tile img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.arrange-tile:hover { background: #e8e7e4; border-color: var(--wine); }
.arrange-tile.selected { border-color: #8b2e44; box-shadow: 0 0 0 2px #8b2e44; background: #ead3d8; }
.tile-number, .tile-cover, .tile-check { position: absolute; font-size: 0.75rem; border-radius: 3px; padding: 2px 5px; line-height: 1.4; background: #ffffffeb; color: #29242a; }
.tile-number { bottom: 3px; left: 3px; }
.tile-cover { bottom: 3px; right: 3px; background: #55212c; color: white; }
.tile-check { top: 4px; right: 4px; visibility: hidden; background: #8b2e44; color: white; }
.selected .tile-check { visibility: visible; }
.arrange-tile.insert-before::before, .arrange-tile.insert-after::after { content: ''; position: absolute; top: -4px; bottom: -4px; width: 5px; border-radius: 3px; background: #ad2447; z-index: 2; }
.arrange-tile.insert-before::before { left: -11px; }
.arrange-tile.insert-after::after { right: -11px; }
.is-dragging .selected { opacity: 0.55; }
.placing .arrange-tile { cursor: crosshair; }
.album-end { width: 100%; border-style: dashed; margin: 0 0 1rem; color: var(--muted); }
.album-end.insert-end { border: 3px solid #ad2447; background: #f2e5e8; }
@media (max-width: 650px) {
  .arrange-bar-top strong { font-size: 1rem; }
  .arrange-controls { gap: 0.4rem; }
  .arrange-controls label { font-size: 0; }
  .arrange-controls label select { font-size: 0.85rem; }
  .arrange-bar p { font-size: 0.78rem; }
  .arrange-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .arrange-grid.size-large { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* Crop only the gallery cover view; album photos and downloads remain complete. */
.cover-framed { position: relative; aspect-ratio: 1; background: #e9e5de; }
.cover-window { position: absolute; width: calc((100% - 1.3rem) * var(--frame-ratio)); height: calc(100% - 1.3rem); top: 0.65rem; left: 50%; transform: translateX(-50%); overflow: hidden; }
.card .cover-window img { position: absolute; width: var(--poster-width); height: var(--poster-height); left: var(--poster-left); top: var(--poster-top); max-width: none; aspect-ratio: auto; object-fit: fill; padding: 0; }
.public-gallery .cover-framed { background: #292a2a; border-radius: 8px; }
.card .cover-window img { border-radius: 0; }
@media (max-width: 600px) { .cover-window { top: 0.3rem; width: calc((100% - 0.6rem) * var(--frame-ratio)); height: calc(100% - 0.6rem); } }
.cover-frame-f651a720-2a08-4bc6-b081-3a925eb48776 { --frame-ratio: 0.9239543726235742; --poster-width: 209.87654320987653%; --poster-height: 125.47528517110267%; --poster-left: -3.7037037037037033%; --poster-top: -13.307984790874524%; }
.cover-frame-a112cd8b-ef42-4243-ab6d-a7855dbd011b { --frame-ratio: 0.8538461538461538; --poster-width: 229.72972972972974%; --poster-height: 126.92307692307692%; --poster-left: -122.97297297297298%; --poster-top: -13.461538461538462%; }
