/* ============================================================
   Pentimento Historical Society Portal — Shared Styles
   ============================================================ */

/* Build stamp — bottom-right corner, low-profile */
.build-stamp {
  position: fixed;
  bottom: 8px;
  right: 10px;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 9px;
  letter-spacing: .04em;
  color: rgba(107, 78, 46, 0.28);
  pointer-events: none;
  user-select: none;
  z-index: 9999;
}

:root {
  --sepia-900: #1A0F08;
  --sepia-800: #302215;
  --sepia-700: #4A3520;
  --sepia-600: #6B4E2E;
  --sepia-500: #8B6914;
  --sepia-400: #B8924A;
  --sepia-300: #D4B896;
  --sepia-200: #EDD9B6;
  --sepia-100: #F5EDD6;
  --sepia-50:  #FAF6EF;

  --green:  #2D6A4F;
  --amber:  #92400E;
  --blue:   #1E40AF;
  --red:    #991B1B;
  --green-bg:  #D1FAE5;
  --amber-bg:  #FEF3C7;
  --blue-bg:   #DBEAFE;
  --red-bg:    #FEE2E2;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(48,34,21,0.12), 0 1px 2px rgba(48,34,21,0.08);
  --shadow-md: 0 4px 6px rgba(48,34,21,0.10), 0 2px 4px rgba(48,34,21,0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--sepia-50);
  color: var(--sepia-900);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: var(--sepia-800);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 1rem;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.wordmark {
  font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.92);
}
.portal-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.site-nav a, .site-nav button {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.site-nav a:hover, .site-nav button:hover { background: rgba(255,255,255,0.12); }
.site-nav a.active { background: rgba(255,255,255,0.18); color: #fff; }
.nav-partner-name {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  padding-right: 0.75rem;
  border-right: 1px solid rgba(255,255,255,0.2);
  margin-right: 0.25rem;
}
.btn-logout {
  color: rgba(255,255,255,0.88) !important;
  font-size: 0.8rem !important;
}

/* ── Main layout ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}
.page-title {
  font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--sepia-800);
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: 0.9rem;
  color: var(--sepia-600);
  margin-bottom: 1.75rem;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1px solid var(--sepia-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card + .card { margin-top: 1rem; }
.card-title {
  font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  font-size: 1rem;
  font-weight: bold;
  color: var(--sepia-800);
  margin-bottom: 1rem;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--sepia-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-align: center;
}
.stat-number {
  font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  font-size: 2rem;
  font-weight: bold;
  color: var(--sepia-800);
  line-height: 1;
}
.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sepia-500);
  margin-top: 0.25rem;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--sepia-200);
  margin-bottom: 1.5rem;
  gap: 0;
}
.tab-btn {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sepia-600);
  padding: 0.6rem 1.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--sepia-800); }
.tab-btn.active { color: var(--sepia-800); border-bottom-color: var(--sepia-800); font-weight: 600; }
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 0.4rem;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.4rem;
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  background: var(--sepia-800);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.15); }
.btn-secondary {
  background: var(--sepia-100);
  color: var(--sepia-800);
  border: 1px solid var(--sepia-300);
}
.btn-secondary:hover:not(:disabled) { background: var(--sepia-200); }
.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.1); }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }
.btn-ghost {
  background: transparent;
  color: var(--sepia-600);
  border: 1px solid var(--sepia-300);
}
.btn-ghost:hover { background: var(--sepia-100); }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sepia-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.form-label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--sepia-400);
  font-size: 0.8rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--sepia-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--sepia-900);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--sepia-500);
  box-shadow: 0 0 0 3px rgba(139,105,20,0.15);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--sepia-500); margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Date entry widget */
.date-widget {
  display: grid;
  grid-template-columns: 1fr 1px 1fr 1px 1fr;
  border: 1px solid var(--sepia-300);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.date-widget:focus-within { border-color: var(--sepia-500); box-shadow: 0 0 0 3px rgba(139,105,20,0.15); }
.date-sep { background: var(--sepia-300); }
.date-col { padding: 0.6rem 0.875rem; display: flex; flex-direction: column; gap: 4px; transition: background 0.1s; }
.date-col:focus-within { background: var(--sepia-50, #fdf8f0); }
.date-col-hdr { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--sepia-400); }
.date-col-input { border: none; outline: none; background: transparent; font-size: 0.9rem; color: var(--sepia-900); font-family: inherit; width: 100%; padding: 0; }
.date-col-input::placeholder { color: var(--sepia-300); }
.date-col-hint { font-size: 0.72rem; color: var(--sepia-400); line-height: 1.3; }
.date-circa-row { display: flex; align-items: center; gap: 5px; }
.date-circa-pfx { font-size: 0.9rem; color: var(--sepia-500); font-style: italic; flex-shrink: 0; }
@media (max-width: 500px) {
  .date-widget { grid-template-columns: 1fr; }
  .date-sep { height: 1px; width: 100%; }
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238B6914'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  padding-right: 2.5rem;
}

/* ── File upload drop zone ── */
.drop-zone {
  border: 2px dashed var(--sepia-300);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--sepia-50);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--sepia-500);
  background: var(--sepia-100);
}
.drop-zone input[type=file] { display: none; }
.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; line-height: 1; }
.drop-icon svg { display: block; margin: 0 auto; }
.drop-text { font-size: 0.9rem; color: var(--sepia-600); }
.drop-text strong { color: var(--sepia-800); }
.drop-hint { font-size: 0.78rem; color: var(--sepia-400); margin-top: 0.25rem; }

.image-preview {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--sepia-200);
  margin-top: 0.75rem;
}
.image-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

