:root {
  color-scheme: light;
  --jungle: #1f3a2e;
  --jungle-soft: #315343;
  --gold: #d4af7c;
  --gold-deep: #9b7443;
  --cream: #fef9ed;
  --paper: #fffdf7;
  --ink: #17231d;
  --muted: #66726c;
  --line: #d9d8cc;
  --line-strong: #b9bbae;
  --danger: #a44132;
  --success: #33704f;
  --shadow: 0 18px 50px rgba(31, 58, 46, 0.1);
  font-family: "Avenir Next", Avenir, "Century Gothic", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--cream);
}

button,
input {
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-loading {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 30px;
  aspect-ratio: 1;
  border: 2px solid rgba(31, 58, 46, 0.18);
  border-top-color: var(--jungle);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--jungle);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  color: var(--cream);
  background: var(--jungle);
  border-radius: 50%;
  font-size: 17px;
}

.access-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  border-top: 6px solid var(--jungle);
}

.access-panel {
  width: min(100%, 520px);
  padding: 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.access-copy {
  margin: 64px 0 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--jungle);
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.08;
  letter-spacing: 0;
}

.access-copy > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.access-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
}

input[type="password"]:focus {
  border-color: var(--jungle);
  box-shadow: 0 0 0 3px rgba(31, 58, 46, 0.12);
}

.button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:focus-visible,
.drop-zone:focus-within,
.gallery-item:focus-visible {
  outline: 3px solid rgba(212, 175, 124, 0.72);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.button-primary {
  color: white;
  background: var(--jungle);
  border-color: var(--jungle);
}

.button-primary:hover:not(:disabled) {
  background: var(--jungle-soft);
}

.button-quiet {
  color: var(--jungle);
  background: transparent;
  border-color: var(--line);
}

.button-quiet:hover {
  background: rgba(31, 58, 46, 0.06);
  border-color: var(--line-strong);
}

.form-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.site-header {
  min-height: 72px;
  padding: 12px max(24px, calc((100vw - 1400px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--paper);
  border-top: 5px solid var(--jungle);
  border-bottom: 1px solid var(--line);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.image-count {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.workspace-heading h1 {
  margin: 0;
}

.choose-button {
  flex: 0 0 auto;
}

.drop-zone {
  min-height: 176px;
  padding: 28px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  background: rgba(255, 253, 247, 0.7);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  background: var(--paper);
  border-color: var(--gold-deep);
}

.drop-symbol {
  width: 38px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 5px;
  color: var(--jungle);
  background: rgba(212, 175, 124, 0.28);
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.drop-title {
  color: var(--jungle);
  font-weight: 700;
}

.drop-detail {
  color: var(--muted);
  font-size: 13px;
}

.upload-queue,
.collection {
  margin-top: 44px;
}

.section-heading {
  min-height: 32px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

.upload-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.upload-item {
  min-height: 52px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, 220px) 72px;
  align-items: center;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: #e6e5dc;
  border-radius: 5px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--gold-deep);
  transition: width 100ms linear;
}

.upload-status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.upload-item.is-complete .progress-bar {
  background: var(--success);
}

.upload-item.is-error .progress-bar {
  background: var(--danger);
}

.upload-item.is-error .upload-status {
  color: var(--danger);
}

.notice {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.gallery-item {
  min-width: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: zoom-in;
}

.gallery-image-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e7e5dc;
  border-radius: 6px;
}

.gallery-image-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 240ms ease;
}

.gallery-item:hover img {
  transform: scale(1.025);
}

.gallery-caption {
  min-width: 0;
  padding: 9px 2px 0;
}

.gallery-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 64px 24px;
  text-align: center;
  background: rgba(255, 253, 247, 0.48);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

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

.image-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  color: white;
  background: rgba(13, 18, 15, 0.96);
  border: 0;
}

.image-dialog::backdrop {
  background: rgba(13, 18, 15, 0.72);
}

.image-dialog[open] {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.dialog-bar {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.dialog-bar p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.dialog-bar .button-quiet {
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
}

.image-dialog img {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 24px;
  object-fit: contain;
}

@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .access-panel {
    padding: 28px 22px;
  }

  .access-copy {
    margin-top: 48px;
  }

  .access-row {
    grid-template-columns: 1fr;
  }

  .site-header {
    min-height: 64px;
    padding-inline: 16px;
  }

  .image-count {
    display: none;
  }

  .workspace {
    padding: 36px 16px 64px;
  }

  .workspace-heading {
    align-items: center;
  }

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

  .upload-item {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 8px;
  }

  .progress-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 420px) {
  .header-actions {
    gap: 8px;
  }

  .site-header .brand > span:last-child {
    display: none;
  }

  .workspace-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .choose-button {
    width: 100%;
  }

  .drop-zone {
    min-height: 154px;
    padding: 20px 16px;
  }
}

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