/* ============================================================
   DESIGN SYSTEM — "The Filing System"
   Concept: a well-run office archive. Tools are index cards,
   color-coded by category like folder tabs, on warm paper stock.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  /* Color */
  --paper: #F6F4EF;
  --paper-raised: #FFFFFF;
  --ink: #202A33;
  --ink-soft: #5B6670;
  --ink-faint: #8B9399;
  --line: #DEDAD0;
  --line-strong: #C7C1B3;

  /* Category tab colors — structural, not decorative: each maps to a tool group */
  --tab-pdf: #B33A3A;
  --tab-image: #2F7A6B;
  --tab-convert: #4A5FA5;
  --tab-text: #C08A2E;

  --accent: #2F7A6B;
  --accent-ink: #FFFFFF;
  --danger: #B33A3A;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Radius / shadow — index-card feel: crisp, minimal radius */
  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(32,42,51,0.06), 0 1px 0 rgba(32,42,51,0.04);
  --shadow-card-hover: 0 6px 16px rgba(32,42,51,0.10), 0 2px 4px rgba(32,42,51,0.06);

  /* === NEW: Mobile spacing variables === */
  --body-padding: 16px;
  --shell-padding: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0 var(--body-padding); /* ← FIX: adds safe space */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: inherit; }

/* -------------------- Layout shell -------------------- */
.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--shell-padding);
  width: 100%;
}

/* ===== FIX: Header stretches full width, content stays safe ===== */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 calc(-1 * var(--body-padding)); /* Pulls to edge */
  padding: 0 var(--body-padding); /* Pushes content back */
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.logo__mark {
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--tab-pdf) 0 25%, var(--tab-image) 25% 50%, var(--tab-convert) 50% 75%, var(--tab-text) 75% 100%);
  flex-shrink: 0;
}

.nav-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 4px 8px;
  white-space: nowrap;
}

/* -------------------- Hero -------------------- */
.hero {
  padding: 64px 0 40px;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  max-width: 14ch;
}

.hero p {
  margin-top: 16px;
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 46ch;
}

/* -------------------- Search bar -------------------- */
.search-bar {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-raised);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 16px;
  max-width: 480px;
  transition: border-color 0.15s ease;
}

.search-bar:focus-within {
  border-color: var(--accent);
}

.search-bar svg { flex-shrink: 0; color: var(--ink-faint); }

.search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 15px;
  width: 100%;
  color: var(--ink);
}

.search-bar input::placeholder { color: var(--ink-faint); }

/* -------------------- Category filter chips -------------------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 28px 0 8px;
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.12s ease;
}

.filter-chip:hover { border-color: var(--ink-faint); }

.filter-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.filter-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* -------------------- Tool grid & cards -------------------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin: 28px 0 80px;
}

.tool-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-top: 3px solid var(--tab-color, var(--accent));
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.tool-card__punch {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line-strong);
}

.tool-card__icon {
  font-size: 22px;
  margin-bottom: 4px;
  color: var(--tab-color, var(--accent));
  display: inline-flex;
}

.tool-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
}

.tool-card__desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.tool-card__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: auto;
  padding-top: 10px;
}

/* -------------------- Section labels -------------------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 40px 0 4px;
}

/* ============================================================
   TOOL PAGE — FIXED: More top spacing
   ============================================================ */

.tool-page {
  padding: 48px 0 80px;  /* ← INCREASED from 40px to 48px */
}

.breadcrumb {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 24px;  /* ← INCREASED from 20px to 24px */
}

.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.tool-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;  /* ← INCREASED from 8px to 10px */
}

.tool-header__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--tab-color, var(--accent));
  color: white;
  flex-shrink: 0;
}

.tool-header h1 { font-size: 28px; }

.tool-page__desc {
  color: var(--ink-soft);
  font-size: 16px;
  margin: 12px 0 32px;  /* ← INCREASED from 10px to 12px */
  max-width: 60ch;
}

