/* JSLC 3D Assets viewer. Mobile first; dark by default, light when the layout document asks for it. */
:root {
  --accent: #38bdf8; --bg: #0b1220; --panel: #111a2e; --panel2: #16213a; --line: #24324f; --text: #e5edf8; --muted: #93a4bf;
  --radius: 10px; --gap: 12px; --pad: 14px;
  color-scheme: dark;
}
:root[data-mode="light"] { --bg: #f5f7fb; --panel: #ffffff; --panel2: #eef2f8; --line: #d7deea; --text: #0f172a; --muted: #55637a; color-scheme: light; }
@media (prefers-color-scheme: light) { :root[data-mode="auto"] { --bg: #f5f7fb; --panel: #ffffff; --panel2: #eef2f8; --line: #d7deea; --text: #0f172a; --muted: #55637a; color-scheme: light; } }
:root[data-density="compact"] { --gap: 8px; --pad: 10px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 10px var(--pad); padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); white-space: nowrap; font-size: 16px; }
.search { flex: 1; min-width: 0; }
.search input { font: inherit; font-size: 16px; width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 16px; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.crumbs { width: 100%; max-width: 1280px; margin: 0 auto; padding: 8px var(--pad) 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px; padding-left: max(var(--pad), env(safe-area-inset-left)); }
.crumbs a { color: var(--muted); }
.crumbs span.sep { opacity: .6; }
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 8px var(--pad) 24px; padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); outline: none; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding: 16px var(--pad) max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

h1 { font-size: 24px; margin: 8px 0 4px; line-height: 1.2; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.intro, .sub, .note, .status { color: var(--muted); }
.note { font-size: 13px; }
.status { padding: 24px 0; }
.error { color: #fca5a5; }

.nav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav a { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.nav a:hover { border-color: var(--accent); text-decoration: none; }

.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.folder { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.folder:hover { border-color: var(--accent); text-decoration: none; }
.folder .ico { width: 22px; height: 18px; flex: none; border-radius: 3px; background: color-mix(in srgb, var(--accent) 35%, transparent); border-top: 4px solid var(--accent); }
.folder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { color: var(--muted); font-size: 12px; }
.tree { list-style: none; margin: 0; padding: 0; }
.tree .tree { padding-left: 18px; border-left: 1px dashed var(--line); margin-left: 10px; }
.tree li { margin: 6px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; } }
.grid.list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.carousel { grid-auto-flow: column; grid-auto-columns: minmax(180px, 46%); grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; }
.grid.carousel > * { scroll-snap-align: start; }
@media (min-width: 700px) { .grid.carousel { grid-auto-columns: 240px; } }
/* Tile = the render; info on a thin strip at the bottom edge; chip top-left, Share top-right. */
.tile { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--panel2); border: 1px solid var(--line); }
.tile:hover, .tile:focus-within { border-color: var(--accent); }
.tile .hit { position: absolute; inset: 0; color: #f3f6fb; text-decoration: none; outline: none; }
.tile .thumb { position: absolute; inset: 0; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { position: absolute; inset: 0; background: var(--panel2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%237b8799' stroke-width='2.5' stroke-linejoin='round'%3E%3Cpath d='M32 8 54 20v24L32 56 10 44V20z'/%3E%3Cpath d='M10 20l22 12 22-12M32 32v24'/%3E%3C/g%3E%3C/svg%3E") center 38% / 22% auto no-repeat; }
.strip { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px; background: linear-gradient(to top, rgba(4, 7, 13, .94), rgba(4, 7, 13, .75) 55%, rgba(4, 7, 13, 0)); }
.strip h3 { margin: 0; font-size: 13px; line-height: 1.2; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.strip p { margin: 1px 0 0; font-size: 11px; line-height: 1.25; color: #c6cdd8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip .l3 { font-size: 10px; color: #9aa6b8; font-variant-numeric: tabular-nums; }
.strip .nomodel { color: #fca5a5; }
.tile .chip { position: absolute; top: 6px; left: 6px; z-index: 2; pointer-events: none; font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 7px; border-radius: 999px; background: rgba(4, 7, 13, .72); color: #dbe4f0; border: 1px solid rgba(147, 164, 191, .45); }
.tile .share { position: absolute; top: 6px; right: 6px; z-index: 2; min-width: 44px; min-height: 28px; padding: 0 8px; border-radius: 6px; font-size: 11px;
  background: rgba(4, 7, 13, .72); color: #e5edf8; border: 1px solid rgba(147, 164, 191, .45); cursor: pointer; }
.tile .share:hover, .tile .share:focus-visible { border-color: var(--accent); }
@media (pointer: coarse) { .tile .share { min-height: 36px; } }
@media (hover: hover) { .tile .share { opacity: 0; transition: opacity .15s; } .tile:hover .share, .tile:focus-within .share { opacity: 1; } }
.asset { display: grid; gap: 16px; }
.asset > * { min-width: 0; }
@media (min-width: 980px) { .asset { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); align-items: start; } .asset .side { position: sticky; top: 72px; } }
.stage { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--panel2); border: 1px solid var(--line); touch-action: none; }
@media (min-width: 700px) { .stage { aspect-ratio: 16 / 10; } }
.stage canvas { display: block; width: 100%; height: 100%; }
.stage .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage .overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--panel2) 55%, transparent); display: grid; place-items: center; text-align: center; padding: 16px; gap: 10px; align-content: center; }
.stage .bar { width: min(260px, 70%); height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.stage .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.stage.expanded { position: fixed; inset: 0; z-index: 20; aspect-ratio: auto; border-radius: 0; border: 0; }
.stage.expanded .tools { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
.btn.more { display: block; margin: 14px auto 0; }
.btn.more[hidden] { display: none; }
.tools { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; z-index: 2; }
.btn { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04121f; font-weight: 600; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.stage .tools .btn { background: color-mix(in srgb, var(--panel) 85%, transparent); font-size: 13px; min-height: 36px; padding: 6px 12px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.panel h2 { margin: 0 0 8px; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 6px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 500; width: 36%; }
thead th { border-top: 0; width: auto; }
.mono { overflow-wrap: anywhere; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); }
.scroll { overflow-x: auto; }
/* Phones: two columns of 4:3 tiles; the strip keeps the name and one line (the size is on the asset page). */
@media (max-width: 600px) {
  .tile { aspect-ratio: 4 / 3; }
  .strip { padding: 14px 6px 5px; }
  .strip h3 { font-size: 12px; }
  .strip p { font-size: 10px; }
  .strip .l3 { display: none; }
  .tile .share { min-height: 30px; font-size: 10.5px; }
  .tile .chip { font-size: 9px; }
}
