/* iDrop server 2026 — refined 3-pane UI.
   Layout core: fixed-height header + three independently-scrolling columns, so
   selecting a library or item never scrolls the page. On phones the columns
   become a single-panel drill-down (Libraries -> Tree -> Detail) with a Back
   bar, which is far easier to navigate than a long stacked list. */

/* ---------- Apercu (the live site's typeface) ---------- */
@font-face {
  font-family: 'Apercu Light';
  src: url('/fonts/apercu_light-webfont.woff2') format('woff2');
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Apercu';
  src: url('/fonts/apercu_regular-webfont.woff2') format('woff2');
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Apercu Medium';
  src: url('/fonts/apercu_medium-webfont.woff2') format('woff2');
  font-weight: normal; font-style: normal; font-display: swap;
}

:root {
  --ink: #333333;
  --ink-soft: #777;
  --line: #e2e2e2;
  --line-strong: #cfcfcf;
  --bg: #ffffff;
  --bg-soft: #f2f2f2;
  --accent: #000000;
  --accent-ink: #ffffff;
  --sel: #ededed;
  --header-h: 92px;
  --font: 'Apercu', "Helvetica Neue", Helvetica, Tahoma, sans-serif;
  --font-light: 'Apercu Light', 'Apercu', "Helvetica Neue", Helvetica, Tahoma, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-light);
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- Header ---------- */
.site-header {
  height: var(--header-h);
  padding: 14px 28px;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.header-brand { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.brand { display: inline-block; line-height: 0; }
.brand-logo { height: 32px; width: auto; display: block; }
.site-title {
  margin: 0;
  font-family: var(--font-light);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Search ---------- */
.header-search { position: relative; flex: 0 1 420px; }
.search-input {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-light);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: none;
}
.search-input:focus { border-color: var(--ink); }
.search-input:disabled { background: var(--bg-soft); color: var(--ink-soft); cursor: not-allowed; }

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0; right: 0;
  margin: 0; padding: 4px 0;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 60vh;
  overflow-y: auto;
}
.search-results li {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-results li.active,
.search-results li:hover { background: var(--sel); }
.search-results .r-label { font-family: var(--font); font-size: 14px; color: var(--ink); }
.search-results .r-desc { font-size: 12px; color: var(--ink-soft); }
.search-results .r-crumbs { font-size: 11px; color: var(--ink-soft); opacity: .8; }
.search-results .r-empty { padding: 10px 14px; color: var(--ink-soft); cursor: default; }
.search-results mark { background: #ffe58a; color: inherit; padding: 0 1px; }

/* ---------- Mobile bar (hidden on desktop) ---------- */
.mobile-bar { display: none; }

/* ---------- 3-pane layout ---------- */
.panes {
  display: grid;
  grid-template-columns: 240px 380px 1fr;
  height: calc(100vh - var(--header-h));
}
.pane {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}
.pane-detail { border-right: none; }
.pane-heading {
  margin: 0 0 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hint { color: var(--ink-soft); font-size: 14px; }

/* ---------- Libraries (col 1) ---------- */
.library-list { list-style: none; margin: 0; padding: 0; }
.library-list li {
  padding: 9px 12px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 16px;
  color: var(--ink);
}
.library-list li:hover { background: var(--bg-soft); }
.library-list li.active { background: var(--sel); font-family: var(--font); }
.library-list .market { color: var(--ink-soft); font-size: 12px; }

/* ---------- Tree (col 2) ---------- */
.tree ul { list-style: none; margin: 0; padding-left: 18px; }
.tree > ul { padding-left: 0; }
.tree li { margin: 1px 0; }
.node-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 6px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  font-size: 15px;
}
.node-row:hover { background: var(--bg-soft); }
.node-folder > .node-row .twisty {
  width: 14px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 11px;
  flex: 0 0 14px;
}
.node-folder.collapsed > ul { display: none; }
.node-item > .node-row { padding-left: 27px; }
.node-item.selected > .node-row { background: var(--accent); color: var(--accent-ink); }
.node-label { flex: 1; }
.node-item.flash > .node-row { animation: flash 1.2s ease; }
@keyframes flash { 0%,20% { background: #ffe58a; } 100% { background: transparent; } }

/* ---------- Detail (col 3) ---------- */
.detail { max-width: 640px; }
.detail h3 {
  margin: 0 0 4px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 400;
}
.detail .code { color: var(--ink-soft); font-size: 13px; letter-spacing: .5px; margin-bottom: 18px; }

/* No grey box — the preview sits on white like the live site. */
.preview {
  background: var(--bg);
  max-width: 440px;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.preview img { max-width: 100%; max-height: 440px; display: block; }
.preview .missing { color: var(--ink-soft); font-size: 13px; }

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between; /* Drawing Options left, File Format right — aligned to the image box */
  gap: 28px;
  margin-top: 20px;
  max-width: 440px;
}
.control-group .control-label {
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 8px;
}
.btn-row { display: flex; }
.btn {
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 13px;
  letter-spacing: .5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn + .btn { border-left: none; }
.btn:hover { background: var(--bg-soft); }
.btn.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- Download toast (anchored above the File Format buttons) ---------- */
.btn-wrap { position: relative; display: inline-block; }
.dl-toast {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  max-width: 320px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 4px;
  padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  z-index: 30;
}
.dl-toast.show { opacity: 1; transform: translateY(0); }
/* little pointer to the buttons below */
.dl-toast::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 24px;
  border: 6px solid transparent;
  border-top-color: var(--accent);
}
.dl-toast .t-title { font-family: var(--font); font-size: 11px; letter-spacing: .5px; text-transform: uppercase; opacity: .8; margin-bottom: 3px; }
.dl-toast .t-item { font-family: var(--font); font-size: 14px; }
.dl-toast .t-file { font-size: 13px; opacity: .85; word-break: break-all; }

/* ---------- Version watermark (bottom-right) ---------- */
.watermark {
  position: fixed;
  right: 12px;
  bottom: 8px;
  z-index: 5;
  font-family: var(--font-light);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  opacity: .55;
  pointer-events: none;
  user-select: none;
}

/* ---------- Mobile: single-panel drill-down ---------- */
@media (max-width: 820px) {
  :root { --header-h: auto; }
  .site-header { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 18px; }
  .header-brand { align-items: flex-start; }
  .header-search { flex: 1 1 auto; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    min-height: 44px;
  }
  .mobile-back {
    border: 1px solid var(--line-strong);
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
  }
  .mobile-title {
    font-family: var(--font);
    font-size: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-soft);
  }

  .panes { grid-template-columns: 1fr; height: auto; }
  .pane { display: none; border-right: none; height: auto; min-height: 60vh; }
  body[data-pane="libraries"] .pane-libraries,
  body[data-pane="tree"] .pane-tree,
  body[data-pane="detail"] .pane-detail { display: block; }
  .pane-heading { display: none; } /* the mobile bar shows context instead */

  .node-row { padding: 10px 8px; font-size: 16px; } /* bigger tap targets */
  .node-item > .node-row { padding-left: 30px; }
  .library-list li { padding: 12px; font-size: 17px; }
  .preview img { max-height: 60vh; }
}
