:root {
  color-scheme: light;
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-soft: #eef4ea;
  --ink: #141614;
  --muted: #667067;
  --line: #d9dfd4;
  --green: #39b51f;
  --green-dark: #128523;
  --blue: #1f5d8c;
  --amber: #b47a12;
  --danger: #b42318;
  --shadow: 0 18px 46px rgba(17, 24, 19, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(130deg, rgba(57, 181, 31, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(31, 93, 140, 0.1), transparent 42%),
    var(--bg);
  color: var(--ink);
}

body.is-locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(13, 15, 14, 0.9), rgba(18, 133, 35, 0.78));
}

.login-screen.is-hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(100%, 440px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.28);
}

.login-card img {
  width: min(100%, 310px);
  justify-self: center;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-weight: 850;
}

.gallery-header,
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand img {
  width: min(260px, 34vw);
  max-height: 78px;
  object-fit: contain;
}

h1,
h2,
p {
  margin-top: 0;
}

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

h1 {
  font-size: clamp(28px, 4vw, 46px);
}

h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions,
.viewer-actions,
.form-actions,
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 0;
  font-weight: 850;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.danger-button {
  background: #fde8e4;
  color: var(--danger);
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: #fbfcfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.is-active {
  border-color: rgba(18, 133, 35, 0.25);
  background: var(--surface-soft);
  color: var(--green-dark);
}

.status-pill.is-warning {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fde8e4;
  color: var(--danger);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
  gap: 22px;
  padding: clamp(18px, 4vw, 44px);
}

.panel,
.stats-strip article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-panel,
.list-panel {
  padding: 22px;
}

.section-title,
.list-toolbar {
  margin-bottom: 20px;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.wide-field {
  grid-column: 1 / -1;
}

.file-drop {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfa;
}

.file-drop span {
  color: var(--ink);
  font-size: 18px;
}

.file-drop small,
.photo-meta {
  color: var(--muted);
  font-weight: 750;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.gallery-workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats-strip article {
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(57, 181, 31, 0.1), transparent 52%),
    var(--surface);
}

.stats-strip strong {
  display: block;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
}

.stats-strip span {
  color: var(--muted);
  font-weight: 850;
}

.list-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.search-tools {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(150px, 190px);
  gap: 12px;
}

.photo-list {
  display: grid;
  gap: 14px;
}

.photo-editor-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfa;
}

.photo-editor-card > img {
  width: 100%;
  height: 170px;
  border-radius: 8px;
  object-fit: cover;
  background: #e5e9e1;
}

.photo-editor-fields {
  display: grid;
  gap: 12px;
}

.editor-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 120px 120px;
  gap: 12px;
}

.compact-toggle {
  color: var(--ink);
  white-space: nowrap;
}

.empty-state {
  display: none;
  margin-top: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fbfcfa;
  text-align: center;
}

.empty-state.is-visible {
  display: block;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.gallery-view-page {
  background:
    linear-gradient(180deg, rgba(20, 22, 20, 0.78), rgba(20, 22, 20, 0.18) 380px, transparent 620px),
    var(--bg);
}

.viewer-header {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(20, 22, 20, 0.9), rgba(18, 133, 35, 0.74)),
    #151917;
}

.viewer-header .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.viewer-main {
  padding: clamp(18px, 4vw, 44px);
}

.viewer-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  color: #fff;
}

.viewer-intro h2 {
  max-width: 760px;
  font-size: clamp(34px, 6vw, 76px);
}

.viewer-search {
  width: min(100%, 360px);
  color: rgba(255, 255, 255, 0.86);
}

.public-gallery {
  columns: 4 240px;
  column-gap: 16px;
}

.public-photo-card {
  display: inline-grid;
  position: relative;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #151917;
  box-shadow: var(--shadow);
  break-inside: avoid;
  text-align: left;
}

.public-photo-card img {
  display: block;
  width: 100%;
  min-height: 210px;
  object-fit: cover;
  transition: transform 180ms ease;
}

.public-photo-card:hover img {
  transform: scale(1.025);
}

.public-photo-card span {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: grid;
  gap: 3px;
  padding: 42px 14px 14px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  color: #fff;
}

.public-photo-card strong {
  overflow-wrap: anywhere;
}

.public-photo-card small {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.viewer-empty {
  background: rgba(255, 255, 255, 0.92);
}

.lightbox {
  width: min(96vw, 1280px);
  max-width: none;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #0d0f0e;
  color: #fff;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.lightbox figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 0;
  margin: 0;
  min-height: min(84vh, 780px);
}

.lightbox img {
  width: 100%;
  height: 84vh;
  object-fit: contain;
  background: #050605;
}

.lightbox figcaption {
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 28px;
}

.lightbox figcaption strong {
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
}

.lightbox figcaption span {
  color: #a7d79a;
  font-weight: 850;
}

.lightbox figcaption p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.55;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.lightbox-close {
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  font-size: 30px;
}

.lightbox-nav {
  top: 50%;
  width: 48px;
  height: 72px;
  font-size: 50px;
  transform: translateY(-50%);
}

.lightbox-nav.previous {
  left: 14px;
}

.lightbox-nav.next {
  right: 14px;
}

@media (max-width: 1080px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .viewer-intro {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .gallery-header,
  .viewer-header,
  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand img {
    width: min(100%, 300px);
  }

  .header-actions,
  .viewer-actions,
  .form-actions,
  .editor-actions,
  .search-tools,
  .photo-form,
  .stats-strip,
  .editor-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .photo-editor-card,
  .lightbox figure {
    grid-template-columns: 1fr;
  }

  .lightbox img {
    height: 58vh;
  }
}

@media print {
  .viewer-actions,
  .viewer-search,
  .lightbox {
    display: none !important;
  }

  .gallery-view-page {
    background: #fff;
  }

  .viewer-header,
  .viewer-intro {
    color: var(--ink);
    background: #fff;
  }
}
