/* ============================================================
   PDF.Nulumia — Stax-style design
   Written from scratch — not based on JPG project CSS
   ============================================================ */

/* ── Tokens + Script-aware system font stack ─────────────────
   Resolution order (all system fonts — no external CDN):
   Latin/UI:   San Francisco, Segoe UI, Roboto (also covers Cyrillic, Greek, Vietnamese)
   CJK:        PingFang (macOS/iOS), Noto CJK (Linux/Android), MS fonts (Windows)
   Arabic:     Geeza Pro (macOS/iOS), Tahoma (Windows) — both support ligatures
   Devanagari: Kohinoor (macOS/iOS), Noto Devanagari (Linux), Mangal (Windows)
   Thai:       Noto Sans Thai (Linux/Docker), Thonburi (macOS/iOS), Leelawadee UI (Windows)
   ──────────────────────────────────────────────────────────── */
:root {
  --primary:    #2563EB;
  --primary-h:  #1D4ED8;
  --bg:         #FFFFFF;
  --bg-2:       #F8FAFC;
  --bg-dark:    #0F172A;
  --border:     #E2E8F0;
  --text:       #0F172A;
  --muted:      #64748B;
  --subtle:     #94A3B8;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.05);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-md:  0 8px 32px rgba(0,0,0,.10);
  --t:          .16s ease;
  --font-stack:
    -apple-system, BlinkMacSystemFont,
    'Inter', 'Segoe UI', Roboto,
    /* CJK */
    'PingFang SC', 'PingFang TC', 'Hiragino Sans',
    'Noto Sans CJK SC', 'Noto Sans CJK TC', 'Noto Sans CJK JP', 'Noto Sans CJK KR',
    'Microsoft YaHei', 'Microsoft JhengHei', Meiryo, 'Malgun Gothic',
    /* Arabic */
    'Geeza Pro', Tahoma, 'Arial Unicode MS',
    /* Devanagari */
    'Kohinoor Devanagari', 'Noto Sans Devanagari', Mangal,
    /* Thai */
    'Noto Sans Thai', Thonburi, 'Leelawadee UI',
    sans-serif;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; overflow-x: clip; }
body {
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── RTL layout support (Arabic) ─────────────────────────── */
[dir="rtl"] {
  text-align: right;
}
[dir="rtl"] .nav,
[dir="rtl"] .header .container {
  flex-direction: row-reverse;
}
[dir="rtl"] .logo {
  margin-right: 0;
  margin-left: 20px;
}
[dir="rtl"] .lang-switcher .dropdown-menu {
  left: 0;
  right: auto;
}
[dir="rtl"] .footer-inner {
  direction: rtl;
}

/* ── Arabic typography refinements ──────────────────────── */
:lang(ar) {
  font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
  line-height: 1.8;
  letter-spacing: 0;
}

/* ── CJK typography refinements ──────────────────────────── */
:lang(zh), :lang(zh-tw), :lang(ja), :lang(ko) {
  font-feature-settings: "kern" 1;
  word-break: break-all;
  overflow-wrap: break-word;
  line-height: 1.75;
}

/* ── Devanagari typography refinements ───────────────────── */
:lang(hi) {
  line-height: 1.8;
  word-break: break-word;
}

/* ── Thai typography refinements ─────────────────────────── */
:lang(th) {
  line-height: 1.8;
  word-break: break-all;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

/* ── Container ───────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header .container {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 4px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  margin-right: 20px;
}
.logo-img { width: 32px; height: 32px; border-radius: 8px; }
.logo-text { font-size: 1rem; font-weight: 700; }

/* Nav — centered in header */
.nav { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }

.nav-link {
  padding: 6px 12px;
  font-size: 0.875rem;
  color: var(--muted);
  border-radius: 8px;
  border: none;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  transition: color var(--t), background var(--t);
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--bg-2); }

/* Direct tool links in navbar — visible at all desktop widths (≥769px).
   Below 768px → hidden because parent .nav becomes hamburger overlay. */

/* CTA — sits outside .nav, pushed to right by margin-left: auto on .nav */
.nav-cta {
  flex-shrink: 0;
  padding: 9px 20px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--t);
}
.nav-cta:hover { background: var(--primary-h); color: white; }

