/* ── RESET & VARIABLES ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0f;
  --surface:   #13131a;
  --surface2:  #1c1c28;
  --border:    #2a2a3d;
  --accent:    #00f5c4;
  --accent2:   #7b61ff;
  --text:      #e8e8f0;
  --text-muted:#7a7a99;
  --radius:    12px;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'DM Sans', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── HEADER ── */
header {
  width: 100%;
  text-align: center;
  padding: 1.8rem 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.logo-bracket { color: var(--accent2); }
.logo-accent  { color: var(--accent); }

.tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.2em;
  margin-top: 0.3rem;
  text-transform: uppercase;
}

.byline {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 0.4rem;
  letter-spacing: 0.05em;
}

.byline-name {
  color: var(--accent);
  font-weight: 700;
}

/* ── MAIN ── */
main {
  width: 100%;
  max-width: 1200px;
  padding: 0 1.5rem 3rem;
  flex: 1;
}

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s, background 0.25s;
  cursor: pointer;
  max-width: 600px;
  margin: 0 auto;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: #00f5c408;
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 5rem 2rem;
}

.upload-icon {
  font-size: 2.8rem;
  color: var(--accent);
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.upload-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.upload-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ── WORKSPACE: side by side ── */
.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

/* ── LEFT PANEL ── */
.panel-left {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1.5rem;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.vs {
  color: var(--accent);
  font-size: 0.72rem;
}

.active-effect-label {
  background: var(--accent);
  color: #000;
  font-size: 0.65rem;
  padding: 2px 9px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

/* Effect buttons — 2 columns in the left panel */
.effects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.effect-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.85rem 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.18s;
}

.effect-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #00f5c40d;
  transform: translateY(-2px);
}

.effect-btn.active {
  border-color: var(--accent);
  background: #00f5c420;
  color: var(--accent);
  box-shadow: 0 0 14px #00f5c428;
}

.effect-icon { font-size: 1.25rem; }

.effect-name {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Actions at bottom of left panel */
.actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.btn-reset, .btn-download {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn-reset {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-reset:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.btn-download {
  background: var(--accent);
  color: #000;
}
.btn-download:hover {
  background: #00e0b0;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px #00f5c438;
}

/* ── RIGHT PANEL ── */
.panel-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

/* Placeholder before any effect is chosen */
.viewer-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  padding: 4rem 2rem;
}

.placeholder-icon {
  font-size: 2rem;
  opacity: 0.3;
  animation: point 1.5s ease-in-out infinite;
}

@keyframes point {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(-8px); }
}

/* ── LOADER ── */
.loader {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── VIEWER ── */
.viewer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

/* ─────────────────────────────────────────────────────
   COMPARE WRAPPER — THE SLIDER FIX
   
   Key insight: both images must be the same size and
   perfectly overlapping. We use a single shared height
   driven by the after-image, and the before-image is
   position:absolute filling the same space exactly.
───────────────────────────────────────────────────── */
.compare-wrapper {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
  background: #000;
  /* Height is determined naturally by compare-after img */
}

/* AFTER image — sits in normal flow, sets the box height */
.compare-after {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  object-position: center;
}

/* BEFORE clip container — overlaps after image exactly */
.compare-before-clip {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;        /* JS updates this % */
  height: 100%;
  overflow: hidden;
}

/* BEFORE image — must be identical size/position to after */
.compare-before {
  position: absolute;
  top: 0;
  left: 0;
  /* JS sets explicit px width to match compare-wrapper width */
  height: auto;
  max-height: 520px;
  object-fit: contain;
  object-position: center;
  display: block;
}

/* Drag handle line + circle */
.compare-handle {
  position: absolute;
  top: 0;
  left: 50%;              /* JS updates this */
  transform: translateX(-50%);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.handle-line {
  flex: 1;
  width: 2px;
  background: var(--accent);
}

.handle-circle {
  width: 38px; height: 38px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 18px #00f5c450;
}

/* Corner labels */
.compare-label {
  position: absolute;
  bottom: 10px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  padding: 3px 9px;
  border-radius: 99px;
  pointer-events: none;
}
.left-label  { left: 10px; }
.right-label { right: 10px; }

/* ── FOOTER ── */
footer {
  width: 100%;
  padding: 1.25rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

footer strong {
  color: var(--accent);
}

.footer-tech {
  color: var(--accent2);
}

/* ── RESPONSIVE: stack on small screens ── */
@media (max-width: 700px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .panel-left {
    position: static;
  }
  .effects-grid {
    grid-template-columns: repeat(5, 1fr);
  }
  .actions {
    flex-direction: row;
  }
}