/* ── Status badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.badge-pending     { background: var(--amber-bg); color: var(--amber); }
.badge-community   { background: var(--blue-bg);  color: var(--blue); }
.badge-approved    { background: var(--green-bg); color: var(--green); }
.badge-rejected    { background: var(--red-bg);   color: var(--red); }
.badge-review      { background: #EDE9FE;          color: #5B21B6; }

/* ── Photo grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.photo-card {
  background: #fff;
  border: 1px solid var(--sepia-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
}
.photo-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.photo-card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--sepia-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sepia-400);
  font-size: 2rem;
}
.photo-card-img img { width: 100%; height: 100%; object-fit: cover; }
.photo-card-body { padding: 0.875rem; }
.photo-card-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--sepia-900);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-card-meta {
  font-size: 0.75rem;
  color: var(--sepia-500);
  margin-bottom: 0.6rem;
}
.photo-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ── Review card (admin / HS queue) ── */
.review-card {
  background: #fff;
  border: 1px solid var(--sepia-200);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 200px 1fr;
  margin-bottom: 1rem;
}
@media (max-width: 600px) { .review-card { grid-template-columns: 1fr; } }
.review-card-img {
  background: var(--sepia-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--sepia-300);
  min-height: 160px;
}
.review-card-img img { width: 100%; height: 100%; object-fit: cover; }
.review-card-body { padding: 1.25rem; }
.review-card-title { font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif; font-size: 1rem; font-weight: bold; color: var(--sepia-800); margin-bottom: 0.25rem; }
.review-meta { font-size: 0.8rem; color: var(--sepia-500); margin-bottom: 0.75rem; }
.review-meta span { margin-right: 1rem; }
.review-desc { font-size: 0.875rem; color: var(--sepia-700); margin-bottom: 0.875rem; line-height: 1.5; }
.review-submitter {
  background: var(--sepia-50);
  border: 1px solid var(--sepia-200);
  border-radius: 6px;
  padding: 0.6rem 0.875rem;
  font-size: 0.8rem;
  color: var(--sepia-600);
  margin-bottom: 0.875rem;
}
.review-submitter strong { color: var(--sepia-800); }
.review-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Map ── */
#location-map {
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--sepia-300);
  margin-top: 0.5rem;
}

