/* ============================================================
   Fast Private PDF Tools — shared styles
   Editorial brutalism: serif display, paper palette, hard shadows
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,700;9..144,900&family=Geist:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --ink: #0e0f0c;
  --paper: #f4f1ea;
  --cream: #faf7f0;
  --moss: #3f4a2c;
  --clay: #c45f3c;
  --rust: #8a3a1f;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}

main, header, footer { position: relative; z-index: 2; }

/* ---------- Typography ---------- */
.display { font-family: "Fraunces", Georgia, serif; font-weight: 900; letter-spacing: -0.02em; line-height: 0.95; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: rgba(14, 15, 12, 0.6);
}
.text-clay { color: var(--clay); }

/* ---------- Layout ---------- */
.container { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* ---------- Privacy ticker ---------- */
.ticker {
  background: var(--ink);
  color: var(--cream);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
}
.ticker-track {
  display: flex;
  white-space: nowrap;
  padding: 0.5rem 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  animation: ticker 30s linear infinite;
}
.ticker-track > div { display: flex; flex-shrink: 0; }
.ticker-track span { padding: 0 1.5rem; display: flex; align-items: center; gap: 0.75rem; }
.ticker-track .star { color: var(--clay); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}
.logo {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.logo .dot { color: var(--clay); }
.logo small {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(14, 15, 12, 0.6);
}
@media (max-width: 600px) { .logo small { display: none; } }

.nav { display: flex; gap: 0.5rem; flex-wrap: nowrap; }
.nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 14px;
  padding: 0.5rem 0.75rem;
  transition: background 120ms, color 120ms;
  white-space: nowrap;          /* keep "Image → PDF" on one line */
}
.nav a:hover { background: var(--ink); color: var(--cream); }

/* Tablet & smaller: tighten spacing so 5 links fit without wrapping */
@media (max-width: 900px) {
  .nav { gap: 0.125rem; }
  .nav a { padding: 0.5rem 0.5rem; font-size: 13px; }
}

/* ---------- Mobile horizontal-scroll nav ----------
   Only visible on phones. No toggle, no dropdown — just a
   horizontally scrollable strip of tool links. Standard pattern
   used by Twitter/Spotify/YouTube. Always visible. Always works. */
.mobile-nav { display: none; }

@media (max-width: 640px) {
  /* Hide the inline desktop nav on phones */
  .nav { display: none; }

  /* Show the horizontal scroll strip */
  .mobile-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    border-top: 1px solid rgba(14, 15, 12, 0.15);
    background: var(--cream);
    /* Hide scrollbar but keep scrollable */
    scrollbar-width: none;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }

  .mobile-nav a {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 0.5rem 0.875rem;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    -webkit-tap-highlight-color: rgba(196, 95, 60, 0.3);
  }
  .mobile-nav a:active {
    background: var(--ink);
    color: var(--cream);
  }
  /* Highlight the current page if its href matches */
  .mobile-nav a[aria-current="page"] {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--cream);
  border-top: 1px solid var(--ink);
  margin-top: 4rem;
}
.site-footer .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2.5rem 1.5rem;
}
@media (min-width: 640px) { .site-footer .grid { grid-template-columns: repeat(3, 1fr); } }
.site-footer p { color: rgba(14, 15, 12, 0.7); line-height: 1.6; font-size: 14px; }
.site-footer ul { list-style: none; }
.site-footer ul li { margin-bottom: 0.25rem; }
.site-footer ul a { color: var(--ink); font-size: 14px; }
.site-footer ul a:hover { text-decoration: underline; }
.site-footer .strip {
  border-top: 1px solid rgba(14, 15, 12, 0.2);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(14, 15, 12, 0.6);
}

/* ---------- Main ---------- */
main {
  min-height: 70vh;
  padding: 2rem 0;
}
@media (min-width: 640px) { main { padding: 3rem 0; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--ink);
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 150ms;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 3px 3px 0 0 var(--ink);
  text-decoration: none;
  text-align: center;
}
.btn:hover:not(:disabled) {
  background: var(--clay);
  border-color: var(--clay);
  box-shadow: none;
  transform: translate(3px, 3px);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  transform: none;
}

.btn-small {
  padding: 0.75rem 1.25rem;
  font-size: 14px;
  font-family: "Geist", sans-serif;
  font-weight: 500;
}

/* ---------- Cards & shadows ---------- */
.card {
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 2rem;
}
.shadow-brutal { box-shadow: 6px 6px 0 0 var(--ink); }
.shadow-brutal-clay { box-shadow: 6px 6px 0 0 var(--clay); }