/* Dropdown chevron */
.dropdown-chevron { width: 10px; height: 6px; opacity: .6; }

/* Dropdown wrapper */
.nav-dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 8px;
  min-width: 180px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity var(--t), transform var(--t);
  z-index: 300;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Mega menu */
.mega-menu {
  display: flex;
  gap: 0;
  min-width: 560px;
  padding: 16px;
}
.mega-col { flex: 1; min-width: 120px; }
.mega-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--subtle);
  text-transform: uppercase;
  padding: 0 8px 8px;
}
.mega-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  transition: background var(--t), color var(--t);
}
.mega-item:hover, .mega-item.active { background: var(--bg-2); color: var(--text); }
.mega-icon { width: 24px; height: 24px; flex-shrink: 0; }
.mega-item-name { font-size: 0.8rem; }

/* Tools mega dropdown */
.tools-mega {
  display: flex;
  gap: 0;
  min-width: 680px;
  padding: 20px 8px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
}
.nav-dropdown:hover .tools-mega,
.nav-dropdown:focus-within .tools-mega {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.tools-mega-col {
  flex: 1;
  padding: 0 12px;
  border-right: 1px solid var(--border);
}
.tools-mega-col:last-child { border-right: none; }

.tools-mega-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  padding: 0 4px 10px;
  display: block;
}

.tools-mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background var(--t);
  text-decoration: none;
}
.tools-mega-item:hover, .tools-mega-item.active { background: var(--bg-2); }

.tools-mega-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
/* SVG icons ship with their own colored background — render full,
   matching the homepage tool cards. */
.tools-mega-icon img { width: 36px; height: 36px; display: block; }

.tools-mega-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

/* Language switcher */
.lang-switcher .dropdown-menu {
  left: auto;
  right: 0;
  min-width: 380px;
  padding: 16px;
}
.lang-menu {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.825rem;
  color: var(--muted);
  transition: background var(--t), color var(--t);
  white-space: nowrap;
  overflow: hidden;
}
.dropdown-item:hover, .dropdown-item.active { background: var(--bg-2); color: var(--text); }
.lang-flag { font-size: 15px; line-height: 1; flex-shrink: 0; }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform var(--t), box-shadow var(--t), background var(--t);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  box-shadow: 0 4px 16px rgba(37,99,235,.22);
}
.btn-primary:hover { background: var(--primary-h); box-shadow: 0 6px 20px rgba(37,99,235,.32); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
  padding: 12px 22px;
}
.btn-ghost:hover { border-color: #CBD5E1; background: var(--bg-2); color: var(--text); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

.btn-process {
  width: 100%;
  padding: 17px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--tool-color, var(--primary));
  color: white;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity var(--t), transform var(--t);
  font-family: inherit;
}
.btn-process:hover:not(:disabled) { opacity: .9; transform: translateY(-1px); }
.btn-process:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: #16A34A;
  color: white;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  transition: background var(--t);
}
.btn-download:hover { background: #15803D; color: white; }

.btn-again {
  background: var(--bg-2);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 10px 20px;
  font-size: 0.875rem;
}
.btn-again:hover { background: var(--border); color: var(--text); }

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  padding: 80px 0 48px;
  text-align: center;
  background: var(--bg);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.hero-title {
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.hero-accent { color: var(--primary); }

.hero-sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

/* Upload card */
.upload-card {
  max-width: 580px;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 20px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
}

.drop-zone-hero {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.drop-zone-hero:hover, .drop-zone-hero.drag-over {
  border-color: var(--primary);
  background: #EFF6FF;
}
.drop-icon-hero { display: flex; justify-content: center; margin-bottom: 12px; }
.drop-title-hero { font-size: 1rem; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.browse-link { color: var(--primary); text-decoration: underline; }
.drop-hint-hero { font-size: 0.8rem; color: var(--subtle); margin-top: 4px; }

/* Tool tabs below upload */
.tool-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.tool-tab {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-2);
  color: var(--muted);
  border: 1px solid var(--border);
  transition: background var(--t), color var(--t), border-color var(--t);
}
.tool-tab:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* Security badges */
.security-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.badge-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--subtle);
}

/* ============================================================
   TOOLS SECTION
   ============================================================ */
.tools-section {
  padding: 80px 0;
  background: var(--bg-2);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--primary);
  display: block;
  text-align: center;
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-sub {
  font-size: 1rem;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  margin-bottom: 48px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.tool-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: box-shadow var(--t), transform var(--t);
}
.tool-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,.09);
  transform: translateY(-2px);
}

