/* Top menu with dropdowns, search, FAQ, info pages and the big footer. */

/* ---------- Top menu ---------- */
.navbar { padding: 12px 0; }
.nav-container { gap: 16px; flex-wrap: nowrap !important; }
.brand { color: inherit; flex-shrink: 0; }
.main-nav { display: flex; align-items: center; gap: 2px; flex: 1; justify-content: center; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 9px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer;
  font: 700 13px/1 var(--font-sans); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-main); text-decoration: none; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover, .nav-drop.open > .nav-link { background: rgba(var(--ink), 0.07); color: var(--text-strong); }
.nav-link .caret { font-size: 10px; transition: transform 0.25s; display: inline-block; }
.nav-drop.open .caret { transform: rotate(180deg); }
.nav-drop { position: relative; }
.mega {
  position: absolute; top: calc(100% + 10px); left: 50%; z-index: 120;
  transform: translate(-50%, 8px) scale(0.98); opacity: 0; visibility: hidden;
  display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 6px 22px;
  padding: 20px 22px; min-width: 640px;
  background: var(--surface-modal); border: 1px solid var(--border-subtle); border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45), var(--shadow-glow);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}
.mega::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* keeps hover alive across the gap */
.mega-wide { grid-template-columns: repeat(4, minmax(170px, 1fr)); min-width: 900px; }
.nav-drop.open .mega { opacity: 1; visibility: visible; transform: translate(-50%, 0) scale(1); }
.mega-col h5 { font: 800 11px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin: 6px 0 6px; }
.mega a, .search-results a {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px;
  color: var(--text-main); text-decoration: none; font-size: 13.5px; font-weight: 600;
}
.mega a:hover, .mega a:focus-visible { background: var(--primary-light); color: var(--text-strong); }
.mi { width: 26px; height: 26px; flex-shrink: 0; display: grid; place-items: center; border-radius: 7px; background: rgba(var(--ink), 0.06); font-size: 15px; }
.mega-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border-subtle); margin-top: 8px; padding-top: 10px; }
.mega-foot a { color: var(--accent-cyan); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border-subtle); cursor: pointer;
  background: rgba(var(--ink), 0.05); color: var(--text-main); font-size: 16px; display: grid; place-items: center;
}
.icon-btn:hover { border-color: var(--border-accent); }
.nav-burger { display: none; }
.btn-donate { padding: 9px 14px; font-size: 13px; }

/* Search: an icon that grows into a box with instant results. */
.nav-search { position: relative; display: flex; align-items: center; }
.nav-search input {
  width: 0; padding: 0; border: 0; opacity: 0; margin-left: 0;
  height: 38px; border-radius: 10px; background: rgba(var(--ink), 0.05); color: var(--text-main); font-size: 14px; outline: none;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s, padding 0.3s, margin 0.3s;
}
.nav-search.open input { width: 260px; padding: 0 12px; opacity: 1; margin-left: 6px; border: 1px solid var(--border-accent); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 8px); width: 380px; max-height: 70vh; overflow: auto; z-index: 130;
  background: var(--surface-modal); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 6px;
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.45);
}
.search-results a { align-items: flex-start; padding: 9px 10px; }
.search-results a:hover, .search-results a:focus { background: var(--primary-light); outline: none; }
.search-results strong { display: block; font-size: 14px; }
.search-results small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-muted); font-weight: 500; font-size: 12px; }
.search-empty { padding: 12px; font-size: 13px; color: var(--text-muted); }
.search-empty a { color: var(--accent-cyan); }

/* All Tools: one column per category across the whole header, so every tool shows at once.
   It hangs from the navbar (not the button) and never runs past the bottom of the window. */
@media (min-width: 981px) {
  .nav-drop-all { position: static; }
  .nav-drop-all .mega-wide {
    top: 100%; width: min(1320px, calc(100vw - 32px)); min-width: 0;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 4px 14px; padding: 16px 18px 12px;
    max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
  }
  .nav-drop-all .mega-wide::before { top: -24px; height: 24px; }
  .nav-drop-all .mega-col h5 { margin: 2px 0 4px; white-space: nowrap; }
  .nav-drop-all .mega a { gap: 7px; padding: 4px 6px; font-size: 12.5px; line-height: 1.25; }
  .nav-drop-all .mi { width: 22px; height: 22px; font-size: 13px; border-radius: 6px; }
  .nav-drop-all .mega-foot { margin-top: 6px; padding-top: 8px; }
}
/* Narrower laptops: let the tools flow from column to column (Convert alone has 15),
   so the menu stays short enough to fit without scrolling. */
@media (max-width: 1180px) and (min-width: 981px) {
  .nav-drop-all .mega-wide { display: block; columns: 150px; column-gap: 14px; }
  .nav-drop-all .mega-col { break-inside: auto; }
  .nav-drop-all .mega-col h5 { break-after: avoid; }
  .nav-drop-all .mega a { break-inside: avoid; }
  .nav-drop-all .mega-foot { column-span: all; }
}
@media (max-width: 1180px) {
  .mega-wide { min-width: 760px; grid-template-columns: repeat(3, minmax(170px, 1fr)); }
  .nav-link { padding: 9px 9px; font-size: 12px; }
}
@media (max-width: 980px) {
  .nav-burger { display: grid; }
  .btn-donate span { display: none; }
  .main-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 16px 18px;
    background: var(--surface-modal); border-bottom: 1px solid var(--border-subtle);
    max-height: calc(100vh - 70px); overflow-y: auto;
    box-shadow: 0 30px 40px -20px rgba(0, 0, 0, 0.4);
  }
  body.nav-open .main-nav { display: flex; }
  .nav-link { justify-content: space-between; padding: 13px 10px; font-size: 14px; width: 100%; }
  .mega, .mega-wide {
    position: static; transform: none; min-width: 0; opacity: 1; visibility: visible; display: none;
    grid-template-columns: 1fr 1fr; box-shadow: none; border: 0; padding: 4px 4px 12px; background: transparent;
  }
  .nav-drop.open .mega { display: grid; transform: none; }
  .nav-search.open input { width: min(52vw, 240px); }
  .search-results { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
}
@media (max-width: 560px) {
  .mega, .mega-wide { grid-template-columns: 1fr; }
  .brand-badge { display: none; }
  .nav-actions { gap: 6px; }
  .nav-container { flex-wrap: nowrap; }
  .nav-search.open { position: absolute; left: 12px; right: 12px; top: 8px; z-index: 140; background: var(--surface-modal); border-radius: 12px; padding: 4px; }
  .nav-search.open input { width: 100%; flex: 1; }
}