/* ---------- Upload box ---------- */
.upload-box {
  position: relative;
  cursor: pointer;
  border: 2px dashed var(--ink);
  background: var(--cream);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 150ms;
}
@media (min-width: 640px) { .upload-box { padding: 3rem 1.5rem; } }
.upload-box:hover, .upload-box.drag-active {
  border-color: var(--clay);
  background: rgba(196, 95, 60, 0.05);
  box-shadow: 6px 6px 0 0 var(--clay);
  transform: translate(-3px, -3px);
}
.upload-box input { display: none; }
.upload-box h2 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.75rem;
  margin: 1rem 0 0.75rem;
  line-height: 1.1;
}
@media (min-width: 640px) { .upload-box h2 { font-size: 2.25rem; } }
.upload-box .hint {
  color: rgba(14, 15, 12, 0.6);
  font-size: 14px;
  max-width: 28rem;
  margin: 0 auto;
}
.upload-box .browse {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--cream);
  font-weight: 500;
  font-size: 14px;
  margin-top: 1.5rem;
}

/* ---------- File preview list ---------- */
.file-list { margin-top: 1.5rem; list-style: none; }
.file-list .meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(14, 15, 12, 0.6);
  margin-bottom: 0.75rem;
}
.file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  cursor: move;
  transition: box-shadow 120ms;
}
.file-row:hover { box-shadow: 3px 3px 0 0 var(--ink); }
.file-row.dragging { opacity: 0.4; }
.file-row .idx {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  font-family: "JetBrains Mono", monospace;
}
.file-row .idx .num { font-size: 11px; color: rgba(14, 15, 12, 0.4); }
.file-row .idx .grip { color: rgba(14, 15, 12, 0.4); font-size: 18px; line-height: 1; }
.file-row .thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border: 1px solid var(--ink);
  object-fit: cover;
}
.file-row .thumb.placeholder {
  background: var(--ink);
  color: var(--cream);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-row .info { flex: 1; min-width: 0; }
.file-row .info .name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-row .info .size {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(14, 15, 12, 0.5);
}
.file-row .moves { display: flex; flex-direction: column; gap: 2px; }
.file-row .moves button {
  width: 32px;
  height: 24px;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-size: 11px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.file-row .moves button:hover:not(:disabled) { background: var(--ink); color: var(--cream); }
.file-row .moves button:disabled { opacity: 0.3; cursor: not-allowed; }
.file-row .remove {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--paper);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: all 120ms;
}
.file-row .remove:hover {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--cream);
}

/* ---------- Action buttons ---------- */
.actions {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 640px) { .actions { flex-direction: row; } }
.actions .btn { flex: 1; }

/* ---------- Progress bar ---------- */
.progress {
  margin-top: 1rem;
}
.progress-track {
  height: 12px;
  border: 2px solid var(--ink);
  background: var(--cream);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--clay);
  width: 0%;
  transition: width 200ms ease-out;
}
.progress-label {
  margin-top: 0.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(14, 15, 12, 0.6);
  text-align: right;
}

/* ---------- Spinner inside button ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--cream);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Success card ---------- */
.success {
  margin-top: 1.5rem;
  background: var(--ink);
  color: var(--cream);
  padding: 1.25rem;
  border: 2px solid var(--clay);
  box-shadow: 6px 6px 0 0 var(--clay);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  animation: slideUp 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.success .check { color: var(--clay); font-size: 1.5rem; }
.success h3 { font-family: "Fraunces", serif; font-weight: 900; font-size: 1.25rem; }
.success p { color: rgba(250, 247, 240, 0.7); font-size: 14px; margin-top: 0.25rem; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--cream);
  border: 2px solid var(--clay);
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: slideUp 300ms ease-out;
  max-width: 90vw;
}
.toast.error { border-color: var(--rust); }

/* ---------- Page sections ---------- */
section { padding: 3rem 0; }
section.bordered { border-top: 1px solid var(--ink); }

