/* ============================================================
   ARCHIVE VIEWER — soft classic theme, shares the visual
   language of the hash generator / password generator tools.
   ============================================================ */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --ink: #1e232a;
  --muted: #5b6571;
  --subtle: #6c7480;
  --line: #e3e7ec;
  --accent: #4f63a0;
  --accent-soft: #eceff7;
  --good: #4f8a6b;
  --danger: #c0563f;
  --shadow: 0 12px 32px -20px rgba(30, 40, 60, 0.30);
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #16171a;
  --surface: #1d1f23;
  --surface-2: #25282e;
  --ink: #e7e8ec;
  --muted: #9aa0aa;
  --subtle: #9197a0;
  --line: #2c2f36;
  --accent: #9aa9d2;
  --accent-soft: #232733;
  --good: #79b393;
  --danger: #e08a78;
  --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16171a;
    --surface: #1d1f23;
    --surface-2: #25282e;
    --ink: #e7e8ec;
    --muted: #9aa0aa;
    --subtle: #9197a0;
    --line: #2c2f36;
    --accent: #9aa9d2;
    --accent-soft: #232733;
    --good: #79b393;
    --danger: #e08a78;
    --shadow: 0 20px 48px -24px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .cell/.busy set display and would override the attribute */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
code { font-family: var(--mono); font-size: 0.9em; color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.app-shell { width: min(1100px, 100%); margin: 0 auto; padding: clamp(18px, 3vw, 38px); display: grid; gap: 16px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(30px, 5vw, 54px); line-height: 1.0; letter-spacing: -0.02em; font-weight: 820; color: var(--ink); }
.av-hero { text-align: center; display: grid; gap: 10px; margin-bottom: 8px; }
.av-hero .eyebrow { justify-self: center; }
.av-hero .lede { color: var(--muted); max-width: 68ch; margin: 0 auto; }

.cell { position: relative; display: grid; gap: 12px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Dropzone */
.dropzone { display: grid; justify-items: center; gap: 8px; padding: clamp(26px, 5vw, 48px) 18px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.dropzone:hover, .dropzone.drag, .dropzone:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone svg { color: var(--accent); }
.dropzone strong { color: var(--ink); font-size: 15px; }
.dropzone span { font-size: 12px; }

/* Viewer header */
.viewer-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.crumbs-wrap { display: grid; gap: 2px; min-width: 0; flex: 1; }
.crumbs { font-weight: 750; word-break: break-all; }
.crumbs button { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 750; }
.crumbs button:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 12px; }
#filter { width: min(280px, 100%); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); }

/* Password bar */
.pw-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--accent-soft); }
.pw-line span { color: var(--muted); font-size: 13px; flex: 1 1 240px; }
#pw-input { padding: 7px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); width: 200px; }

/* Always-rendered live region (no display toggle) so screen readers announce
   the first status change reliably; min-height keeps it from jumping layout. */
.status { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); font-weight: 650; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 9px 12px; border-bottom: 1px solid var(--line); }
td { padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.col-name { min-width: 240px; max-width: 520px; }
.col-name .fname { word-break: break-all; }
.col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.col-date { white-space: nowrap; color: var(--subtle); font-size: 12px; }
.col-act { white-space: nowrap; text-align: right; width: 1%; }
.count { margin: 0; color: var(--subtle); font-size: 12px; }
.sentinel { height: 2px; }

/* Icons */
.ico { width: 17px; height: 17px; flex: none; vertical-align: -3px; }
.col-name .ico { color: var(--subtle); margin-right: 9px; }
.col-name .fname { vertical-align: middle; }

/* Folder rows: whole row navigates in */
tr.is-folder { cursor: pointer; }
tr.is-folder .col-name { font-weight: 650; }
tr.is-folder .col-name .ico { color: var(--accent); }
tr.is-folder:hover { background: var(--accent-soft); }
tr.is-folder .ico.go { color: var(--subtle); width: 15px; height: 15px; margin: 0; }
tr.is-folder:hover .ico.go { color: var(--accent); }

/* Encrypted lock badge (icon) */
.badge-lock { display: inline-block; margin-left: 6px; color: var(--accent); }
.badge-lock .ico { width: 13px; height: 13px; margin-right: 0; }

/* Path breadcrumb bar */
.path-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow-x: auto; }
.path-up { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.path-up:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.path-up:disabled { opacity: 0.4; cursor: default; }
.path-segs { display: flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; font-size: 13px; }
.path-segs strong { font-weight: 750; }
.crumb-btn { border: 0; padding: 2px 4px; background: none; color: var(--accent); font-weight: 650; cursor: pointer; border-radius: 6px; }
.crumb-btn:hover { text-decoration: underline; }
.crumb-sep { width: 14px; height: 14px; color: var(--subtle); }

/* Icon action buttons */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: 5px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color 0.12s, background 0.12s, color 0.12s; }
.icon-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Text buttons still used by the password bar and preview panel */
.row-btn { padding: 5px 11px; margin-left: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 650; cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.row-btn:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Busy overlay */
.busy { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 12px; background: color-mix(in srgb, var(--surface) 72%, transparent); backdrop-filter: blur(2px); border-radius: var(--radius); color: var(--muted); font-weight: 650; }
.viewer.is-busy .table-wrap { pointer-events: none; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview */
.pv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pv-title { font-weight: 750; word-break: break-all; }
.pv-body { display: grid; gap: 10px; justify-items: start; }
.pv-body pre { margin: 0; width: 100%; max-height: 420px; overflow: auto; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.pv-body img { max-width: 100%; max-height: 60vh; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); justify-self: center; }
.pv-body iframe { width: 100%; height: min(70vh, 640px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.pv-note { margin: 0; color: var(--subtle); font-size: 12px; }
.hash { display: block; width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); word-break: break-all; user-select: all; }
.vt-link { display: inline-block; padding: 8px 16px; border-radius: 10px; background: var(--accent); color: var(--surface); font-weight: 700; }
.vt-link:hover { color: var(--surface); opacity: 0.9; }

/* Info + FAQ */
.info { display: grid; gap: 18px; padding: clamp(18px, 3vw, 30px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.info-intro p:last-child { margin: 0; color: var(--muted); max-width: 78ch; }
.info h2 { font-size: clamp(19px, 2.6vw, 26px); letter-spacing: -0.01em; margin-bottom: 8px; }
.faq { display: grid; gap: 10px; }
.faq-2col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.faq details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 14px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.license-note { margin: 0; color: var(--subtle); font-size: 12px; }
.license-note a { color: var(--accent); }

@media (max-width: 640px) {
  .col-date { display: none; }
  th.col-date { display: none; }
  .row-btn { margin-left: 4px; padding: 5px 8px; }
}