.tool-card-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--card-color, var(--primary)) 13%, white);
}
.tool-card-icon-wrap img { width: 56px; height: 56px; }

/* fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .tool-card-icon-wrap { background: #EFF6FF; }
}

.tool-name {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.tool-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 14px;
}
.tool-use-link {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: auto;
}

/* ============================================================
   HOW IT WORKS
   ============================================================ */
.howto-section { padding: 80px 0; background: white; }

.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 48px;
}

.howto-step {
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.howto-step h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.howto-step p { font-size: 0.875rem; color: var(--muted); line-height: 1.55; }

/* ============================================================
   DARK BOTTOM BLOCK (Privacy + seamlessly into footer)
   ============================================================ */
.dark-bottom {
  background: var(--bg-dark);
  padding: 80px 0 72px;
}

/* 2-column layout */
.db-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.db-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #60A5FA;
  margin-bottom: 20px;
}
.db-title {
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 800;
  color: white;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.db-body {
  font-size: 0.95rem;
  color: #64748B;
  line-height: 1.7;
  margin-bottom: 12px;
}
.db-body:last-child { margin-bottom: 0; }

/* 2×2 cards grid */
.db-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.db-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 12px;
  padding: 20px;
}
.db-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(96,165,250,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.db-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  margin-bottom: 6px;
  line-height: 1.3;
}
.db-card-desc {
  font-size: 0.8rem;
  color: #64748B;
  line-height: 1.55;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq-section { padding: 80px 0; background: var(--bg-2); }
.faq-heading {
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 40px;
}
.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.faq-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.faq-q { font-size: 0.975rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.faq-a { font-size: 0.875rem; color: var(--muted); line-height: 1.6; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--bg-dark);
  padding: 48px 0 32px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.footer-brand {}
.footer-logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: white;
  font-size: 1rem;
  margin-bottom: 12px;
  text-decoration: none;
}
.footer-logo-icon { width: 28px; height: 28px; border-radius: 6px; opacity: .85; }
.footer-logo-name { color: white; }
.footer-tagline { font-size: 0.8rem; color: #64748B; line-height: 1.6; max-width: 260px; margin-bottom: 16px; }

.footer-badges { display: flex; flex-direction: column; gap: 8px; }
.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  font-size: 0.75rem;
  color: #64748B;
  width: fit-content;
}

.footer-col {}
.footer-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 14px;
}
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.875rem; color: #64748B; transition: color var(--t); }
.footer-links a:hover { color: white; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-copy { font-size: 0.8rem; color: #475569; }
.footer-nulumia-link { font-size: 0.8rem; color: #60A5FA; transition: color var(--t); }
.footer-nulumia-link:hover { color: #93C5FD; }

/* ============================================================
   TOOL PAGE — Hero
   ============================================================ */
.tool-hero {
  background: var(--bg-2);
  padding: 72px 0 56px;
  text-align: center;
}
.tool-hero .container { display: flex; flex-direction: column; align-items: center; }
.tool-hero .hero-sub { max-width: 560px; margin-bottom: 24px; }

/* keep old classes usable (edit.html icon fallback, etc.) */
.tool-hero-inner { display: flex; align-items: center; gap: 20px; }
.tool-hero-icon-wrap { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tool-hero-icon { width: 32px; height: 32px; filter: brightness(0) invert(1); }
.tool-hero-title { font-size: 1.75rem; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.tool-hero-desc { font-size: 1rem; color: var(--muted); }

.til-links--center { justify-content: center; }

/* ── Tool hero feature pills ──────────────────────────────── */
.tool-hero-pills {
  display: flex; flex-wrap: wrap; gap: .4rem;
  justify-content: center; margin-top: -.75rem; margin-bottom: 1.25rem;
}
.tool-hero-pill {
  display: inline-flex; align-items: center; gap: .22rem;
  padding: .22rem .65rem; border-radius: 99px;
  font-size: .73rem; font-weight: 500;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--muted); white-space: nowrap;
}
.tool-hero-pill--accent {
  background: #ECFDF5; border-color: #6EE7B7; color: #065F46; font-weight: 700;
}

/* ── Between-workspace SEO block ──────────────────────────── */
.tool-hero-seo-wrap {
  background: var(--bg-2);
  padding: 32px 0 0;
}
.tool-hero-seo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  max-width: 640px;
  margin: 0 auto;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: left;
}
.tool-hero-seo-block {
  background: white;
  padding: 22px 24px;
}
.tool-hero-seo-block h2 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
  line-height: 1.3;
}
.tool-hero-seo-block p {
  font-size: 0.79rem;
  color: var(--muted);
  line-height: 1.65;
}
@media (max-width: 640px) {
  .tool-hero-seo { grid-template-columns: 1fr; }
}

/* ── Tool page — How it works ─────────────────────────────── */
.tool-howto-section { padding: 64px 0; background: var(--bg-2); }
.tool-howto-section .section-title { margin-bottom: 0; }

/* ── Tool page — Feature cards ────────────────────────────── */
.tool-feat-section { padding: 64px 0 72px; background: var(--bg-2); }
.tool-feat-section .section-title { margin-bottom: 0; }

/* ── More Tools (below feat on tool pages) ── */
.tool-more-section {
  padding: 72px 0 80px;
  background: var(--bg-2);
}
.tool-more-section .section-sub { margin-bottom: 40px; }

.tool-feat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
}
.tool-feat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px;
  text-align: left;
  transition: box-shadow .15s, border-color .15s;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.tool-feat-card:hover { border-color: var(--primary); box-shadow: 0 2px 16px rgba(37,99,235,.08); }
.tool-feat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: #EFF6FF;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.tool-feat-icon svg { width: 18px; height: 18px; stroke: var(--primary); fill: none; }
.tool-feat-card h3 { font-size: .9rem; font-weight: 700; margin-bottom: 5px; color: var(--text); }
.tool-feat-card p  { font-size: .8rem; color: var(--muted); line-height: 1.5; }

/* Internal links strip */
.tool-internal-links { padding: 12px 0; border-bottom: 1px solid var(--border); background: white; }
.til-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.til-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: white;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.til-link:hover { background: var(--primary); color: white; border-color: var(--primary); }
.til-icon { width: 16px; height: 16px; }

/* ============================================================
   TOOL PAGE — Workspace
   ============================================================ */
.tool-workspace { padding: 48px 0 72px; background: var(--bg-2); }

.workspace-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
  margin: 0 auto;
}

/* Upload panel — transparent, just a container */
.upload-panel {}

/* Drop zone — IS the card (like edit-pdf's .upload-zone) */
.drop-zone {
  width: 100%;
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-lg);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--t), background var(--t);
  cursor: pointer;
  box-shadow: 0 4px 32px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
}
.drop-zone.drag-over { border-color: var(--primary); background: #EFF6FF; }

.drop-zone-content { text-align: center; padding: 48px 32px; }
.drop-icon { font-size: 3rem; margin-bottom: 16px; }
.drop-title { font-size: 1rem; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.drop-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 20px; }
.drop-hint { font-size: 0.8rem; color: var(--subtle); margin-top: 14px; }

/* Preview */
.preview-wrap { width: 100%; text-align: center; padding: 32px 24px; }
.preview-wrap img { max-height: 260px; margin: 0 auto 12px; border-radius: 8px; }
.preview-info { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }

/* Multi file list */
.multi-list-wrap { padding: 20px 24px; }
.multi-list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 0.875rem; color: var(--muted); }
.multi-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
.multi-list li { font-size: 0.8rem; color: var(--text); background: var(--bg-2); padding: 6px 10px; border-radius: 6px; }

