@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;1,400&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;1,300&display=swap');

:root {
  --bg-deep: #1a1610;
  --bg-warm: #2a2318;
  --bg-surface: #352d22;
  --bg-card: #3d3428;
  --cream: #f5f0e8;
  --cream-soft: #e8e0d2;
  --text-primary: #e8e0d2;
  --text-secondary: #a89a82;
  --text-muted: #7a6e5c;
  --amber: #c87832;
  --amber-glow: rgba(200, 120, 50, 0.4);
  --amber-soft: rgba(200, 120, 50, 0.15);
  --red-soft: #8b5e5e;
  --red-hover: #a06e6e;
  --border: rgba(168, 154, 130, 0.15);
  --border-hover: rgba(168, 154, 130, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
}

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

html {
  height: 100%;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Crimson Pro', 'Playfair Display', Georgia, serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ═══════════════════════════════════════
   ATMOSPHERIC LAYERS
   ═══════════════════════════════════════ */

/* Warm projector ambience — radial glow behind image area */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 120vmax;
  height: 120vmax;
  transform: translate(-50%, -55%);
  background: radial-gradient(
    ellipse 60% 50% at 50% 45%,
    rgba(200, 120, 50, 0.06) 0%,
    rgba(40, 32, 20, 0.02) 50%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}

/* Animated film grain */
body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  z-index: 9999;
  animation: grainDrift 8s steps(10) infinite;
}

@keyframes grainDrift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -3%); }
  20% { transform: translate(3%, 1%); }
  30% { transform: translate(-1%, 3%); }
  40% { transform: translate(2%, -2%); }
  50% { transform: translate(-3%, 2%); }
  60% { transform: translate(1%, -1%); }
  70% { transform: translate(-2%, 3%); }
  80% { transform: translate(3%, -3%); }
  90% { transform: translate(-1%, 1%); }
}

/* Vignette — heavier for darkroom feel */
.vignette-layer {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 65% at 50% 50%,
    transparent 30%,
    rgba(10, 8, 5, 0.4) 100%
  );
  z-index: 9998;
}

/* ═══════════════════════════════════════
   PUBLIC VIEW
   ═══════════════════════════════════════ */

.public-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 1;
  animation: fadeInScene 1.2s ease-out;
}

@keyframes fadeInScene {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
  text-transform: lowercase;
  opacity: 0;
  animation: titleReveal 1s ease-out 0.3s forwards;
}

@keyframes titleReveal {
  0% {
    opacity: 0;
    letter-spacing: 0.4em;
  }
  100% {
    opacity: 1;
    letter-spacing: 0.2em;
  }
}

/* ═══════════════════════════════════════
   IMAGE PRESENTATION — SLIDE MOUNT
   ═══════════════════════════════════════ */

.image-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  max-height: calc(100vh - 11rem);
  position: relative;
}

/* The slide mount frame */
.image-container .slide-mount {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: projectorOn 0.8s ease-out 0.5s both;
}

@keyframes projectorOn {
  0% {
    opacity: 0;
    transform: scale(0.96);
    filter: brightness(0.3) saturate(0);
  }
  60% {
    filter: brightness(1.1) saturate(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1) saturate(1);
  }
}

.image-container img {
  max-width: min(85vw, 900px);
  max-height: calc(100vh - 14rem);
  object-fit: contain;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(200, 120, 50, 0.08),
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 0 120px rgba(200, 120, 50, 0.04);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Light leak accent — top-right corner */
.slide-mount::after {
  content: '';
  position: absolute;
  top: -10px;
  right: -10px;
  width: 80px;
  height: 80px;
  background: radial-gradient(
    circle at 70% 30%,
    rgba(200, 120, 50, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
  border-radius: 50%;
}

.image-container img.dissolving {
  opacity: 0;
  transform: scale(0.98);
}

.placeholder {
  color: var(--text-muted);
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  opacity: 0;
  animation: fadeInScene 1s ease-out 0.8s forwards;
}

/* ═══════════════════════════════════════
   INFO BAR — VIEWFINDER HUD
   ═══════════════════════════════════════ */

.info-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.2rem;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  color: var(--amber);
  text-shadow: 0 0 10px var(--amber-glow);
  opacity: 0;
  animation: hudReveal 0.8s ease-out 0.7s forwards;
  position: relative;
}

@keyframes hudReveal {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Corner brackets around the info bar */
.info-bar::before,
.info-bar::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: rgba(200, 120, 50, 0.2);
  border-style: solid;
}

.info-bar::before {
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 1px 0 0 1px;
}

.info-bar::after {
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  border-width: 0 1px 1px 0;
}

.info-bar .timestamp-stamp,
.info-bar .countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
}

.info-bar .divider {
  color: rgba(200, 120, 50, 0.2);
  font-size: 1.2rem;
  user-select: none;
}

.countdown-label {
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-shadow: none;
}

/* Blinking rec-style dot */
.countdown-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber-glow);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--amber-glow); }
  50% { opacity: 0.2; box-shadow: 0 0 2px var(--amber-glow); }
}

