:root {
  --navy: #0b1f3a;
  --slate: #334155;
  --dusty: #5b6f8c;
  --teal: #7fa7a3;
  --ivory: #f8f6f1;
  --warm: #faf8f4;
  --stone: #d9d4cc;
  --champagne: #c8a96a;
  --copper: #c9795b;
  --line: rgba(11, 31, 58, 0.12);
  --shadow: 0 24px 70px rgba(11, 31, 58, 0.14);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at top left, rgba(200, 169, 106, 0.18), transparent 32rem),
    linear-gradient(135deg, #fffaf2 0%, var(--ivory) 52%, #efe9df 100%);
  color: var(--navy);
}

button,
input {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar,
.album-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
}

.brand img {
  width: 104px;
  height: auto;
  display: block;
}

.brand.mini img {
  width: 104px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topnav a,
.credit a {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.topnav a {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.topnav a:hover {
  background: rgba(11, 31, 58, 0.06);
}

.admin-shell {
  padding-bottom: 34px;
}

.admin-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 0 16px;
}

.admin-summary h1 {
  font-family: inherit;
  font-size: 24px;
  font-weight: 850;
}

.admin-summary p {
  margin: 3px 0 0;
  color: var(--slate);
  font-size: 13px;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.auth-card {
  width: min(560px, calc(100vw - 32px));
  display: grid;
  gap: 24px;
  padding: 30px;
}

.auth-card h1 {
  font-size: clamp(38px, 7vw, 64px);
}

.auth-card form {
  display: grid;
  gap: 16px;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: end;
  padding: 72px 0 36px;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.06;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 82px);
  font-weight: 500;
}

h2 {
  font-size: 18px;
}

h3 {
  margin: 0;
}

p {
  line-height: 1.6;
}

.admin-hero p:not(.eyebrow) {
  max-width: 640px;
  color: var(--slate);
  font-size: 18px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 20px rgba(11, 31, 58, 0.04);
}

.status-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--slate);
  font-size: 13px;
}

.status-card p {
  margin: 4px 0 0;
  color: var(--slate);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  margin-top: 0;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(127, 167, 163, 0.18);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.form-card {
  padding: 16px;
}

.form-heading {
  margin-bottom: 12px;
}

.form-heading p,
.muted {
  margin: 8px 0 0;
  color: var(--slate);
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid rgba(11, 31, 58, 0.1);
  border-radius: 8px;
}

fieldset:first-of-type label:first-of-type,
fieldset:first-of-type label:last-of-type {
  grid-column: 1 / -1;
}

legend {
  padding: 0 8px;
  color: var(--champagne);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 5px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(11, 31, 58, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--navy);
  padding: 0 10px;
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(127, 167, 163, 0.18);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 6px;
}

.icon-btn,
.tool-btn {
  border: 0;
  cursor: pointer;
}

.icon-btn {
  min-width: 38px;
  min-height: 36px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 20px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.primary-btn {
  background: var(--navy);
  color: #fff;
}

.secondary-btn {
  background: rgba(11, 31, 58, 0.08);
  color: var(--navy);
}

.danger-btn {
  background: rgba(153, 27, 27, 0.08);
  color: #8f1d1d;
}

.danger-btn.solid {
  background: #8f1d1d;
  color: #fff;
}

.danger-zone {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(153, 27, 27, 0.16);
  border-radius: 8px;
  background: rgba(153, 27, 27, 0.04);
}

.danger-zone h3 {
  margin: 0;
  color: #8f1d1d;
}

.danger-zone p {
  margin: 6px 0 0;
  color: var(--slate);
  font-size: 13px;
}

.compact-btn {
  min-height: 34px;
}

.form-message {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--slate);
  font-size: 14px;
  font-weight: 700;
}

.nfc-link {
  min-height: 54px;
  display: flex;
  align-items: center;
  margin: 12px 0;
  padding: 10px;
  border: 1px dashed rgba(11, 31, 58, 0.22);
  border-radius: 8px;
  background: rgba(250, 248, 244, 0.82);
  color: var(--slate);
  overflow-wrap: anywhere;
}

.inline-result {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(11, 31, 58, 0.1);
  border-radius: 8px;
  background: rgba(250, 248, 244, 0.55);
}

.inline-result h3 {
  font-size: 14px;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.record-list {
  margin-top: 14px;
  padding: 16px;
}

.list-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.list-heading h2 {
  margin-bottom: 0;
}

.album-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 0;
  border-top: 1px solid rgba(11, 31, 58, 0.1);
}

.album-row-main {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.album-row:hover .album-row-main {
  background: rgba(200, 169, 106, 0.08);
}

.album-row-main strong {
  color: var(--navy);
  font-weight: 900;
}

.album-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.album-row > a {
  justify-self: end;
}

.cache-badge {
  padding: 4px 8px;
  border: 1px solid rgba(51, 65, 85, 0.18);
  border-radius: 999px;
  color: var(--slate);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.cache-badge.active {
  border-color: rgba(122, 167, 163, 0.35);
  background: rgba(122, 167, 163, 0.12);
  color: #315f5b;
}

.album-row a {
  width: fit-content;
  color: var(--champagne);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.album-row span {
  color: var(--slate);
  font-size: 13px;
}

.album-view {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 15% 12%, rgba(200, 169, 106, 0.16), transparent 24rem),
    linear-gradient(145deg, #fbf5e9, var(--ivory));
}

.album-loader {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--navy);
}

.album-loader[hidden] {
  display: none;
}

.loader {
  width: 65px;
  height: 30px;
  position: relative;
}

.loader::before {
  content: "";
  position: absolute;
  border-radius: 50px;
  box-shadow: 0 0 0 3px inset #fff;
  animation: l3 0.75s infinite alternate;
}

@keyframes l3 {
  0% { inset: 0 35px 0 0; }
  50% { inset: 0 0 0 0; }
  100% { inset: 0 0 0 35px; }
}

.slideshow-stage {
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #05070b;
}

.album-toolbar {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.toolbar-actions {
  pointer-events: auto;
}

.tool-btn {
  width: 44px;
  height: 44px;
  display: grid;
  grid-template-columns: repeat(2, 7px);
  grid-template-rows: repeat(2, 7px);
  justify-content: center;
  align-content: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--navy);
  box-shadow: 0 10px 24px rgba(11, 31, 58, 0.14);
  backdrop-filter: blur(18px);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.tool-btn span {
  border: 1.5px solid currentColor;
  border-radius: 2.5px;
}

.tool-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 30px rgba(11, 31, 58, 0.18);
}

.slideshow-shell,
.slideshow {
  width: 100%;
  min-height: 100dvh;
}

.slideshow {
  position: relative;
  overflow: hidden;
  background: #f8f6f1;
  touch-action: pan-y;
  cursor: pointer;
}

.slide-backdrop {
  position: absolute;
  inset: -7%;
  background-position: center;
  background-size: cover;
  filter: blur(24px) brightness(1.12) saturate(0.9);
  opacity: 0.88;
  transform: scale(1.08);
}

.slide-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), rgba(248, 246, 241, 0.34)),
    rgba(248, 246, 241, 0.12);
}

