:root {
  --paper: #fcfbfb;
  --bg: var(--paper);
  --surface: #ffffff;
  --navy: #2c4e69;
  --ink: var(--navy);
  --ink-soft: #6a7a88;
  --sage: #6fad8b;
  --sage-dark: #5a9676;
  --sand: #edaf8d;
  --accent: var(--sage);
  --accent-dark: var(--sage-dark);
  --accent-soft: #eaf3ee;
  --line: #e7e3dd;
  --border: var(--line);
  --danger: #b5654a;
  --success: var(--sage-dark);
  --radius: 16px;
  --shadow: 0 10px 30px -20px rgba(44, 78, 105, 0.35);
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  letter-spacing: .5px;
  margin: 0;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 96px;
}

header.hero {
  text-align: center;
  padding: 40px 16px 32px;
}

header.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--navy);
}

header.hero p {
  color: var(--ink-soft);
  margin-top: 10px;
  font-size: .95rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.upload-card {
  margin-bottom: 28px;
}

.name-field {
  margin-bottom: 14px;
}

.name-field label {
  display: block;
  font-size: .72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.name-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  background: var(--paper);
  color: var(--ink);
}

.name-field input:focus,
.auth-card input:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(111, 173, 139, .18);
}

.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone.dragover {
  border-color: var(--sage);
  background: var(--accent-soft);
}

.dropzone strong {
  color: var(--sage-dark);
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
}

.dropzone input[type="file"] { display: none; }

.upload-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.upload-row .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

.upload-row .bar {
  width: 90px;
  height: 6px;
  background: var(--accent-soft);
  border-radius: 4px;
  overflow: hidden;
}

.upload-row .bar > span {
  display: block;
  height: 100%;
  background: var(--sage);
  transition: width 0.2s;
}

.upload-row .status { width: 70px; text-align: right; }
.upload-row.error .status { color: var(--danger); }
.upload-row.done .status { color: var(--success); }

.retry-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

button {
  font: inherit;
  cursor: pointer;
}

.btn {
  background: var(--sage);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  display: inline-block;
  transition: background .2s;
}

.btn:hover { background: var(--sage-dark); }

.btn.secondary {
  background: var(--surface);
  color: var(--sage-dark);
  border: 1px solid var(--sage);
}

.btn.secondary:hover { background: var(--accent-soft); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.gallery figure {
  margin: 0;
  position: relative;
  background: var(--accent-soft);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.gallery figure::before {
  content: "";
  display: block;
  padding-top: var(--aspect, 100%);
}

.gallery img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery .media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: var(--accent-soft);
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 40px 16px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
}

.sentinel { height: 1px; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 38, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  flex-direction: column;
}

.lightbox.open { display: flex; }

.lightbox img {
  max-width: 92vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox .caption {
  color: #eef2f4;
  margin-top: 12px;
  font-size: 0.9rem;
  text-align: center;
}

.lightbox .caption a { color: var(--sand); }

.lightbox .controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  pointer-events: none;
}

.lightbox .controls button {
  pointer-events: auto;
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.lightbox .close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  font-size: 1.3rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  pointer-events: auto;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(252,251,251,.86) 0%, rgba(244,239,231,.80) 55%, rgba(234,223,210,.84) 100%),
    url("/images/jordan-pond.jpg") center/cover no-repeat;
}

.auth-card {
  max-width: 400px;
  width: 100%;
  text-align: center;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(6px);
  padding: 48px 36px;
}

.auth-card h1 {
  font-size: 2.6rem;
  color: var(--navy);
  margin-bottom: 6px;
}

.auth-card p {
  color: var(--ink-soft);
  font-size: .82rem;
  letter-spacing: .5px;
  margin-bottom: 28px;
}

.auth-card input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
  font-family: inherit;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.auth-card .btn { width: 100%; }

.auth-error {
  color: var(--danger);
  font-size: 0.8rem;
  min-height: 1.2em;
  margin-bottom: 8px;
  letter-spacing: .5px;
}

.admin-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 140px;
  box-shadow: var(--shadow);
}

.stat .value { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; color: var(--navy); }
.stat .label { color: var(--ink-soft); font-size: .68rem; letter-spacing: 1.5px; text-transform: uppercase; }

.admin-actions { margin-bottom: 20px; }

table.uploaders {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

table.uploaders td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.gallery figure .delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(44,78,105,0.72);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
  line-height: 1;
  z-index: 2;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity .15s, transform .15s, background .15s;
}

.gallery figure:hover .delete-btn,
.gallery figure:focus-within .delete-btn,
.gallery figure .delete-btn:focus {
  opacity: 1;
  transform: scale(1);
}

.gallery figure .delete-btn:hover {
  background: var(--danger);
}

/* Touch devices have no hover — keep the button reachable */
@media (hover: none) {
  .gallery figure .delete-btn {
    opacity: 1;
    transform: none;
  }
}