/* Options panel */
.options-panel { display: flex; flex-direction: column; gap: 16px; }

.options-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
}
.options-title { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-bottom: 16px; letter-spacing: .04em; }

/* Form fields */
.field-group { margin-bottom: 14px; }
.field-group:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field-unit { color: var(--subtle); font-weight: 400; }

.text-input, .select-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: white;
  transition: border-color var(--t);
}
.text-input:focus, .select-input:focus { outline: none; border-color: var(--primary); }

.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-input { flex: 1; accent-color: var(--primary); }
.range-value { font-size: 0.875rem; color: var(--text); font-weight: 600; min-width: 44px; text-align: right; }

.checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.875rem; color: var(--muted); }
.checkbox-custom {
  width: 18px; height: 18px; border: 1.5px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), border-color var(--t);
}
.checkbox-label input:checked + .checkbox-custom { background: var(--primary); border-color: var(--primary); }
.checkbox-label input:checked + .checkbox-custom::after { content: '✓'; color: white; font-size: 11px; }
.checkbox-label input { display: none; }

.color-input-wrap { display: flex; align-items: center; gap: 8px; }
.color-input { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.color-hex-label { font-size: 0.8rem; color: var(--muted); font-family: monospace; }

.logo-upload-wrap { display: flex; align-items: center; gap: 8px; }
.logo-upload-btn { font-size: 0.8rem; }
.logo-fname { font-size: 0.75rem; color: var(--muted); }
.logo-clear-btn { background: none; border: none; cursor: pointer; color: var(--subtle); font-size: 14px; }

/* Compress-level cards */
.compress-levels { display: flex; flex-direction: column; gap: 8px; }
.compress-level-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.compress-level-card:hover { border-color: var(--primary); }
.compress-level-card--selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
.compress-level-radio { display: none; }
.compress-level-header { display: flex; justify-content: space-between; align-items: center; }
.compress-level-name {
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  transition: color var(--t);
}
.compress-level-card--selected .compress-level-name { color: var(--primary); }
.compress-level-badge {
  font-size: 0.78rem; font-weight: 700; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, white);
  padding: 2px 9px; border-radius: 100px;
  transition: opacity var(--t);
}
.compress-level-badge.is-placeholder { opacity: 0; }
.compress-level-desc { font-size: 0.78rem; color: var(--muted); }

