:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #7a7a7a;
  --line: #dedede;
  --surface: #ffffff;
  --wash: #f2f2f0;
  --dark: #080808;
  --accent: #ff681f;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 150px;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(360px, 760px) minmax(240px, 0.8fr);
  gap: 22px;
  align-items: center;
  min-height: 66px;
  padding: 10px 18px;
  color: #fff;
  background: rgba(8, 8, 8, 0.96);
  border-bottom: 1px solid #272727;
}

.brand h1 {
  position: relative;
  margin: 0;
  padding-left: 44px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 2px;
  text-transform: none;
}

.brand h1::before {
  content: "H";
  position: absolute;
  left: 0;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  font-weight: 800;
  letter-spacing: 0;
}

.brand p {
  display: block;
  margin: 5px 0 0;
  color: #bfbfbf;
  font-size: 13px;
}

.search {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 112px;
  gap: 20px;
  justify-self: center;
  width: min(760px, 100%);
}

.search input {
  width: 100%;
  height: 42px;
  border: 1px solid #4a4a4a;
  border-radius: 0;
  padding: 0 15px;
  color: #fff;
  background: #141414;
}

.search input::placeholder {
  color: #b9b9b9;
}

.search button,
.top-actions button,
.top-actions .nav-link,
.filter-head button,
.chips button,
.year-marker,
.close {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.search button,
.top-actions button,
.top-actions .nav-link {
  display: grid;
  place-items: center;
  height: 42px;
  padding: 0 14px;
  color: #111;
  border-color: #555;
  background: #fff;
  text-decoration: none;
}

.search button {
  min-width: 112px;
  margin-left: 4px;
}

.top-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

#decadeToggle {
  display: none;
}

.top-actions button.active,
.top-actions button:hover,
.top-actions .nav-link:hover,
.search button:hover {
  color: #f33a2d;
  background: #fff;
}

.app {
  min-height: calc(100vh - 70px);
}

.site-footer {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 30;
  width: max-content;
  max-width: calc(100vw - 28px);
  margin: 0;
  padding: 7px 12px;
  color: rgba(17, 17, 17, 0.64);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08);
  transform: translateX(-50%);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.results {
  width: min(1500px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 0 14px 86px;
}

.quick-filters {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 10px 0;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid #e3e3e3;
}

.quick-filters span {
  color: #666;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.quick-chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quick-chip-row button {
  flex: 0 0 auto;
  min-height: 27px;
  border: 1px solid #d7d7d7;
  border-radius: 0;
  padding: 0 8px;
  color: #333;
  background: #fff;
  font-size: 12px;
}

.quick-chip-row button.active {
  color: #fff;
  border-color: #111;
  background: #111;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
}

.photo-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #fff;
  content-visibility: auto;
  contain-intrinsic-size: 260px 430px;
}

.photo-open {
  position: relative;
  display: block;
  width: 100%;
  height: 380px;
  min-height: 380px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #f1f1f1;
  contain: layout paint;
}

.photo-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 28px 8px 7px;
  color: #fff;
  opacity: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
  transition: opacity 160ms ease;
}

.photo-open:hover .photo-overlay,
.photo-open:focus-visible .photo-overlay {
  opacity: 1;
}

