:root {
  color-scheme: light;
  --bg: #ffffff;
  --paper: #fbfaf8;
  --ink: #1c1b19;
  --muted: #716c66;
  --soft: #a8a19a;
  --line: #e8e2da;
  --line-strong: #d3cbc1;
  --accent: #9e0d25;
  --cream: #f4f0ea;
  --danger: #9b2433;
  --shadow: 0 18px 60px rgba(35, 31, 26, 0.12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.is-lightbox-open,
body.is-drawer-open { overflow: hidden; }
button, input, a, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }

.view[hidden],
.lightbox[hidden],
.modal[hidden],
.toast[hidden],
.boot-error[hidden],
.empty[hidden],
.selection-panel[hidden],
.zip-packages[hidden],
.drawer[hidden],
.drawer-overlay[hidden] { display: none !important; }

/* Sicherheitsnetz: verhindert riesige Logo-Darstellung, falls durch
   gecachtes altes Markup (Service Worker) eine Logo-Grafik ohne
   passende Layout-Klasse ausgeliefert wird. Spezifischere Klassen wie
   .home-main-logo, .app-header-brand-mark, .drawer-brand-mark und
   .brand-logo-header definieren ihre Größe selbst und überschreiben dies. */
img[src*="/brand/logo-mark"],
img[src*="/brand/monogram"] {
  max-width: 72px;
  max-height: 72px;
  width: auto;
  height: auto;
}
.app-shell { min-height: 100vh; }

/* ========================= Portal / Login ========================= */

.view-home,
.view-client-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.portal {
  position: relative;
  width: min(1200px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.portal--client {
  width: min(620px, 100%);
  padding: clamp(32px, 6vw, 64px);
  text-align: center;
}

.portal__media {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  height: clamp(70px, 6vw, 90px);
  background: var(--line);
  overflow: hidden;
}
.portal__tile {
  position: relative;
  background: linear-gradient(135deg, var(--cream) 0%, #fff 60%, var(--cream) 100%);
}
.portal__tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(184, 155, 106, 0.12);
}
.portal__tile--1 { background: linear-gradient(135deg, #f3efe9 0%, #ffffff 75%); }
.portal__tile--2 { background: linear-gradient(135deg, #faf7f2 0%, #efe8dd 100%); }
.portal__tile--3 { background: linear-gradient(135deg, #ffffff 0%, #f2ece2 80%); }

.portal__content {
  width: min(620px, 100%);
  justify-self: center;
  text-align: center;
  padding: clamp(28px, 6vw, 64px) clamp(20px, 6vw, 64px) clamp(12px, 3vw, 28px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-main-logo {
  display: block;
  width: clamp(280px, 26vw, 420px);
  max-width: 420px;
  height: auto;
  object-fit: contain;
  margin: 0 auto clamp(48px, 7vh, 76px);
}

@media (max-width: 700px) {
  .home-main-logo {
    width: clamp(230px, 76vw, 320px);
    max-width: 320px;
    margin-bottom: 38px;
  }
}

.brand-logo-header {
  display: block;
  width: clamp(110px, 12vw, 150px);
  max-width: 150px;
  height: auto;
  object-fit: contain;
}

@media (max-width: 700px) {
  .brand-logo-header {
    width: clamp(100px, 34vw, 130px);
    max-width: 130px;
  }
}

.brand-logo-header--portal {
  margin: 0 auto 16px;
}

h1, h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: 0;
}

.portal h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.15;
}

.home-title {
  font-size: clamp(3rem, 5vw, 5.2rem);
  line-height: 0.95;
}

.portal__subline {
  margin: 18px auto 30px;
  max-width: 440px;
  color: var(--muted);
  font-size: clamp(1rem, 1.8vw, 1.12rem);
}

.login-form {
  width: min(420px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.login-form input,
.search input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 0 16px;
  border-radius: 2px;
  font-size: 0.98rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-form input:focus,
.search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 27, 25, 0.08);
}

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0 22px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-size: 0.94rem;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(28, 27, 25, 0.16);
}
.button--primary { background: var(--ink); color: #fff; }
.button--primary:hover { background: #000; }
.button--ghost { background: #fff; border-color: var(--line-strong); }
.button--ghost:hover { border-color: var(--ink); }
.button:disabled { opacity: 0.45; cursor: default; transform: none; }

.hint {
  margin: 16px 0 0;
  color: var(--soft);
  font-size: 0.86rem;
}

.hint--demo {
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.form-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.install-box {
  margin: 22px auto 0;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.install-hint {
  margin: 0;
  max-width: 320px;
  color: var(--soft);
  font-size: 0.84rem;
}
.button--install {
  min-height: 38px;
  padding-inline: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Trust section */
.trust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.trust__item {
  padding: clamp(26px, 3.6vw, 38px) clamp(18px, 3vw, 30px);
  border-right: 1px solid var(--line);
  text-align: left;
}
.trust__item:last-child { border-right: 0; }
.trust__icon {
  display: block;
  margin: 0 0 12px;
  color: var(--accent);
}
.trust__item h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.trust__item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.portal__footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: 18px clamp(20px, 6vw, 64px) clamp(24px, 4vw, 36px);
  border-top: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.84rem;
  text-align: center;
}
.portal__footer a {
  color: var(--muted);
  text-decoration: none;
}
.portal__footer a:hover { text-decoration: underline; }

.link-back {
  display: inline-block;
  margin-top: 22px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.link-back:hover { color: var(--ink); }

/* ========================= Topbar ========================= */

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: max(12px, var(--safe-top)) clamp(16px, 4vw, 44px) 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}
.topbar--sticky {
  position: sticky;
  top: 0;
  z-index: 20;
}
.app-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.app-header-brand-mark {
  display: block !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  object-fit: cover !important;
  object-position: center !important;
  border-radius: 2px;
  flex: 0 0 44px !important;
  opacity: 1 !important;
}

.app-header-brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.1;
}

.app-header-title {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.25rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-subtitle {
  margin-top: 2px;
  font-size: 0.82rem;
  line-height: 1.1;
  color: rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Notfall-Override: erzwingt sichtbare Headerlogo-Größe im Topbar-Bereich,
   unabhängig von eventuell verbleibenden alten Logo-Regeln. */
.topbar img[src*="logo-mark"],
.topbar img[src*="monogram"],
.topbar img[src*="logo"] {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  object-fit: cover !important;
  object-position: center !important;
  opacity: 1 !important;
}

@media (max-width: 700px) {
  .app-header {
    min-height: 60px;
    gap: 12px;
    padding: 0 14px;
  }

  .app-header-brand {
    gap: 12px;
  }

  .app-header-brand-mark {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    flex-basis: 38px !important;
  }

  .app-header-title {
    font-size: 1.08rem;
  }

  .app-header-subtitle {
    font-size: 0.75rem;
  }

  .topbar img[src*="logo-mark"],
  .topbar img[src*="monogram"],
  .topbar img[src*="logo"] {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
  }
}

.topbar__spacer { flex: 1 1 auto; }

.icon-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}
.icon-button:hover { border-color: var(--ink); }

.header-favorites {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
}
.header-favorites:hover { border-color: var(--ink); }
.header-favorites.is-active {
  border-color: var(--accent);
  color: var(--accent);
}
.header-favorites span { font-size: 0.86rem; font-weight: 600; }

/* ========================= Drawer ========================= */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(20, 19, 17, 0.42);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.drawer-overlay.is-visible { opacity: 1; }

.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 950;
  width: min(340px, 86vw);
  height: 100%;
  height: 100dvh;
  background: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  padding: var(--safe-top) 0 var(--safe-bottom);
}
.drawer.is-open { transform: translateX(0); }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.drawer-brand-mark {
  display: block;
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: cover;
  object-position: center;
  border-radius: 2px;
  flex: 0 0 auto;
}
.drawer__head strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer__list {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
  overflow-y: auto;
}
.drawer__list li button {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 0.96rem;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.drawer__list li button:hover {
  border-color: var(--ink);
  background: var(--paper);
}
.drawer__list li button svg { flex: 0 0 auto; }
.drawer__divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}

/* ========================= Pages ========================= */

.page {
  width: min(1400px, calc(100% - clamp(20px, 5vw, 72px)));
  margin: 0 auto;
  padding: clamp(22px, 4vw, 46px) 0 72px;
}
.page--narrow { width: min(1100px, calc(100% - clamp(20px, 5vw, 72px))); }

.section-heading { margin-bottom: 24px; }
.section-heading h2,
.album-summary h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
}

/* ========================= Albums ========================= */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}
@media (min-width: 760px) {
  .album-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1180px) {
  .album-grid { grid-template-columns: repeat(3, 1fr); }
}

.album-card {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  overflow: hidden;
  text-align: left;
  transition: border-color 0.2s ease;
}
.album-card:hover { border-color: var(--ink); }
.album-card__cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--cream), #fff);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.album-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-card__cover span {
  color: var(--muted);
  padding: 22px;
  text-align: center;
}
.album-card__overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
}
.album-card__overlay h3 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}
.album-card__body {
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}
.album-card p {
  margin: 0;
  color: var(--muted);
}
.album-card__meta {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
}

.album-card--all {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ========================= Unteralben ========================= */

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.back-link:hover { color: var(--ink); }

.gallery-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  color: var(--muted);
}
.gallery-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.gallery-breadcrumb a:hover { color: var(--ink); }

/* ========================= Gallery ========================= */

.album-hero {
  position: relative;
  min-height: clamp(280px, 48vw, 560px);
  border: 1px solid var(--line);
  background: var(--cream);
  overflow: hidden;
}
.album-hero img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  display: block;
  filter: saturate(0.96);
}
.album-hero__overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(22px, 4vw, 46px);
  color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.58));
}
.album-hero__overlay h1 {
  font-size: clamp(2.4rem, 6vw, 5.6rem);
  line-height: 0.97;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}
.album-hero__overlay span {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.38);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  font-size: 0.86rem;
}

.album-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin: 26px 0 18px;
}
.album-summary p {
  margin: 0 0 5px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.search {
  position: relative;
  width: 220px;
  max-width: 100%;
  flex: 0 0 auto;
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--soft);
  pointer-events: none;
}
.search input { min-height: 44px; padding-left: 38px; }