/* ═══════════════════════════════════════
   SECRET ADMIN DOT
   ═══════════════════════════════════════ */

.admin-dot {
  position: fixed;
  bottom: 14px;
  right: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(168, 154, 130, 0.15);
  cursor: pointer;
  z-index: 10000;
  border: none;
  padding: 0;
  transition: all 0.4s ease;
  outline: none;
}

.admin-dot:hover {
  background: rgba(168, 154, 130, 0.5);
  width: 8px;
  height: 8px;
  box-shadow: 0 0 12px rgba(168, 154, 130, 0.2);
}

/* ═══════════════════════════════════════
   LOGIN MODAL
   ═══════════════════════════════════════ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 8, 5, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
  animation: overlayIn 0.3s ease-out;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5rem;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.35s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  margin-bottom: 1.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus {
  border-color: rgba(200, 120, 50, 0.4);
  box-shadow: 0 0 0 3px rgba(200, 120, 50, 0.08);
}

.form-group input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.modal .btn-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
}

.btn:hover {
  background: var(--amber-soft);
  border-color: rgba(200, 120, 50, 0.3);
  color: var(--text-primary);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: rgba(200, 120, 50, 0.12);
  border-color: rgba(200, 120, 50, 0.25);
  color: var(--amber);
}

.btn-primary:hover {
  background: rgba(200, 120, 50, 0.2);
  border-color: rgba(200, 120, 50, 0.4);
}

.error-msg {
  color: var(--red-soft);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════
   ADMIN VIEW
   ═══════════════════════════════════════ */

.admin-view {
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 2.5rem;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.admin-view.active {
  display: block;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
  animation: fadeSlideDown 0.5s ease-out;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

/* Upload area */
.upload-area {
  border: 1.5px dashed var(--border);
  border-radius: 6px;
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 2.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  animation: fadeSlideDown 0.5s ease-out 0.1s both;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--amber-soft), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.upload-area:hover::before,
.upload-area.dragover::before {
  opacity: 1;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: rgba(200, 120, 50, 0.3);
}

.upload-area .upload-icon {
  font-size: 1.8rem;
  margin-bottom: 0.6rem;
  opacity: 0.5;
  display: block;
}

.upload-area p {
  color: var(--text-muted);
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-weight: 300;
  margin-bottom: 0.3rem;
  position: relative;
}

.upload-area .upload-hint {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  font-style: normal;
  color: var(--text-muted);
  opacity: 0.6;
  letter-spacing: 0.05em;
}

.upload-area input[type="file"] {
  display: none;
}

/* Upload progress indicator */
.upload-area.uploading {
  pointer-events: none;
}

.upload-area.uploading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber-glow);
  animation: uploadProgress 1.5s ease-in-out infinite;
}

@keyframes uploadProgress {
  0% { width: 0%; left: 0; }
  50% { width: 60%; }
  100% { width: 0%; left: 100%; }
}

/* Image grid */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  animation: fadeSlideDown 0.5s ease-out 0.2s both;
}

.image-card {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-surface);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: cardReveal 0.4s ease-out both;
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.image-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  transition: filter 0.3s ease;
}

.image-card:hover img {
  filter: brightness(0.7);
}

.image-card .card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.8rem 0.6rem 0.6rem;
  background: linear-gradient(transparent, rgba(10, 8, 5, 0.85));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  opacity: 0;
  transform: translateY(4px);
  transition: all 0.25s ease;
}

.image-card:hover .card-overlay {
  opacity: 1;
  transform: translateY(0);
}

.image-card .card-overlay span {
  color: var(--cream-soft);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
  letter-spacing: 0.03em;
}

.image-card .card-overlay button {
  background: rgba(139, 94, 94, 0.6);
  border: 1px solid rgba(139, 94, 94, 0.3);
  color: var(--cream-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.image-card .card-overlay button:hover {
  background: rgba(139, 94, 94, 0.9);
  border-color: rgba(139, 94, 94, 0.6);
}

/* ═══════════════════════════════════════
   ADMIN MODE TOGGLING
   ═══════════════════════════════════════ */

body.admin-mode {
  overflow: auto;
  background: var(--bg-deep);
}

body.admin-mode .public-view {
  display: none;
}

body.admin-mode .admin-view {
  display: block;
}

body.admin-mode .admin-dot {
  display: none;
}

/* ═══════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 640px) {
  .public-view {
    padding: 1.5rem 1rem;
  }

  .site-title {
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
  }

  .image-container img {
    max-width: 95vw;
    max-height: calc(100vh - 12rem);
  }

  .info-bar {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .info-bar .timestamp-stamp,
  .info-bar .countdown {
    font-size: 1.05rem;
  }

  .info-bar::before,
  .info-bar::after {
    display: none;
  }

  .admin-view {
    padding: 1.5rem;
  }

  .admin-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .upload-area {
    padding: 1.8rem 1.2rem;
  }
}

@media (max-width: 380px) {
  .info-bar .timestamp-stamp,
  .info-bar .countdown {
    font-size: 0.9rem;
  }

  .image-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 300;
  font-size: 1.1rem;
}