.slide-track {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  transform: translate3d(0, 0, 0);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
  z-index: 1;
}

.slide-track.no-transition {
  transition: none;
}

.slide-frame {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  min-height: 100dvh;
  margin: 0;
}

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

.slideshow::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 40%;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.68));
}

.slide-caption {
  position: fixed;
  left: max(20px, env(safe-area-inset-left));
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 8;
  color: #fff;
  text-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}

.slide-caption p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.slide-caption h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(34px, 8vw, 72px);
  line-height: 0.95;
}

.slide-nav {
  position: fixed;
  top: 50%;
  z-index: 9;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.94);
  cursor: pointer;
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 12px 30px rgba(11, 31, 58, 0.18);
  backdrop-filter: blur(16px);
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.slide-nav:hover {
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 16px 34px rgba(11, 31, 58, 0.22);
}

.slide-nav:active {
  transform: translateY(-50%) scale(0.96);
}

.slide-prev {
  left: 20px;
}

.slide-next {
  right: 20px;
}

.grid-view {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 28px 0;
}

.gallery-header h1 {
  font-size: clamp(38px, 7vw, 76px);
}

.gallery-header p:not(.eyebrow) {
  color: var(--slate);
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.gallery-message {
  min-height: 0;
  margin: 0;
  color: var(--slate);
  font-size: 13px;
  text-align: right;
}

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

.photo-grid-item {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.photo-grid img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
  border: 1px solid rgba(11, 31, 58, 0.1);
  background: var(--warm);
  box-shadow: 0 8px 22px rgba(11, 31, 58, 0.08);
}

.photo-grid-item:hover img {
  border-color: rgba(200, 169, 106, 0.72);
}

.contact-card {
  margin-top: 28px;
  padding: 22px;
  border-left: 3px solid rgba(200, 169, 106, 0.7);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.contact-card h2 {
  margin-bottom: 10px;
}

.contact-card p {
  margin: 6px 0;
  color: var(--slate);
}

.credit {
  margin-top: 28px;
  color: var(--dusty);
  text-align: center;
}

@media (max-width: 860px) {
  .admin-hero,
  .admin-grid,
  fieldset {
    grid-template-columns: 1fr;
  }

  .admin-hero {
    padding-top: 42px;
  }

  .form-card,
  .result-card {
    padding: 20px;
  }

  .list-heading {
    grid-template-columns: 1fr;
  }

  .gallery-header {
    display: grid;
    align-items: start;
  }

  .gallery-actions {
    justify-content: flex-start;
  }

  .gallery-message {
    margin-top: 0;
    text-align: left;
  }

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

@media (max-width: 520px) {
  .shell,
  .grid-view {
    width: min(100vw - 20px, 1180px);
  }

  .topbar {
    align-items: start;
    flex-direction: column;
    padding-top: 12px;
  }

  .topnav {
    width: 100%;
    justify-content: space-between;
  }

  .brand img {
    width: 112px;
  }

  h1 {
    font-size: 42px;
  }

  .slide-nav {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 20px;
  }

  .slide-prev {
    left: 12px;
  }

  .slide-next {
    right: 12px;
  }

  .slide-caption {
    bottom: max(20px, env(safe-area-inset-bottom));
  }

  .slide-caption h1 {
    max-width: 78vw;
  }

}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