/* ── Steps (upload form) ── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--sepia-200);
  overflow: visible;
}
.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--sepia-400);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.step.active { color: var(--sepia-800); border-bottom-color: var(--sepia-800); font-weight: 700; }
.step.done { color: var(--green); }
.step-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--sepia-200);
  color: var(--sepia-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step.active .step-num { background: var(--sepia-800); color: #fff; }
.step.done .step-num { background: var(--green); color: #fff; }
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; }

/* ── Login page ── */
.login-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  background: #fff;
  border: 1px solid var(--sepia-200);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 0.5rem; }
.login-wordmark { font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif; font-size: 2rem; font-weight: bold; color: var(--sepia-800); }
.login-subtitle { text-align: center; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sepia-500); margin-bottom: 2rem; }
.login-divider { border: none; border-top: 1px solid var(--sepia-200); margin: 1.5rem 0; }
.login-footer { text-align: center; font-size: 0.82rem; color: var(--sepia-500); margin-top: 1.5rem; }
.login-footer a { color: var(--sepia-600); }

/* ── Alerts ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error { background: var(--red-bg); color: var(--red); border: 1px solid #FECACA; }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid #A7F3D0; }
.alert-info { background: var(--blue-bg); color: var(--blue); border: 1px solid #BFDBFE; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--sepia-500);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; line-height: 1; }
.empty-icon svg { display: block; margin: 0 auto; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--sepia-700); margin-bottom: 0.25rem; }
.empty-desc { font-size: 0.875rem; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 1.75rem;
  width: 100%;
  max-width: 480px;
}
.modal-title { font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif; font-size: 1.1rem; font-weight: bold; color: var(--sepia-800); margin-bottom: 1rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-dark {
  border-color: rgba(48,34,21,0.2);
  border-top-color: var(--sepia-800);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ── */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--sepia-500); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-2 { gap: 1rem; }

/* ── Public submit page banner ── */
.public-banner {
  background: linear-gradient(135deg, var(--sepia-800) 0%, var(--sepia-700) 100%);
  color: #fff;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.public-banner h1 {
  font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  font-size: 1.75rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--sepia-200);
}
.public-banner p { font-size: 1rem; color: var(--sepia-300); max-width: 520px; margin: 0 auto; line-height: 1.6; }
.public-body { max-width: 680px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Photo batch grid ──────────────────────────────────── */
.photo-batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-top: 1rem; }
.photo-batch-item { position: relative; border: 1px solid var(--sepia-200); border-radius: 8px; overflow: hidden; background: var(--sepia-50); }
.photo-batch-thumb { width: 100%; height: 160px; object-fit: cover; cursor: pointer; display: block; transition: opacity 0.15s; }
.photo-batch-thumb:hover { opacity: 0.85; }
.photo-batch-caption { width: 100%; padding: 0.5rem 0.625rem; border: none; border-top: 1px solid var(--sepia-200); font-size: 0.8rem; line-height: 1.4; resize: none; background: transparent; font-family: inherit; color: var(--sepia-700); outline: none; box-sizing: border-box; }
.photo-batch-caption::placeholder { color: var(--sepia-400); }
.photo-batch-remove { position: absolute; top: 0.375rem; right: 0.375rem; background: rgba(0,0,0,0.55); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; font-size: 1rem; line-height: 22px; cursor: pointer; text-align: center; padding: 0; }
.photo-batch-remove:hover { background: rgba(0,0,0,0.8); }

/* ── Lightbox ──────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: flex; align-items: center; justify-content: center; z-index: 1000; cursor: pointer; }
.lightbox-img { max-width: 90vw; max-height: 88vh; object-fit: contain; border-radius: 4px; cursor: default; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
.lightbox-close { position: fixed; top: 1rem; right: 1.25rem; background: none; border: none; color: rgba(255,255,255,0.8); font-size: 2.5rem; line-height: 1; cursor: pointer; padding: 0; z-index: 1001; }
.lightbox-close:hover { color: #fff; }

/* ── Badge: archived ───────────────────────────────────── */
.badge-archived { background: var(--sepia-100); color: var(--sepia-500); border: 1px solid var(--sepia-300); }