/* ---------- FAQ ---------- */
.faq { padding: 70px 0 20px; }
.faq-head { text-align: center; max-width: 680px; margin: 0 auto 28px; }
.faq-head h2 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.02em; margin-bottom: 8px; }
.faq-head p { color: var(--text-muted); margin-bottom: 18px; }
.faq-search { max-width: 460px; margin: 0 auto; display: block; width: 100%; }
.faq-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; align-items: start; }
.faq-group h3 { font-size: 15px; margin: 4px 0 10px; color: var(--text-strong); }
.faq-group:first-child { grid-column: 1 / -1; columns: 2; column-gap: 28px; }
.faq-group:first-child h3 { column-span: all; }
.faq-item {
  break-inside: avoid; margin-bottom: 8px;
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.2s;
}
.faq-item[open] { border-color: var(--border-accent); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 13px 40px 13px 16px; position: relative;
  font-weight: 700; font-size: 14px; color: var(--text-main);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-light); color: var(--soft-indigo); font-weight: 800; transition: transform 0.25s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-a { padding: 0 16px 14px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.faq-a a, .info-body a { color: var(--accent-cyan); }
.faq-more { text-align: center; margin-top: 26px; color: var(--text-muted); }
.faq-more a { color: var(--accent-cyan); }
@media (max-width: 820px) {
  .faq-body { grid-template-columns: 1fr; }
  .faq-group:first-child { columns: 1; }
}

/* ---------- Info pages (About, Privacy...) ---------- */
.info-card { max-width: 680px; }
.info-body { font-size: 14.5px; line-height: 1.7; color: var(--text-main); gap: 10px; }
.info-body h4 { margin-top: 8px; font-size: 15px; }
.info-body ul { padding-left: 20px; display: grid; gap: 6px; }
.info-body .muted { color: var(--text-dim); font-size: 13px; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative; margin-top: 40px; padding: 56px 0 24px;
  background: color-mix(in srgb, var(--surface-modal) 85%, transparent);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr); gap: 28px; }
.footer-grid h4 { font: 800 12px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-strong); margin-bottom: 14px; }
.footer-grid a { display: block; color: var(--text-muted); text-decoration: none; font-size: 14px; padding: 4px 0; }
.footer-grid a:hover { color: var(--text-strong); }
.footer-brand .brand { margin-bottom: 12px; display: inline-flex; }
.footer-brand p { color: var(--text-muted); font-size: 13.5px; max-width: 300px; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border-subtle);
  font-size: 13px; color: var(--text-dim);
}
@media (max-width: 980px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
.btn-donate, .btn-donate:hover { text-decoration: none; }

/* ---------- Image order board (Images to PDF) ---------- */
.io-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .4rem; }
.io-bar .form-label { margin: 0; }
.io-sort { width: auto; min-width: 15rem; flex: 1 1 15rem; }
.io-count { margin-left: auto; font-weight: 600; color: var(--text-strong, inherit); }
.io-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .65rem;
  max-height: 46vh; overflow-y: auto; padding: .5rem; margin: .4rem 0 1rem;
  border-radius: 14px; background: var(--sunken, rgba(0,0,0,.04));
}
.io-card {
  position: relative; display: flex; flex-direction: column; gap: .2rem; padding: .4rem;
  border-radius: 12px; background: var(--surface-modal, #fff); border: 1px solid rgba(127,127,127,.22);
  cursor: grab; transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.io-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.io-card.dragging { opacity: .35; }
.io-card.drop-before { box-shadow: -4px 0 0 #6366f1; }
.io-card.drop-after { box-shadow: 4px 0 0 #6366f1; }
.io-card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; background: rgba(127,127,127,.1); pointer-events: none; }
.io-num {
  position: absolute; top: .3rem; left: .3rem; z-index: 1; min-width: 1.6rem; padding: 0 .35rem;
  border-radius: 999px; background: #6366f1; color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.6rem;
}
.io-x {
  position: absolute; top: .3rem; right: .3rem; z-index: 1; width: 1.6rem; height: 1.6rem; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer;
}
.io-x:hover { background: #ef4444; }
.io-name { font-size: .75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.io-date { font-size: .68rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.io-move { display: flex; justify-content: space-between; gap: .3rem; }
.io-move .btn-xs { flex: 1; padding: .15rem 0; }
.io-move .btn-xs:disabled { opacity: .3; cursor: default; }
.file-summary .file-clear { margin-left: .5rem; }
.search-note { padding: 8px 12px 2px; font-size: 12px; color: var(--text-muted); }

/* The tool cards are drawn by JavaScript. Until then the grid keeps a screen-and-a-half of room,
   so the FAQ, donate section and footer don't flash into view and then jump down (layout shift). */
.tools-grid:empty { min-height: 150vh; }