/* Selection panel */
.selection-panel {
  margin: 0 0 18px;
  padding: 4px 0 8px;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.selection-panel.has-favorites {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.selection-panel__text {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.selection-panel__text strong { font-size: 0.95rem; }
.selection-panel__text span {
  color: var(--muted);
  font-size: 0.82rem;
}
.selection-panel__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.selection-panel:not(.has-favorites) .selection-panel__actions { display: none; }

.zip-packages {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.zip-packages__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.zip-packages__head span { color: var(--muted); font-size: 0.86rem; }
.zip-packages__list { display: flex; flex-wrap: wrap; gap: 8px; }
.zip-packages p { margin: 0; color: var(--muted); font-size: 0.82rem; }

.status {
  min-height: 1.4em;
  color: var(--muted);
  margin: 0 0 14px;
  font-size: 0.92rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(10px, 1.6vw, 18px);
}
.photo-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.photo-tile:nth-child(5n + 2) { aspect-ratio: 3 / 4; }
.photo-tile:nth-child(7n + 4) { aspect-ratio: 1 / 1; }
.photo-open {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
}
.photo-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.42s ease, filter 0.42s ease;
}
.photo-tile:hover .photo-open img { transform: scale(1.035); filter: saturate(1.04); }
.favorite-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.favorite-button svg { display: block; }
.favorite-button.is-active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(158, 13, 37, 0.28);
}

.photo-tile__tag {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.empty {
  border: 1px solid var(--line);
  padding: 32px;
  background: var(--paper);
  text-align: center;
}

/* ========================= Lightbox ========================= */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: var(--safe-top) 0 var(--safe-bottom);
  overflow: hidden;
}

.lightbox:fullscreen {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.lightbox__top,
.lightbox__bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  border-color: var(--line);
  background: #fff;
  z-index: 2;
}
.lightbox__top {
  min-height: 60px;
  justify-content: space-between;
  padding: 12px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}
.lightbox__top strong { font-size: 0.96rem; color: var(--muted); }
.lightbox__bottom {
  min-height: 76px;
  padding: 10px clamp(10px, 3vw, 28px);
  border-top: 1px solid var(--line);
  justify-content: center;
  gap: 10px;
}
.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px 64px;
  background: #fff;
}
.lightbox-image {
  display: block !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}
.tool-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
}
.tool-button:hover { border-color: var(--ink); }
.tool-button.is-active {
  border-color: var(--accent);
  color: var(--accent);
}
.tool-button svg { flex: 0 0 auto; }