/* Progress */
.progress-wrap { padding: 16px 0; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s ease; width: 0%; }
.progress-text { font-size: 0.8rem; color: var(--muted); text-align: center; }

/* Error */
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 18px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  color: #DC2626;
}
.error-icon { font-size: 1rem; flex-shrink: 0; }

/* Result */
.result-box {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 32px rgba(0,0,0,.06), 0 1px 4px rgba(0,0,0,.04);
}
.result-check { color: #16A34A; }
.result-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.result-file-info { display: flex; flex-direction: column; gap: 2px; }
.result-filename { font-size: 0.875rem; color: var(--muted); word-break: break-all; }
.result-filesize { font-size: 0.8rem; color: var(--subtle); }

/* ============================================================
   SEO CONTENT & OTHER TOOLS
   ============================================================ */
.seo-content { padding: 48px 0; background: var(--bg-2); }
.seo-block { max-width: 720px; margin: 0 auto 28px; }
.seo-block h2 { font-size: 1.2rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.seo-block p { font-size: 0.9rem; color: var(--muted); line-height: 1.65; }

.other-tools { padding: 48px 0; background: var(--bg-dark); }
.other-tools .section-title { font-size: 1.2rem; text-align: left; margin-bottom: 24px; color: white; }

.other-tools-groups { display: flex; flex-direction: column; gap: 24px; }
.other-tools-group {}
.other-tools-group-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.other-tools-group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grp-color, var(--primary)); flex-shrink: 0; }
.other-tools-group-label { font-size: 0.75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #64748B; }
.other-tools-group-line { flex: 1; height: 1px; background: #1E293B; }

.other-tools-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.other-tool-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid #1E293B;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #94A3B8;
  background: transparent;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.other-tool-card:hover { background: var(--primary); color: white; border-color: var(--primary); }
.other-tool-icon { width: 18px; height: 18px; filter: brightness(0) invert(.6); }
.other-tool-icon:hover { filter: none; }
.other-tool-card:hover .other-tool-icon { filter: brightness(0) invert(1); }
.other-tool-name { font-size: 0.8rem; }

/* Related tools strip */
.seo-links { padding: 32px 0; background: white; border-top: 1px solid var(--border); }

/* ============================================================
   CAT TABS (homepage)
   ============================================================ */
.cat-tabs { display: none; } /* not used in Stax layout */

/* ============================================================
   404 PAGE
   ============================================================ */
.error-page { padding: 120px 0; text-align: center; }
.error-page h1 { font-size: 5rem; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.error-page h2 { font-size: 1.5rem; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.error-page p { font-size: 1rem; color: var(--muted); margin-bottom: 32px; }

/* ============================================================
   RESPONSIVE
   Breakpoints: 1024px (tablet landscape), 768px (tablet portrait),
                480px (large phone), 375px (small phone)
   Pattern: desktop-first with progressive mobile enhancements.
   Touch target minimum: 44×44px (Apple HIG / WCAG 2.5.5).
   Form inputs: 16px font-size to prevent iOS Safari auto-zoom.
   ============================================================ */

/* ── 1024px: tablet landscape ────────────────────────────── */
@media (max-width: 1024px) {
  .db-layout { grid-template-columns: 1fr; gap: 40px; }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }

  /* Tools mega: shrink to fit tablet */
  .tools-mega { min-width: 520px; }
  .lang-switcher .dropdown-menu { min-width: 320px; }
}

/* ── ≤1023px: tablet portrait + landscape (hamburger trigger) ─────
   Raised from 768 → 1023 so iPad Air/Mini (820px) gets hamburger UX
   instead of crowded desktop nav. iPad Pro (1024px+) stays desktop. */
@media (max-width: 1023px) {

  /* ── Nav: hamburger menu ─────────────────────────────────
     .nav becomes a full-width slide-down panel.
     .nav-toggle is enlarged to 44×44px touch target.
     All dropdowns inside .nav flatten (position:static).
     .tools-mega + .lang-switcher overflow are fixed.
  ────────────────────────────────────────────────────────── */
  .nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    /* Enough height for all items + scroll if needed */
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    background: white;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    /* Override desktop justify-content:center — when expanded content
       (~1100px) exceeds nav max-height, center alignment shifts content
       above viewport, hiding the dropdown buttons. */
    justify-content: flex-start;
    padding: 12px 16px 24px;
    gap: 2px;
    box-shadow: var(--shadow-md);
    z-index: 199;
  }
  .nav.open { display: flex; }

  /* Hamburger — 44×44px touch target */
  .nav-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    padding: 10px;
    gap: 5px;
  }

  /* Nav CTA: keep visible in header on mobile, shrink font */
  .nav-cta {
    padding: 8px 14px;
    font-size: 0.8rem;
    flex-shrink: 0;
    min-height: 36px;
  }

  /* Nav links: 44px minimum tap height */
  .nav-link {
    padding: 10px 12px;
    min-height: 44px;
    width: 100%;
    justify-content: flex-start;
    font-size: 0.9rem;
  }

  /* Override desktop :hover transform for .tools-mega which uses
     translateX(-50%) to center under the button. On mobile / DevTools
     emulation that translate shifts the menu off-screen even though
     it's inside an accordion. Pin it back to identity. */
  .nav-dropdown:hover .tools-mega,
  .nav-dropdown:focus-within .tools-mega,
  .nav-dropdown.open .tools-mega {
    transform: none;
    left: auto;
  }

  /* Collapsible dropdowns inside mobile nav — accordion behaviour.
     Default: collapsed (max-height: 0). Tap parent .nav-dropdown to expand. */
  .dropdown-menu {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border: none;
    padding: 0;
    background: none;
    min-width: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out, padding 0.25s ease-out;
  }
  .nav-dropdown.open > .dropdown-menu {
    max-height: 1400px;
    padding: 4px 0 12px 12px;
  }
  /* Chevron rotation when section open */
  .nav-dropdown-btn .dropdown-chevron {
    transition: transform 0.2s ease;
    margin-left: auto;
  }
  .nav-dropdown.open > .nav-dropdown-btn .dropdown-chevron {
    transform: rotate(180deg);
  }

  /* Tools mega: collapse columns into single list */
  .tools-mega {
    flex-direction: column;
    min-width: 0;
    padding: 0;
    gap: 0;
  }
  .tools-mega-col {
    padding: 4px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .tools-mega-col:last-child { border-bottom: none; }
  .tools-mega-item { padding: 8px 4px; min-height: 44px; }
  .tools-mega-icon { width: 30px; height: 30px; border-radius: 8px; }
  .tools-mega-icon img { width: 30px; height: 30px; }

  /* Mega menu: collapse columns */
  .mega-menu { flex-direction: column; min-width: 0; }

  /* Lang switcher: fit viewport width */
  .lang-switcher .dropdown-menu {
    min-width: 0;
    width: 100%;
    padding: 8px 0;
  }
  .lang-menu {
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
  }
  .dropdown-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* ── Hero ─────────────────────────────────────────────── */
  .hero { padding: 48px 0 32px; }
  .hero-title { font-size: 2rem; }
  .hero-sub { font-size: 0.975rem; }
  .upload-card { padding: 20px 16px 16px; }

  /* Drop zone: make prominent for tap (no drag on touch) */
  .drop-zone-hero {
    padding: 32px 16px;
    min-height: 120px;
  }
  .drop-zone-content {
    padding: 40px 20px;
  }
  /* Drop zone: clear tap CTA */
  .drop-title { font-size: 1.05rem; }

  /* ── Form inputs: 16px prevents iOS Safari auto-zoom ──── */
  .text-input,
  .select-input {
    font-size: 1rem;
    padding: 11px 12px;
    min-height: 44px;
  }

  /* ── Sections ─────────────────────────────────────────── */
  .tools-section, .howto-section, .faq-section { padding: 56px 0; }
  .dark-bottom { padding: 56px 0 48px; }
  .db-layout { grid-template-columns: 1fr; gap: 32px; }
  .db-cards { grid-template-columns: 1fr 1fr; }
  .tools-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .howto-grid { grid-template-columns: 1fr; gap: 16px; }
  .section-title { font-size: 1.6rem; }

  /* ── FAQ: tap targets ─────────────────────────────────── */
  .faq-item { padding: 18px 20px; }
  .faq-q { font-size: 1rem; }

  /* ── Tool page ────────────────────────────────────────── */
  .tool-hero { padding: 48px 0 36px; }
  .tool-hero-inner { flex-direction: column; text-align: center; gap: 12px; }
  .tool-hero-icon-wrap { width: 52px; height: 52px; }
  .tool-hero-title { font-size: 1.4rem; }
  .tool-feat-grid { grid-template-columns: 1fr 1fr; }
  .tool-howto-section, .tool-feat-section { padding: 48px 0; }

  /* Process button: always full-width on mobile */
  .btn-process { padding: 15px; font-size: 0.95rem; }

  /* Download + again buttons: full-width for easy tapping */
  .btn-download { width: 100%; justify-content: center; min-height: 44px; }
  .btn-again { width: 100%; justify-content: center; min-height: 44px; }

  /* Result box: reduce padding */
  .result-box { padding: 28px 16px; }

  /* ── Footer ───────────────────────────────────────────── */
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-links a { min-height: 36px; display: inline-flex; align-items: center; }

  /* ── RTL mobile fixes ─────────────────────────────────── */
  [dir="rtl"] .nav-toggle { margin-left: 0; margin-right: auto; }
  [dir="rtl"] .nav { text-align: right; }
  [dir="rtl"] .tools-mega { flex-direction: column; }
  [dir="rtl"] .tools-mega-col { border-right: none; border-left: none; border-bottom: 1px solid var(--border); }
  [dir="rtl"] .lang-menu { direction: rtl; }
}

/* ── 480px: large phone ──────────────────────────────────── */
@media (max-width: 480px) {
  /* Container: tighter padding */
  .container { padding: 0 16px; }

  /* Nav: tighter header */
  .header .container { gap: 0; }

  /* Tools grid: single column */
  .tools-grid { grid-template-columns: 1fr; }

  /* Dark bottom cards: single column */
  .db-cards { grid-template-columns: 1fr; }

  /* Hero */
  .hero-title { font-size: 1.75rem; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; justify-content: center; min-height: 44px; }

  /* Tool cards: compact news-list style (icon left, text right) */
  .tool-card {
    display: grid;
    grid-template-columns: 56px 1fr;
    column-gap: 14px;
    row-gap: 2px;
    padding: 14px;
    align-items: start;
  }
  .tool-card-icon-wrap {
    grid-row: 1 / span 3;
    grid-column: 1;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    margin-bottom: 0;
    align-self: center;
  }
  .tool-card-icon-wrap img { width: 44px; height: 44px; }
  .tool-name {
    grid-column: 2;
    font-size: 0.95rem;
    margin-bottom: 0;
  }
  .tool-desc {
    grid-column: 2;
    font-size: 0.78rem;
    line-height: 1.4;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .tool-use-link {
    grid-column: 2;
    font-size: 0.78rem;
    margin-top: 2px;
  }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* Feature cards: single column */
  .tool-feat-grid { grid-template-columns: 1fr; }

  /* Lang switcher: 1 column */
  .lang-menu { grid-template-columns: 1fr 1fr; }

  /* Workspace: tighter */
  .drop-zone-content { padding: 32px 12px; }
  .options-card { padding: 16px; }

  /* 404 */
  .error-page { padding: 80px 0; }
  .error-page h1 { font-size: 4rem; }
}

/* ── 375px: small phone (explicit safety net) ────────────── */
@media (max-width: 390px) {
  /* Logo text: keep visible (nav-cta removed → more header space) */
  .logo-text { font-size: 0.9rem; }

  /* Ensure hero title never breaks layout */
  .hero-title { font-size: 1.55rem; }

  /* Compress level cards: tighter */
  .compress-level-card { padding: 11px 12px; }

  /* Lang menu: single column */
  .lang-menu { grid-template-columns: 1fr; }

  /* Tools mega name: wrap if needed */
  .tools-mega-name { font-size: 0.8rem; }

  /* Nav link: tighter horizontal padding */
  .nav-link { padding: 10px 8px; }

  /* Section title */
  .section-title { font-size: 1.4rem; }

  /* Upload card */
  .upload-card { padding: 14px 10px 12px; }
}