.photo-overlay strong,
.photo-overlay em {
  font-size: 12px;
  font-style: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.photo-body {
  display: grid;
  gap: 4px;
  min-height: 92px;
  padding: 7px 0 0;
  color: #171717;
  background: #fff;
  border-top: 0;
}

.photo-body .photo-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.photo-body h3 {
  display: -webkit-box;
  min-height: 32px;
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.photo-body p {
  margin: 0;
  overflow: hidden;
  color: #666;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  position: fixed;
  top: 70px;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(440px, 100vw);
  padding: 18px;
  overflow: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(105%);
  transition: transform 180ms ease;
}

.filters.open,
.filters[data-state="open"] {
  transform: translateX(0);
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.filter-head h2,
.filters h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0;
}

.filter-head h2 {
  font-size: 19px;
}

.filter-head button {
  width: 36px;
  min-height: 36px;
  font-size: 24px;
}

.filters section + section {
  margin-top: 24px;
}

.filters h3 {
  margin-bottom: 10px;
  color: #626262;
  font-size: 12px;
}

.year-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.year-inputs label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.year-inputs input {
  height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  padding: 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chips button {
  min-height: 30px;
  padding: 0 9px;
  color: #222;
  font-size: 12px;
}

.chips button.active {
  color: #fff;
  border-color: #111;
  background: #111;
}

.timeline-shell {
  position: sticky;
  top: 66px;
  z-index: 19;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto 54px;
  gap: 10px;
  align-items: center;
  width: 100%;
  height: 78px;
  padding: 9px 16px 11px;
  color: #fff;
  background: rgba(8, 8, 8, 0.96);
  border-top: 1px solid #262626;
  border-bottom: 1px solid #262626;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.timeline-wrap {
  position: relative;
  min-width: 0;
  height: 60px;
  padding: 0 0 20px;
}

.timeline {
  display: flex;
  align-items: end;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  height: 42px;
  padding-bottom: 0;
  scrollbar-width: none;
}

.timeline::-webkit-scrollbar {
  display: none;
}

.year-marker {
  flex: 1 0 64px;
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 30px;
  padding: 2px 2px;
  color: #fff;
  border-color: transparent;
  background: transparent;
}

.year-marker.active strong,
.year-marker.active em {
  color: var(--accent);
}

.year-marker strong,
.year-marker em,
.timeline-end,
.timeline-current {
  font-size: 12px;
  font-style: normal;
}

.year-marker em {
  display: none;
  color: #aaa;
}

.timeline-end {
  padding: 0 0 18px;
  color: #cfcfcf;
  background: transparent;
  font-weight: 700;
}

.timeline-current {
  align-self: center;
  padding: 7px 10px;
  color: #fff;
  white-space: nowrap;
  background: var(--accent);
  border-radius: 0;
  font-weight: 700;
}

.year-slider {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.year-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--accent), #b6b6b6);
  border-radius: 999px;
}

.year-slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.year-slider::-moz-range-track {
  height: 4px;
  background: linear-gradient(to right, var(--accent), #b6b6b6);
  border-radius: 999px;
}

.year-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

dialog {
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: 0;
  padding: 0;
  background: #fff;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 38px;
  min-height: 38px;
  padding: 0;
  font-size: 26px;
}

#detailContent {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
}

.detail-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 42px;
  min-height: 58px;
  border: 0;
  color: #fff;
  font-size: 42px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.38);
  transform: translateY(-50%);
}

.detail-nav:hover,
.detail-nav:focus-visible {
  background: var(--accent);
}

.detail-prev {
  left: 0;
}

.detail-next {
  right: min(36%, 360px);
}

#detailContent img {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 32px);
  object-fit: contain;
  background: #e7e4dd;
}

.detail-text {
  padding: 38px 28px 28px;
}

.detail-text .photo-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.detail-text h2 {
  margin: 8px 0 0;
  font-size: 24px;
  line-height: 1.18;
}

