/* NEXUS Explorer 0.1.0
   Tokens from NEXUS shop PROD 0.3.304 (site.css / shop.css) and nexusts.eu.
   Layout: Windows 11 File Explorer. Toolbar buttons are compact (< 50px). */

@font-face {
  font-family: "NX Head";
  src: url("../fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f4f7fb;
  --ink: #0b1630;
  --body: #1e293b;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --dark: #0a1530;
  --dark-2: #13244a;
  --blue: #3d6fd6;
  --blue-d: #2a55b0;
  --navy: #253966;
  --cyan: #a8c3f0;
  --orange: #f28c28;
  --ok: #16753a;
  --warn: #b45309;
  --grad: linear-gradient(135deg, #3d6fd6 0%, #253966 100%);
  --silver: linear-gradient(135deg, #f4f7fb 0%, #c3cedd 100%);
  --radius: 16px;
  --radius-14: 14px;
  --radius-12: 12px;
  --radius-10: 10px;
  --radius-8: 8px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .14);
  --header-h: 52px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --nx-head: "NX Head", "Segoe UI Semibold", "Helvetica Neue", Arial, sans-serif;
  --nx-text: var(--font);

  --desktop-bg: linear-gradient(160deg, #13244a 0%, #0a1530 58%, #081127 100%);
  --window-bg: var(--bg-alt);
  --title-bg: rgba(255, 255, 255, .92);
  --pane-bg: #ffffff;
  --tree-bg: #f4f7fb;
  --status-bg: #f4f7fb;
  --hover: rgba(61, 111, 214, .10);
  --sel: #e8efff;
  --sel-border: #3d6fd6;
  --crumb: #ffffff;
  --icon: #253966;
  --preview-meta: #334155;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --window-bg: #0a1530;
  --title-bg: rgba(10, 21, 48, .92);
  --pane-bg: #13244a;
  --tree-bg: #0e1b38;
  --status-bg: #0e1b38;
  --bg: #13244a;
  --bg-alt: #0a1530;
  --ink: #e2e8f0;
  --body: #e2e8f0;
  --ink-2: #cbd5e1;
  --muted: #8fa3c7;
  --line: rgba(168, 195, 240, .22);
  --crumb: #13244a;
  --hover: rgba(61, 111, 214, .22);
  --sel: rgba(61, 111, 214, .35);
  --sel-border: #a8c3f0;
  --icon: #a8c3f0;
  --preview-meta: #cbd5e1;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--nx-text);
  color: var(--body);
  background: var(--dark);
  line-height: 1.45;
  font-size: 14px;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; width: 18px; height: 18px; display: block; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.is-hidden, [hidden] { display: none !important; }
.flex { flex: 1 1 auto; }
.mobile-only { display: none !important; }

/* Desktop wallpaper (navy hero from site.css) */
.desktop {
  min-height: 100%;
  background: var(--desktop-bg);
  padding: 16px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.window {
  flex: 1 1 auto;
  max-width: 1440px;
  display: flex;
  flex-direction: column;
  background: var(--window-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: calc(100vh - 32px);
  min-width: 0;
}

/* Title bar — shop header style, compact for Explorer */
.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 0 10px 0 12px;
  background: var(--title-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
/* Logo: exact PNG, no backing, no background, no clipping fill */
.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
  flex: none;
  background: none;
  background-color: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  /* drop-shadow only, never a filled plate behind the mark */
  filter: drop-shadow(0 2px 4px rgba(11, 22, 48, .25));
}
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-text strong {
  font-family: var(--nx-head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--ink);
}
.brand-text small {
  font-family: var(--nx-head);
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 500;
}
.titlebar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-text {
  background: transparent;
  border: 0;
  color: var(--ink-2);
  font-weight: 600;
  font-size: .82rem;
  padding: 6px 10px;
  border-radius: var(--radius-8);
}
.tb-text:hover { background: var(--hover); color: var(--ink); }
.window-controls { display: flex; gap: 8px; padding-left: 8px; }
.wc {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, .12);
  display: block;
}
.wc-min { background: #c3cedd; }
.wc-max { background: #3d6fd6; }
.wc-close { background: #f28c28; }

/* Compact Explorer toolbar */
.navbar, .commandbar, .statusbar, .pane-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.navbar {
  padding: 8px 10px;
  background: var(--window-bg);
  border-bottom: 1px solid var(--line);
}
.nav-btn, .tb-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-8);
  background: transparent;
  color: var(--icon);
}
.nav-btn:hover, .tb-icon:hover { background: var(--hover); }
.nav-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.nav-btn.is-on {
  background: var(--sel);
  border-color: transparent;
  color: var(--blue-d);
}
html[data-theme="dark"] .nav-btn.is-on { color: var(--cyan); }

.address {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 32px;
  padding: 0 8px;
  background: var(--crumb);
  border: 1px solid var(--line);
  border-radius: var(--radius-10);
  overflow-x: auto;
  scrollbar-width: none;
}
.address::-webkit-scrollbar { display: none; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 600;
  font-size: .84rem;
  white-space: nowrap;
}
.crumb:hover { background: var(--hover); }
.crumb-sep { color: var(--muted); flex: none; width: 12px; height: 12px; }

.search {
  flex: 0 1 240px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  background: var(--crumb);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  color: var(--muted);
}
.search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(61, 111, 214, .15);
  background: var(--pane-bg);
  color: var(--ink);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  padding: 4px 0;
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }
.search svg { width: 16px; height: 16px; flex: none; }

.commandbar {
  padding: 4px 10px 8px;
  background: var(--window-bg);
  border-bottom: 1px solid var(--line);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.commandbar::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--pill);
  padding: 5px 12px;
  min-height: 28px;
  font-weight: 600;
  font-size: .82rem;
  color: var(--ink-2);
}
.tab:hover { background: var(--hover); color: var(--ink); }
.tab.is-on {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(61, 111, 214, .25);
}
.tab-soon { opacity: .85; }
.tab-soon:not(.is-on)::after { content: ""; } /* placeholder, no badge clutter */
.view-switch { display: inline-flex; gap: 2px; padding: 2px; background: var(--pane-bg); border: 1px solid var(--line); border-radius: 10px; }

/* Panes */
.panes {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  min-height: 0;
  background: var(--window-bg);
}
.tree-pane, .preview-pane, .main-pane { min-width: 0; min-height: 0; overflow: auto; }
.tree-pane {
  background: var(--tree-bg);
  border-right: 1px solid var(--line);
}
.preview-pane {
  background: var(--pane-bg);
  border-left: 1px solid var(--line);
}
.main-pane { background: var(--pane-bg); }
.pane-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px 12px;
  font-family: var(--nx-head);
  font-weight: 600;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: inherit;
  border-bottom: 1px solid var(--line);
}
body.preview-off .panes { grid-template-columns: 240px minmax(0, 1fr); }
body.preview-off .preview-pane { display: none; }

/* Folder tree */
.tree { padding: 6px 8px 16px; }
.tree-item { user-select: none; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-8);
  padding: 4px 6px;
  color: var(--ink);
  min-height: 30px;
}
.tree-row:hover { background: var(--hover); }
.tree-row.is-on {
  background: var(--sel);
  box-shadow: inset 0 0 0 1px var(--sel-border);
  font-weight: 600;
}
.tree-twist {
  width: 18px; height: 18px; flex: none;
  display: grid; place-items: center;
  background: none; border: 0; padding: 0;
  color: var(--muted);
  border-radius: 4px;
}
.tree-twist svg { width: 12px; height: 12px; transition: transform .15s; }
.tree-item.is-open > .tree-row .tree-twist svg { transform: rotate(90deg); }
.tree-twist.is-leaf { visibility: hidden; }
.tree-folder-icon { width: 16px; height: 16px; flex: none; color: var(--blue); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.tree-children { padding-left: 14px; }
.tree-item:not(.is-open) > .tree-children { display: none; }

/* Icon grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  padding: 14px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-12);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.tile:hover { background: var(--hover); }
.tile.is-on {
  background: var(--sel);
  border-color: var(--sel-border);
}
.tile-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-10);
  overflow: hidden;
  background: #e8eef6;
  display: grid;
  place-items: center;
}
html[data-theme="dark"] .tile-thumb { background: #0a1530; }
.tile-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.folder-glyph {
  width: 72px; height: 56px;
  color: var(--blue);
}
.tile-name {
  font-size: .8rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Details list */
.list { padding: 0 0 16px; }
.list-head, .list-row {
  display: grid;
  grid-template-columns: minmax(160px, 2.2fr) 110px 140px minmax(120px, 1.4fr) 90px;
  gap: 8px;
  align-items: center;
  padding: 0 16px;
}
.list-head {
  position: sticky; top: 0; z-index: 1;
  height: 32px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--pane-bg);
  border-bottom: 1px solid var(--line);
}
.list-row {
  min-height: 40px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  margin: 1px 8px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: .86rem;
}
.list-row:hover { background: var(--hover); }
.list-row.is-on { background: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-border); }
.list-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-name img, .list-name .folder-glyph {
  width: 28px; height: 28px; object-fit: cover; border-radius: 4px; flex: none;
}
.list-name span, .list-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Preview */
.preview { padding: 16px; }
.preview-empty {
  color: var(--muted);
  text-align: center;
  padding: 32px 12px;
  font-size: .9rem;
}
.preview-img {
  width: 100%;
  border-radius: var(--radius-14);
  overflow: hidden;
  background: #0a1530;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.preview-img img { width: 100%; height: auto; display: block; }
.preview-title {
  font-family: var(--nx-head);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 12px;
  line-height: 1.3;
  word-break: break-word;
}
.meta { display: grid; gap: 8px; }
.meta-row { display: grid; grid-template-columns: 88px 1fr; gap: 8px; font-size: .86rem; }
.meta-k { color: var(--muted); }
.meta-v { color: var(--preview-meta); overflow-wrap: anywhere; }

/* Placeholder views */
.soon {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-2);
}
.soon h2 {
  font-family: var(--nx-head);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}
.soon p { margin: 0 auto; max-width: 36em; color: var(--muted); }
.soon-badge {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 6px 12px;
  border-radius: var(--pill);
  background: rgba(61, 111, 214, .1);
  border: 1px solid rgba(61, 111, 214, .3);
  color: var(--blue-d);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Status bar */
.statusbar {
  min-height: 32px;
  padding: 0 12px;
  background: var(--status-bg);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  gap: 10px;
}
.sep { width: 1px; height: 14px; background: var(--line); }
.version-chip {
  background: none;
  border: 0;
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 8px;
  border-radius: 6px;
}
.version-chip:hover { background: var(--hover); color: var(--ink); }

/* About dialog */
.about {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 22px;
  width: min(400px, calc(100vw - 32px));
  background: var(--pane-bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.about::backdrop { background: rgba(10, 21, 48, .55); }
/* Logo in about: exact PNG, transparent, no plate */
.about-logo {
  width: 96px;
  height: 96px;
  display: block;
  margin: 0 auto 12px;
  background: none;
  background-color: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(11, 22, 48, .25));
}
.about h2 {
  font-family: var(--nx-head);
  font-weight: 700;
  letter-spacing: .08em;
  margin: 0 0 4px;
}
.about-ver { font-weight: 700; color: var(--blue-d); margin: 0 0 2px; }
html[data-theme="dark"] .about-ver { color: var(--cyan); }
.about-date, .about-desc, .about-site { color: var(--ink-2); margin: 0 0 8px; }
.about-desc { font-size: .9rem; }
.about-site a { color: var(--blue-d); font-weight: 600; }
.about form { margin-top: 16px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border-radius: var(--radius-12);
  font-weight: 700;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(61, 111, 214, .25);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(37, 57, 102, .3); }

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 21, 48, .45);
  z-index: 20;
}

/* Responsive: tablet — preview becomes a drawer */
@media (max-width: 1099px) {
  .panes { grid-template-columns: 220px minmax(0, 1fr); }
  .preview-pane {
    display: none;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(340px, 92vw);
    z-index: 30;
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
  }
  body.preview-open .preview-pane { display: flex; flex-direction: column; }
  body.preview-open .drawer-backdrop { display: block; }
  body.preview-off .panes { grid-template-columns: 220px minmax(0, 1fr); }
}

/* Phone — tree and preview are drawers; full-bleed window */
@media (max-width: 699px) {
  .desktop { padding: 0; }
  .window {
    border-radius: 0;
    min-height: 100vh;
    max-width: none;
    border: 0;
  }
  .mobile-only { display: inline-grid !important; }
  .window-controls { display: none; }
  .brand-text small { display: none; }
  .titlebar { height: 48px; }
  .tb-text { display: none; } /* still available from version chip */
  .search { flex: 1 1 120px; }
  .address { display: none; }
  .panes { grid-template-columns: minmax(0, 1fr); }
  .tree-pane, .preview-pane {
    display: none;
    position: fixed;
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }
  .tree-pane {
    top: 0; left: 0; bottom: 0;
    width: min(300px, 88vw);
    border-right: 1px solid var(--line);
  }
  .preview-pane {
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    max-height: 78vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
  }
  body.tree-open .tree-pane { display: flex; flex-direction: column; }
  body.preview-open .preview-pane { display: flex; flex-direction: column; }
  body.tree-open .drawer-backdrop,
  body.preview-open .drawer-backdrop { display: block; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); padding: 10px; }
  .list-head, .list-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .list-head span:nth-child(n+3),
  .list-row span:nth-child(n+3) { display: none; }
}

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