h1.hero {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 2.75rem;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
@media (min-width: 640px) { h1.hero { font-size: 4rem; } }
@media (min-width: 1024px) { h1.hero { font-size: 5rem; } }

h2.section-title {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.75rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) { h2.section-title { font-size: 2.5rem; } }

.lead {
  margin-top: 1.5rem;
  font-size: 1.125rem;
  color: rgba(14, 15, 12, 0.8);
  max-width: 36rem;
  line-height: 1.6;
}

/* ---------- FAQ ---------- */
.faq-list {
  list-style: none;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.faq-item { border-bottom: 1px solid rgba(14, 15, 12, 0.2); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  padding: 1.25rem 0.25rem;
  cursor: pointer;
  text-align: left;
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--ink);
  transition: background 120ms;
}
@media (min-width: 640px) { .faq-q { font-size: 1.25rem; } }
.faq-q:hover { background: var(--cream); }
.faq-q .plus {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.25rem;
  color: var(--clay);
  transition: transform 200ms;
  flex-shrink: 0;
  margin-left: 1rem;
}
.faq-item.open .faq-q .plus { transform: rotate(45deg); }
.faq-a {
  display: none;
  padding: 0 0.25rem 1.25rem;
  color: rgba(14, 15, 12, 0.8);
  line-height: 1.6;
  max-width: 48rem;
}
.faq-item.open .faq-a { display: block; }

/* ---------- Steps ---------- */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  list-style: none;
}
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step {
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 1.5rem;
}
.step .num {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(14, 15, 12, 0.6);
  margin-bottom: 0.5rem;
}
.step h3 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}
.step p { color: rgba(14, 15, 12, 0.7); font-size: 14px; line-height: 1.6; }

/* ---------- Benefits / why grid ---------- */
.benefits {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 768px) { .benefits { grid-template-columns: repeat(3, 1fr); } }
.benefit {
  border-left: 2px solid var(--clay);
  padding-left: 1.25rem;
}
.benefit h3 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}
.benefit p { color: rgba(14, 15, 12, 0.7); line-height: 1.6; }

.benefit-large h3 {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 3rem;
  color: var(--clay);
  margin-bottom: 0.75rem;
}
.benefit-large p { color: rgba(14, 15, 12, 0.7); line-height: 1.6; }

/* ---------- Prose links ---------- */
.prose a { color: var(--clay); font-weight: 500; }
.prose p { margin-bottom: 1rem; line-height: 1.6; color: rgba(14, 15, 12, 0.8); max-width: 48rem; }
.prose strong { color: var(--ink); font-weight: 700; }

/* ---------- Focus ---------- */
*:focus-visible { outline: 3px solid var(--clay); outline-offset: 3px; }

/* ============================================================
   Single-file tool UI: file chip, controls panel, presets
   ============================================================ */

.file-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--cream);
  border: 2px solid var(--ink);
  padding: 0.75rem;
  margin-top: 1.5rem;
}
.file-chip .thumb {
  width: 56px; height: 56px;
  flex-shrink: 0;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-chip .info { flex: 1; min-width: 0; }
.file-chip .info .name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-chip .info .size {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(14, 15, 12, 0.5);
}

.controls-panel {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 2px solid var(--ink);
  background: var(--cream);
}
.controls-panel .label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(14, 15, 12, 0.6);
  margin-bottom: 0.75rem;
}
.controls-panel input[type="text"] {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  color: var(--ink);
}
.controls-panel input[type="text"]:focus { outline: none; border-color: var(--clay); }
.controls-panel .help {
  margin-top: 0.5rem;
  font-size: 13px;
  color: rgba(14, 15, 12, 0.6);
}
.controls-panel .help code {
  font-family: "JetBrains Mono", monospace;
  background: var(--paper);
  padding: 1px 5px;
  border: 1px solid rgba(14, 15, 12, 0.2);
  font-size: 12px;
}

/* Preset picker (compress) */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 640px) { .preset-grid { grid-template-columns: repeat(3, 1fr); } }
.preset-card {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 1.25rem;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 150ms;
}
.preset-card:hover { box-shadow: 3px 3px 0 0 var(--ink); transform: translate(-2px, -2px); }
.preset-card.active {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 3px 3px 0 0 var(--clay);
  transform: translate(-2px, -2px);
}
.preset-card .name {
  font-family: "Fraunces", serif;
  font-weight: 900;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
.preset-card .desc {
  font-size: 13px;
  opacity: 0.75;
  line-height: 1.4;
}
.preset-card .badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 0.5rem;
  color: var(--clay);
}
.preset-card.active .badge { color: var(--clay); }

/* Size comparison strip (compress success) */
.size-compare {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
}
.size-compare .from { text-decoration: line-through; opacity: 0.5; }
.size-compare .arrow { color: var(--clay); }
.size-compare .to { color: var(--clay); font-weight: 700; }
.size-compare .saved {
  margin-left: auto;
  background: var(--clay);
  color: var(--cream);
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
