/* Hope & Despair — Image Uploader */

:root {
  --bg:     #2d3b2a;
  --cream:  #e8dfc8;
  --olive:  #3d5239;
  --muted:  rgba(232, 223, 200, 0.45);
  --border: rgba(232, 223, 200, 0.2);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  font-family: 'Jost', sans-serif;
  color: var(--cream);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* ==============================
   SCREENS
   ============================== */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  gap: 1.5rem;
}

.screen.active {
  display: flex;
}

/* ==============================
   TYPOGRAPHY
   ============================== */
h1 {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  line-height: 1;
}

h2 {
  font-size: 1.1rem;
  font-weight: 200;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
  color: var(--muted);
}

p.subtitle {
  font-size: 0.85rem;
  font-weight: 200;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* ==============================
   UPLOAD ZONE
   ============================== */
.upload-zone {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2.5rem 2rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: rgba(232, 223, 200, 0.55);
  background: rgba(232, 223, 200, 0.04);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-zone-icon {
  width: 32px;
  height: 32px;
  opacity: 0.4;
}

.upload-zone-label {
  font-size: 0.8rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.upload-zone-filename {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--cream);
  opacity: 0;
  transition: opacity 0.3s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone-filename.visible {
  opacity: 1;
}

/* ==============================
   BUTTONS
   ============================== */
.primary-btn {
  font-family: 'Jost', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--border);
  padding: 0.75rem 2rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  border-radius: 1px;
  width: 100%;
}

.primary-btn:hover {
  border-color: var(--cream);
  color: var(--cream);
}

.primary-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==============================
   LOADING SCREEN
   ============================== */
.loading-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(232, 223, 200, 0.15);
  position: relative;
  animation: pulse-ring 2.4s ease-out infinite;
}

.loading-pulse::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(232, 223, 200, 0.12);
  animation: pulse-core 2.4s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%   { border-color: rgba(232, 223, 200, 0.15); transform: scale(1); }
  50%  { border-color: rgba(232, 223, 200, 0.35); transform: scale(1.08); }
  100% { border-color: rgba(232, 223, 200, 0.15); transform: scale(1); }
}

@keyframes pulse-core {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

.loading-text {
  font-size: 0.78rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
  max-width: 300px;
  transition: opacity 0.4s;
}

.queue-status {
  font-size: 0.68rem;
  font-weight: 200;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 223, 200, 0.3);
  margin: 0;
  min-height: 1em;
}

.queue-status:empty {
  display: none;
}

.progress-bar {
  width: 100%;
  height: 1px;
  background: var(--border);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.4s;
}

.progress-bar.active {
  opacity: 1;
}

.progress-fill {
  height: 100%;
  width: 35%;
  background: var(--muted);
  transform: translateX(-100%);
  animation: progress-scan 1.8s ease-in-out infinite;
}

@keyframes progress-scan {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(386%); }
}

/* ==============================
   SUCCESS SCREEN
   ============================== */
.blob-wrapper {
  filter: url(#organic-blob);
  opacity: 0;
  animation: fadeIn 1.4s forwards ease-out;
}

.circle-clip {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
}

.circle-clip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

#title-text {
  font-size: 0.85rem;
  font-weight: 200;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
  padding: 0 1rem;
  word-break: break-word;
}

audio {
  width: 100%;
  filter: invert(1) sepia(0.2) hue-rotate(60deg) brightness(0.85);
  opacity: 0.75;
  border-radius: 2px;
}

.metadata-link {
  font-size: 0.7rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.metadata-link:hover {
  color: var(--cream);
}

/* ==============================
   ERROR SCREEN
   ============================== */
#screen-error h2 {
  font-weight: 400;
  color: var(--cream);
  letter-spacing: 0.08em;
}

#error-message {
  font-size: 0.8rem;
  font-weight: 200;
  color: var(--muted);
  margin: 0;
}

/* ==============================
   DEBUG TOGGLE (hidden by default)
   ============================== */
.fake-toggle {
  display: none;
}