.nav-button {
  position: absolute;
  top: 50%;
  z-index: 110;
  transform: translateY(-50%);
  width: 44px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 2.4rem;
  line-height: 1;
}
.nav-button--prev { left: 12px; }
.nav-button--next { right: 12px; }

/* ========================= Toast / Modals ========================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  z-index: 1300;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 24px));
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.boot-error {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  background: var(--cream);
  color: var(--ink);
}
.boot-error p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
}
.boot-error__detail {
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: min(480px, 90vw);
  word-break: break-word;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(28, 27, 25, 0.36);
}
.modal__card {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.modal__card h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.modal__card p { margin: 8px 0 0; color: var(--muted); }
.modal__card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.modal__card input,
.modal__card textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.modal__card textarea { resize: vertical; min-height: 110px; }
.modal__card input:focus,
.modal__card textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 27, 25, 0.06);
}
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.email-box {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.email-box span { color: var(--muted); font-size: 0.82rem; }
.email-box strong { overflow-wrap: anywhere; user-select: all; }
.email-box p { margin: 3px 0 0; color: var(--muted); font-size: 0.88rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  z-index: 300;
}

@media (min-width: 1280px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); }
}
@media (min-width: 1600px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 760px) {
  .view-home, .view-client-login { padding: 0; }
  .portal { box-shadow: none; border: 0; min-height: 100dvh; }
  .portal--client { min-height: auto; margin: auto; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 28px 20px 36px; }
  .portal__media { height: clamp(50px, 14vw, 70px); }
  .portal h1 { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  .home-title { font-size: clamp(2.35rem, 12vw, 3.4rem); }
  .portal__content { padding: 28px 20px 8px; }
  .login-form { grid-template-columns: 1fr; }
  .trust { grid-template-columns: 1fr 1fr; }
  .trust__item { padding: 22px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .trust__item:nth-child(2n) { border-right: 0; }
  .trust__item:nth-last-child(-n+2) { border-bottom: 0; }

  .topbar { min-height: 64px; gap: 12px; padding-inline: 16px; }
  .icon-button { width: 44px; height: 44px; }
  .header-favorites span { display: none; }
  .header-favorites { width: 42px; padding: 0; justify-content: center; }

  .page, .page--narrow { width: calc(100% - 18px); padding-top: 18px; }
  .album-grid { gap: 12px; }
  .album-hero { min-height: 300px; }
  .album-hero__overlay { display: grid; align-content: end; padding: 18px; }
  .album-hero__overlay h1 { font-size: clamp(2.4rem, 13vw, 3.6rem); }
  .album-summary { display: grid; margin-top: 20px; gap: 10px; }
  .search { width: 100%; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .photo-tile,
  .photo-tile:nth-child(5n + 2),
  .photo-tile:nth-child(7n + 4) { aspect-ratio: 1 / 1; }

  .selection-panel { align-items: stretch; grid-template-columns: 1fr; gap: 8px; }
  .selection-panel:not(.has-favorites) { padding-bottom: 4px; }
  .selection-panel__actions { justify-content: flex-start; }
  .zip-packages__head { display: grid; }
  .selection-panel__actions .button { min-height: 38px; padding-inline: 12px; font-size: 0.82rem; }

  .lightbox { height: 100dvh; }
  .lightbox__top { min-height: 54px; padding: 8px 14px; }
  .stage { min-height: 0; padding: 8px 0; }
  .lightbox-image { max-width: 100vw !important; max-height: 100% !important; width: auto !important; height: auto !important; object-fit: contain !important; }
  .lightbox__bottom {
    min-height: 64px;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  .tool-button { min-width: max-content; min-height: 42px; padding-inline: 12px; }
  .tool-button span { white-space: nowrap; }
  .nav-button { top: 50%; bottom: auto; width: 42px; height: 46px; font-size: 2rem; }
  .nav-button--prev { left: 8px; }
  .nav-button--next { right: 8px; }
}

@supports not (height: 100dvh) {
  .lightbox { height: 100vh; }
  .view-home, .view-client-login { min-height: 100vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