/* -------------------- Drop zone -------------------- */
.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--paper-raised);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #F0F7F5;
}

.dropzone__icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.dropzone__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

.dropzone__hint {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 8px;
}

.dropzone input[type="file"] { display: none; }

/* -------------------- File list -------------------- */
.file-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.file-row__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row__size { color: var(--ink-faint); }
.file-row__remove {
  cursor: pointer;
  color: var(--ink-faint);
  border: none;
  background: none;
  font-size: 16px;
  padding: 0 4px;
}
.file-row__remove:hover { color: var(--danger); }

/* -------------------- Options panel -------------------- */
.options-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.option-row + .option-row { border-top: 1px solid var(--line); }

.option-label {
  font-size: 14.5px;
  font-weight: 500;
}

.option-sublabel {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle-track::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::before { transform: translateX(18px); }

.text-input, .password-input, select {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  outline: none;
  width: 200px;
}

.text-input:focus, .password-input:focus, select:focus { border-color: var(--accent); }

/* -------------------- Buttons -------------------- */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
  justify-content: center;
  margin-top: 24px;
  padding: 15px 28px;
}

.btn-primary:hover:not(:disabled) { opacity: 0.92; }

/* -------------------- Status / result -------------------- */
.status {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 10px;
}

.status.visible { display: flex; }
.status.processing { background: #F0F0EA; color: var(--ink-soft); }
.status.success { background: #EAF4F1; color: #1F5A4C; }
.status.error { background: #FBEBEA; color: #8C2E2E; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink-soft);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.result-download {
  margin-top: 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--paper-raised);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.result-download.visible { display: flex; }

.result-download__name {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.result-download a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
}

/* ===== FIX: Footer stretches full width, content stays safe ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0 calc(-1 * var(--body-padding)); /* Pulls to edge */
  padding-left: var(--body-padding); /* Pushes content back */
  padding-right: var(--body-padding);
  margin-top: auto;
  background: var(--paper);
}

/* -------------------- Focus visibility -------------------- */
a:focus-visible, button:focus-visible, input:focus-visible, .dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE — Minimal padding on mobile
   ============================================================ */

@media (max-width: 640px) {
  :root {
    --body-padding: 12px;
    --shell-padding: 12px;
  }
  .hero { padding: 40px 0 24px; }
  .site-footer { flex-direction: column; gap: 6px; }
  .tool-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  
  /* ===== FIX: Tool page mobile spacing ===== */
  .tool-page {
    padding: 32px 0 60px;  /* ← INCREASED from 24px to 32px */
  }
  .tool-header h1 { font-size: 22px; }
  .tool-header__icon { width: 38px; height: 38px; font-size: 18px; }
  .tool-page__desc { font-size: 14px; }
  .breadcrumb { font-size: 12px; margin-bottom: 16px; }
}

@media (max-width: 400px) {
  :root {
    --body-padding: 10px;
    --shell-padding: 8px;
  }
  .tool-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tool-card { padding: 14px; }
  .tool-card__desc { font-size: 12px; }
  
  /* ===== FIX: Tool page small phone spacing ===== */
  .tool-page {
    padding: 24px 0 40px;
  }
  .tool-header h1 { font-size: 18px; }
  .tool-header__icon { width: 34px; height: 34px; font-size: 16px; }
  .tool-header { gap: 10px; }
}

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

/* -------------------- Footer policies -------------------- */
.footer-policies {
  margin-top: 30px;
  width: 100%;
}

.footer-policies details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.footer-policies details:last-child {
  border-bottom: 1px solid var(--line);
}

.footer-policies summary {
  cursor: pointer;
  font-weight: 600;
  padding: 8px 0;
}

.policy-content {
  padding: 15px 0;
  line-height: 1.6;
  max-width: 900px;
}

.policy-content h3,
.policy-content h4 {
  margin-top: 15px;
}

.footer-bottom {
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}