/* PUB Rescue — visual language mirrors maconapps.com:
   dark #1c1c1c, orange accent #d2711f, Georgia display headings,
   uppercase letter-spaced buttons, white content surfaces. */
:root {
  --dark: #1c1c1c;
  --light: #fafafa;
  --white: #ffffff;
  --accent: #d2711f;
  --accent-dark: #b45f16;
  --accent-soft: #fbf1e8;
  --accent-line: #f0d7c0;
  --ink: #1c1c1c;
  --muted: #666666;
  --line: #e5e5e5;
  --panel: #f5f5f5;
  --danger: #b3372f;
  --font: 'Georgia', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1100px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ---- top nav (matches maconapps.com header) ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 2rem;
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--dark); text-decoration: none; }
.brand-icon { width: 40px; height: 40px; display: block; }
.brand h1 { margin: 0; white-space: nowrap; font-family: var(--font); font-size: 1.25rem; font-weight: bold; letter-spacing: .02em; line-height: 1.1; }
.brand .by { margin: 0; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.brand .by a { color: var(--muted); text-decoration: none; }
.brand .by a:hover { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.privacy-badge {
  font-size: .78rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent); border: 2px solid var(--accent);
  padding: .4rem 1rem; white-space: nowrap; text-decoration: none;
}
.nav-link { font-size: .875rem; color: var(--dark); text-decoration: none; }
.nav-link:hover { opacity: .6; }
.pb-short { display: none; }
@media (max-width: 640px) {
  .topbar-inner { padding: 0 1rem; height: 56px; }
  .brand-icon { width: 34px; height: 34px; }
  .brand h1 { font-size: 1.1rem; }
  .nav-link { display: none; }
  .privacy-badge { font-size: .68rem; padding: .3rem .6rem; }
  .pb-full { display: none; }
  .pb-short { display: inline; }
}

/* ---- hero + drop zone ---- */
.hero {
  background: var(--dark); color: var(--light);
  padding: 4rem 2rem 3.5rem;
}
.hero-inner { max-width: var(--max-width); margin: 0 auto; }
.hero-accent { width: 64px; height: 4px; background: var(--accent); margin-bottom: 1.25rem; }
.hero h2 {
  font-family: var(--font); font-weight: normal; line-height: 1.1;
  font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 .75rem; max-width: 760px;
}
.hero p.lead { margin: 0 0 2rem; font-size: 1.1rem; color: #ccc; max-width: 700px; }

.drop-zone {
  border: 2px dashed #555;
  background: #242424;
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  outline: none;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragover {
  border-color: var(--accent);
  background: #2a2521;
}
.drop-icon { width: 56px; height: 56px; margin: 0 auto 6px; display: block; }
.drop-title { font-family: var(--font); font-size: 1.5rem; margin: 6px 0 4px; color: var(--white); }
.drop-title strong { color: var(--accent); font-weight: normal; }
.drop-sub { color: #bbb; margin: 0 0 18px; font-size: .95rem; }

.why { max-width: var(--max-width); margin: 0 auto; padding: 3rem 2rem 1rem; }
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem; }
.why h3 {
  font-size: .9rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin: 0 0 .5rem;
}
.why p { margin: 0; font-size: .95rem; color: #444; line-height: 1.7; }
.why .fineprint { margin-top: 2rem; font-size: .85rem; color: var(--muted); }
.why-icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: .75rem; display: block; }

/* ---- workspace ---- */
main { max-width: var(--max-width); margin: 0 auto; padding: 24px 2rem 60px; }
@media (max-width: 640px) { main { padding: 16px 1rem 40px; } .hero { padding: 2.5rem 1rem 2rem; } .why { padding: 2rem 1rem 1rem; } }

#workspace { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
@media (max-width: 800px) { #workspace { grid-template-columns: 1fr; } }

.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-list-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 0 2px 4px;
}
.file-item {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  position: relative;
  border-left: 3px solid transparent;
}
.file-item:hover { border-color: #ccc; }
.file-item.active { border-left-color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); border-left-color: var(--accent); }
.file-item .fi-name { font-weight: 600; word-break: break-all; padding-right: 22px; }
.file-item .fi-meta { color: var(--muted); font-size: 12px; }
.file-item .fi-err { color: var(--danger); font-size: 12px; }
.file-item .fi-remove {
  position: absolute; top: 6px; right: 6px; border: none; background: none;
  color: #999; font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 5px;
}
.file-item .fi-remove:hover { color: var(--danger); }

.viewer {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 18px 20px 24px;
  min-width: 0;
}
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.viewer-head h2 { margin: 0; font-family: var(--font); font-weight: normal; font-size: 1.35rem; word-break: break-all; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; overflow-x: auto; }
.tab {
  border: none; background: none; padding: 8px 14px; font-size: .8rem; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; font-family: var(--font-sans);
}
.tab:hover { color: var(--dark); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-actions { margin-bottom: 12px; display: flex; gap: 8px; flex-wrap: wrap; }

.text-out {
  white-space: pre-wrap;
  font-size: 15px;
  font-family: var(--font);
  background: var(--light);
  border: 1px solid var(--line);
  padding: 20px 22px;
  max-height: 60vh;
  overflow: auto;
  line-height: 1.65;
}
.text-out .tb { margin-bottom: 16px; }
.text-out .empty, .gallery .empty { color: var(--muted); font-style: italic; font-family: var(--font-sans); }

.gallery { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery figure {
  margin: 0; border: 1px solid var(--line); padding: 8px;
  background: var(--light); max-width: 220px;
}
.gallery img { max-width: 200px; max-height: 160px; display: block; }
.gallery figcaption { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.gallery .vector-chip {
  width: 200px; height: 80px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; background: #ececec; text-align: center;
}

.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.export-card {
  border: 1px solid var(--line); padding: 16px 18px; background: var(--light);
  display: flex; flex-direction: column;
}
.export-card h3 {
  margin: 0 0 6px; font-size: .85rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.export-card h3 svg { width: 20px; height: 20px; color: var(--accent); }
.export-card p { margin: 0 0 14px; font-size: 13px; color: #555; flex: 1; }

.batch-box {
  margin-top: 18px; border: 1px solid var(--accent-line); background: var(--accent-soft);
  padding: 16px 18px;
}
.batch-box h3 { margin: 0 0 4px; font-size: .85rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.batch-box p { margin: 0 0 12px; font-size: 13.5px; color: #444; }

.details-out { font-size: 13px; }
.details-out table { border-collapse: collapse; width: 100%; }
.details-out td, .details-out th {
  border-bottom: 1px solid var(--line); text-align: left; padding: 6px 8px; font-size: 12.5px;
}
.details-out th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.details-out .warn { color: var(--danger); }
.details-wrap { overflow-x: auto; }

/* ---- buttons / toast ---- */
.btn {
  display: inline-block; font-family: var(--font-sans);
  font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  border: 2px solid var(--dark); background: transparent; color: var(--dark);
  padding: .55rem 1.2rem; cursor: pointer; text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn:disabled, .btn-primary:disabled { opacity: .5; cursor: wait; }
.btn-light { border-color: var(--white); color: var(--white); }
.btn-light:hover { background: var(--white); border-color: var(--white); color: var(--dark); }
.btn-small { padding: .35rem .8rem; font-size: .72rem; }
.btn-ghost { border-color: transparent; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--dark); color: #fff; padding: 10px 18px; border-left: 4px solid var(--accent);
  font-size: 13.5px; box-shadow: 0 4px 18px rgba(0,0,0,.25); z-index: 200; max-width: 90vw;
}

/* ---- footer (matches maconapps.com) ---- */
footer {
  background: var(--dark); color: #888; border-top: 1px solid #333;
  padding: 2rem; text-align: center; font-size: .8rem; line-height: 1.8;
}
footer a { color: #bbb; text-decoration: none; }
footer a:hover { color: var(--accent); }
footer .foot-links { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: .5rem; }
footer .foot-logo { height: 64px; width: auto; display: block; margin: 0 auto 1rem; opacity: .9; }

@media print {
  .topbar, .hero, .why, .file-list, .tabs, .toolbar, .panel-actions, footer, .toast, #proBadge { display: none !important; }
  main { padding: 0; max-width: none; }
  #workspace { display: block; }
  .viewer { border: none; padding: 0; }
  .text-out { max-height: none; border: none; background: none; padding: 0; }
  .viewer-head h2 { font-size: 18pt; margin-bottom: 12pt; }
}
