:root {
  --bg: #17181c;
  --surface: #1f2127;
  --surface-hover: #262933;
  --accent: #e8a33d;
  --accent-dim: #a97a34;
  --text-primary: #ecead9;
  --text-muted: #8b8d96;
  --success: #6fcf97;
  --border: #33353d;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

/* The hidden attribute should always mean "not visible, not in layout" —
   but if an element also has a class like .viewfinder-content that sets
   display:flex, that CSS rule beats the browser's default [hidden] styling.
   This rule fixes that by forcing display:none whenever [hidden] is set,
   regardless of what other classes are on the element. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 80px;
}

/* ---------- Footer ---------- */

.site-footer {
  width: 100%;
  text-align: center;
  padding: 24px 20px 0;
  margin-top: 20px;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: underline;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Header styles moved and expanded below in the "Header + main nav"
   section (Step 6b) — see that block for the current rules. */

/* ---------- Viewfinder / dropzone ---------- */

main {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.viewfinder {
  position: relative;
  width: 100%;
  min-height: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.viewfinder:hover,
.viewfinder.drag-over {
  background: var(--surface-hover);
  border-color: var(--accent-dim);
}

.viewfinder.drag-over {
  border-color: var(--accent);
}

/* Step 5: visible focus ring for keyboard users (Tab key navigation).
   Without this, someone tabbing through the page with a keyboard has
   no way to see which element is currently focused. */
.viewfinder:focus-visible,
.add-more-btn:focus-visible,
.convert-btn:focus-visible,
.download-btn:focus-visible,
.row-remove-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* corner brackets, viewfinder-style */
.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--accent);
  opacity: 0.85;
}

.corner-tl { top: 14px; left: 14px; border-top: 2px solid; border-left: 2px solid; }
.corner-tr { top: 14px; right: 14px; border-top: 2px solid; border-right: 2px solid; }
.corner-bl { bottom: 14px; left: 14px; border-bottom: 2px solid; border-left: 2px solid; }
.corner-br { bottom: 14px; right: 14px; border-bottom: 2px solid; border-right: 2px solid; }

.viewfinder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px;
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 18px;
}

.drop-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 8px;
}

.drop-sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

.drop-note {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
  margin: 4px 0 0;
}

/* ---------- File preview state ---------- */

.file-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 24px 28px;
}

.file-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.file-meta {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-details {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  margin: 0;
  letter-spacing: 0.02em;
}

.clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.clear-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ---------- Header + main nav ---------- */

.site-header {
  padding: 28px 20px 0;
  text-align: center;
}

.header-top {
  margin-bottom: 18px;
}

.logo {
  display: inline-block;
  line-height: 0; /* removes extra gap under inline images */
}

.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover {
  color: var(--accent);
}

.nav-caret {
  font-size: 10px;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  min-width: 200px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.nav-dropdown-menu.open {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
}

.nav-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
}

@media (max-width: 560px) {
  .main-nav {
    gap: 14px;
  }
}

.seo-intro {
  width: 100%;
  max-width: 640px;
  text-align: center;
  margin-bottom: 8px;
}

.seo-intro h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
}

.seo-intro p {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

.faq {
  width: 100%;
  max-width: 640px;
  margin: 36px auto 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h3 {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.faq-item p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}

.related-links {
  width: 100%;
  max-width: 640px;
  margin: 28px auto 40px;
  text-align: center;
}

.related-links-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.related-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  margin: 0 8px;
}

.related-links a:hover {
  text-decoration: underline;
}

/* ---------- Ad slots ---------- */
/* Reserved space only, for now. Kept visually quiet (thin dashed border,
   muted label) so it doesn't clash with the minimalist look — real ad
   network code drops in here later without needing any layout changes,
   since the container size stays the same. */
.ad-slot {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border: 1px dashed var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.ad-slot-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.5;
}

.ad-slot-top {
  height: 90px; /* standard leaderboard-ish height, common ad size */
  margin: 20px auto 0;
}

.ad-slot-bottom {
  height: 90px;
  margin-top: 32px;
}

@media (max-width: 560px) {
  .ad-slot {
    max-width: 100%;
    margin-left: 14px;
    margin-right: 14px;
    width: auto;
  }
}
/* Below this width, we're likely on a phone — file rows especially
   need to stack instead of squeezing everything into one line. */
@media (max-width: 560px) {
  .site-header {
    padding: 24px 16px 16px;
  }

  main {
    padding: 0 14px;
  }

  .viewfinder {
    padding: 24px 14px;
  }

  .file-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .file-row .file-meta {
    /* let name/details take a full row of their own on tiny screens
       instead of getting squashed between thumbnail and status pill */
    flex-basis: 100%;
    order: 3;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .format-select,
  .convert-btn {
    width: 100%;
  }
}

.file-list {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 14px;
}

.file-row img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  background: #000;
  flex-shrink: 0;
}

.file-row .file-meta {
  flex: 1;
  min-width: 0;
}

.file-row .file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.file-row .file-details {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

.file-row .file-status {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.file-row .file-status.pending {
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.file-row .file-status.converting {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}

.file-row .file-status.done {
  color: var(--success);
  border: 1px solid var(--success);
}

.file-row .file-status.skipped {
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.file-row .file-status.error {
  color: #ff6b6b;
  border: 1px solid #ff6b6b;
}

.file-row .row-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  flex-shrink: 0;
}

.file-row .row-remove-btn:hover {
  color: var(--text-primary);
}

.add-more-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
}

.add-more-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

/* ---------- Step 2: format picker + convert button ---------- */

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.control-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
}

.format-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.format-select:hover {
  border-color: var(--accent-dim);
}

.convert-btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.convert-btn:hover {
  background: var(--accent-dim);
}

.convert-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Step 2: result block ---------- */

.result {
  width: 100%;
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 4px;
  text-align: center;
}

.result-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-details {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--success);
  margin: 0;
}

.download-btn {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}

.download-btn:hover {
  background: var(--success);
  color: var(--bg);
}

/* ---------- Status line ---------- */

.status-line {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 20px;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .viewfinder { min-height: 260px; }
  .drop-label { font-size: 18px; }
  .file-preview { padding: 18px; }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