dl {
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

dl div.detail-long {
  display: block;
}

dl div.detail-long dt {
  margin-bottom: 4px;
}

.ocr-summary dd {
  white-space: pre-line;
}

.collection-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.reverse-preview {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.reverse-preview h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.reverse-open {
  width: min(220px, 100%);
  padding: 0;
  border: 1px solid var(--line);
  background: #f2f2f0;
}

.reverse-open img {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
}

.collection-row span {
  border: 1px solid #cbd4d6;
  border-radius: 0;
  padding: 4px 7px;
  color: #236d73;
  font-size: 12px;
  background: #f7fbfb;
}

.review-app {
  width: min(1420px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  background: #d8d8d8;
}

.review-summary div {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 10px;
  background: #fff;
}

.review-summary strong {
  font-size: 18px;
}

.review-summary span {
  color: var(--muted);
  font-size: 12px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  align-items: start;
}

.review-card {
  min-width: 0;
  background: #fff;
}

.review-image {
  display: grid;
  place-items: center;
  height: 250px;
  background: #ededeb;
}

.review-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.review-body {
  display: grid;
  gap: 5px;
  padding: 8px;
}

.review-status {
  width: fit-content;
  padding: 3px 6px;
  color: #fff;
  background: #111;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.review-card[data-status="Vorderseite"] .review-status {
  background: var(--accent);
}

.review-card[data-status="Rückseite"] .review-status {
  background: #236d73;
}

.review-card[data-status="Einzelbild"] .review-status {
  background: #666;
}

.review-body h2 {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
}

.review-body p {
  display: -webkit-box;
  min-height: 36px;
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.review-body small,
.review-body em {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.edit-page {
  width: min(1500px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 0 14px 40px;
}

.edit-timeline {
  margin-inline: 0;
}

.edit-mode-strip {
  margin: 10px 0 14px;
}

.edit-mode-strip .quick-chip-row button {
  pointer-events: none;
}

.edit-app {
  display: grid;
  grid-template-columns: minmax(260px, 390px) minmax(0, 1fr);
  gap: 18px;
}

.edit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
  align-content: start;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding-right: 4px;
}

.edit-list-item {
  display: grid;
  grid-template-rows: 190px minmax(92px, auto);
  gap: 0;
  width: 100%;
  min-height: 292px;
  padding: 0;
  text-align: left;
  border: 1px solid #dfdfdf;
  background: #fff;
}

.edit-list-item.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.edit-list-item.changed {
  background: #fff8f4;
}

.edit-list-item img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: contain;
  background: #ececea;
  border-bottom: 1px solid #e6e6e6;
}

.edit-list-item span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
}

.edit-list-item strong {
  color: var(--accent);
  font-size: 12px;
}

.edit-list-item em,
.edit-list-item small {
  display: -webkit-box;
  overflow: hidden;
  font-style: normal;
  line-height: 1.25;
  -webkit-box-orient: vertical;
}

.edit-list-item em {
  font-size: 13px;
  font-weight: 700;
  -webkit-line-clamp: 2;
}

.edit-list-item small {
  color: var(--muted);
  font-size: 11px;
  -webkit-line-clamp: 2;
}

.edit-panel {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(380px, 1.12fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.edit-preview {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 86px;
  background: #e8e5de;
}

.edit-preview img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  background: #e7e4dd;
}

.edit-preview img + img {
  max-height: 260px;
  border: 1px solid var(--line);
}

.edit-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff;
  border: 1px solid #e3e3e3;
}

.edit-form-head,
.edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.edit-record-actions,
.edit-helper-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.edit-form-head p {
  margin: 0;
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

.edit-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.edit-form input,
.edit-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 400;
}

.edit-two,
.edit-three {
  display: grid;
  gap: 10px;
}

.edit-two {
  grid-template-columns: 1fr 1fr;
}

.edit-three {
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
}

.edit-actions button,
.edit-form-head button {
  min-height: 38px;
  border: 1px solid #555;
  padding: 0 12px;
  color: #111;
  background: #fff;
}

.edit-actions button {
  color: #111;
  border-color: #555;
  background: #fff;
  font-weight: 800;
}

.edit-helper-actions button,
.edit-actions button[type="submit"] {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.edit-actions a {
  color: #0645d8;
}

.edit-save-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

@media (min-width: 761px) and (max-width: 1120px) {
  .results {
    width: calc(100vw - 36px);
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
  }

  .photo-open {
    height: 320px;
    min-height: 320px;
  }

  .edit-app,
  .edit-panel {
    grid-template-columns: 1fr;
  }

  .edit-list,
  .edit-preview {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .search {
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 12px;
  }

  .search button {
    min-width: 108px;
    margin-left: 0;
  }

  .top-actions {
    justify-content: stretch;
  }

  .edit-app,
  .edit-panel,
  .edit-two,
  .edit-three {
    grid-template-columns: 1fr;
  }

  .edit-list,
  .edit-preview {
    position: static;
    max-height: none;
  }

  .top-actions button,
  .top-actions .nav-link {
    flex: 1;
    padding-inline: 8px;
  }

  .results {
    width: calc(100vw - 20px);
    padding: 10px 10px 84px;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .photo-open {
    height: 210px;
    min-height: 210px;
  }

  .filters {
    top: 156px;
  }

  .timeline-shell {
    grid-template-columns: 42px minmax(0, 1fr) auto 42px;
    top: 156px;
    height: 76px;
    padding-inline: 10px;
  }

  .timeline-wrap {
    height: 56px;
  }

  .year-marker {
    flex-basis: 48px;
  }

  .timeline-current {
    padding-inline: 7px;
    font-size: 11px;
  }

  #detailContent {
    grid-template-columns: 1fr;
  }

  dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
    overflow: auto;
  }

  #detailContent img {
    height: auto;
    max-height: none;
  }

  .close {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: 8px;
  }

  .detail-text {
    padding-top: 24px;
  }

  .detail-nav {
    position: fixed;
    top: 44vh;
    width: 38px;
    min-height: 50px;
    font-size: 34px;
  }

  .detail-next {
    right: 0;
  }

  .review-summary {
    grid-template-columns: 1fr 1fr;
  }
}
