/* Copyright (c) 2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md).
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

:root { color-scheme: light; --gallery-bg: #f5f6f7; --gallery-surface: #fff; --gallery-muted-surface: #edf0f2; --gallery-text: #172025; --gallery-muted: #59666f; --gallery-border: #dce1e5; --gallery-accent: #4f7600; --gallery-font-family: Arial, Helvetica, sans-serif; --gallery-card-min: 320px; }
[data-theme="dark"] { color-scheme: dark; --gallery-bg: #111416; --gallery-surface: #1b2024; --gallery-muted-surface: #252c31; --gallery-text: #eef2f5; --gallery-muted: #a5b0b8; --gallery-border: #333e46; --gallery-accent: #a5d65a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; padding: 0 max(28px, calc((100vw - 1320px) / 2)); background: var(--gallery-bg); color: var(--gallery-text); font-family: var(--gallery-font-family); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--gallery-accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gallery-accent); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .65rem; font-size: clamp(1.9rem, 3vw, 2.5rem); font-weight: 650; letter-spacing: -.045em; line-height: 1.15; }
h2 { margin: 0; font-size: 1.15rem; font-weight: 650; letter-spacing: -.025em; }
p { color: var(--gallery-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 10; padding: .7rem 1rem; background: var(--gallery-surface); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.gallery-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 76px; border-bottom: 1px solid var(--gallery-border); }
.gallery-brand { display: inline-flex; align-items: center; gap: 1rem; min-height: 44px; color: var(--gallery-text); text-decoration: none; }
.gallery-brand::before { content: ''; width: 5px; height: 25px; background: #76b900; }
.gallery-vendor { font-size: .86rem; font-weight: 800; letter-spacing: .035em; }
.gallery-product { padding-left: 1rem; border-left: 1px solid var(--gallery-border); font-size: 1rem; font-weight: 600; letter-spacing: -.02em; }
.gallery-nav-actions { display: flex; align-items: center; gap: 1rem; }
.gallery-documentation { display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; color: var(--gallery-muted); font-size: .8rem; text-decoration: none; }
.gallery-documentation:hover { color: var(--gallery-text); }
#theme-toggle { display: grid; place-items: center; width: 44px; height: 44px; padding: 11px; border: 1px solid var(--gallery-border); border-radius: 50%; background: transparent; color: var(--gallery-muted); }
#theme-toggle:hover { background: var(--gallery-muted-surface); color: var(--gallery-text); }
#theme-toggle svg { width: 20px; height: 20px; }
.theme-icon-light, [data-theme="dark"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: block; }
.gallery-intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: 36px 0 28px; }
#description { max-width: 64ch; margin: 0; font-size: .95rem; line-height: 1.6; }
.gallery-runtime { display: inline-flex; align-items: center; gap: .5rem; flex: none; margin: 0 0 .2rem; color: var(--gallery-muted); font-size: .72rem; }
.gallery-runtime > span { width: 6px; height: 6px; border-radius: 50%; background: #76b900; }

/* Search and facets share URL state; selecting a card is the only way to load physics. */
#gallery-controls { margin-bottom: 2rem; }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.gallery-search { display: flex; align-items: center; gap: .65rem; width: min(100%, 360px); min-height: 46px; padding: 0 .85rem; border: 1px solid var(--gallery-border); border-radius: 9px; background: var(--gallery-surface); color: var(--gallery-muted); }
.gallery-search:focus-within { border-color: var(--gallery-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gallery-accent) 12%, transparent); }
.gallery-search svg { flex: none; width: 19px; height: 19px; }
.gallery-search input { width: 100%; min-width: 0; min-height: 44px; padding: 0; border: 0; outline: none; background: transparent; color: var(--gallery-text); font-size: .84rem; }
.gallery-search input::placeholder { color: var(--gallery-muted); opacity: 1; }
.gallery-search input:focus-visible { outline: none; }
.filters { display: grid; gap: .45rem; }
.filter-row { display: flex; align-items: center; gap: .85rem; }
.filter-label { flex: 0 0 56px; color: var(--gallery-muted); font-size: .7rem; font-weight: 600; }
.filter-options { display: flex; flex-wrap: wrap; gap: .35rem; }
.filter-pill { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .4rem .75rem; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--gallery-muted); font-size: .77rem; }
.filter-pill:hover:not(:disabled) { background: var(--gallery-muted-surface); color: var(--gallery-text); }
.filter-pill[aria-pressed="true"] { border-color: color-mix(in srgb, var(--gallery-accent) 32%, var(--gallery-border)); background: color-mix(in srgb, var(--gallery-accent) 10%, var(--gallery-surface)); color: var(--gallery-accent); font-weight: 600; }
.filter-pill:disabled { opacity: .4; }
.filter-count { min-width: 1rem; color: var(--gallery-muted); font-size: .66rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.filter-pill[aria-pressed="true"] .filter-count { color: inherit; }
.results { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .25rem 1rem; color: var(--gallery-muted); font-size: .74rem; }
.clear-filters { min-height: 44px; padding: .4rem 0; border: 0; background: transparent; color: var(--gallery-accent); font-size: inherit; text-decoration: underline; text-underline-offset: .2em; }
.demo-section + .demo-section { margin-top: 2.5rem; }
.section-count { display: inline-block; margin-left: .5rem; padding: .1rem .4rem; border-radius: 5px; background: var(--gallery-muted-surface); color: var(--gallery-muted); font-size: .65rem; font-weight: 400; vertical-align: middle; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.section-description { max-width: 80ch; margin: .35rem 0 1.15rem; font-size: .8rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--gallery-card-min)), 1fr)); gap: 1.25rem; }
.card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--gallery-border); border-radius: 12px; background: var(--gallery-surface); text-decoration: none; transition: border-color .16s ease, transform .16s ease; }
.card:hover, .card.is-playing { border-color: color-mix(in srgb, var(--gallery-accent) 65%, var(--gallery-border)); }
.card:hover { transform: translateY(-2px); }
.card:focus-visible, .card.is-highlighted { outline: 2px solid var(--gallery-accent); outline-offset: 3px; }
.card-preview { position: relative; overflow: hidden; border-bottom: 1px solid var(--gallery-border); background: var(--gallery-muted-surface); }
.card img { display: block; width: 100%; height: auto; aspect-ratio: 480 / 255; object-fit: cover; }
.card-launch { position: absolute; right: 12px; bottom: 12px; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #ffffff75; border-radius: 50%; background: #172025b8; color: #fff; backdrop-filter: blur(8px); transition: background .16s ease; }
.card-launch svg { width: 20px; height: 20px; }
.card:hover .card-launch, .card:focus-visible .card-launch { border-color: #76b900; background: #76b900; color: #17210b; }
.card-body { display: flex; flex: 1; flex-direction: column; align-items: stretch; padding: 1.1rem; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.card strong { color: var(--gallery-text); font-size: .95rem; font-weight: 650; line-height: 1.4; letter-spacing: -.015em; }
.card-arrow { flex: none; color: var(--gallery-muted); font-size: .9rem; }
.card:hover .card-arrow { color: var(--gallery-accent); }
.card p { flex: 1; margin: .55rem 0 .95rem; font-size: .78rem; line-height: 1.65; }
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { padding: .18rem .45rem; border: 1px solid var(--gallery-border); border-radius: 5px; color: var(--gallery-muted); font-size: .61rem; line-height: 1.35; }
.badge-manual { border-color: transparent; background: var(--gallery-muted-surface); }
.empty { padding: 2.5rem 1.5rem; border: 1px dashed var(--gallery-border); border-radius: 12px; text-align: center; font-size: .9rem; }
.gallery-footer { margin: 2.75rem 0 0; padding: 1.25rem 0 1.75rem; border-top: 1px solid var(--gallery-border); color: var(--gallery-muted); font-size: .72rem; }

/* A selected scene becomes the page, with a single route back to the gallery. */
#inline-player { margin: 0 0 1.5rem; scroll-margin-top: 1rem; }
#inline-player:focus { outline: none; }
#inline-player:focus-visible { outline: 2px solid var(--gallery-accent); outline-offset: 4px; }
.player-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem; min-height: 64px; }
.player-heading h2 { min-width: 0; font-size: 1.15rem; line-height: 1.3; letter-spacing: -.025em; }
.player-actions { display: flex; align-items: center; gap: .6rem; font-size: .78rem; }
.player-actions:empty { display: none; }
.player-actions > a { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; }
#player-engine { color: var(--gallery-muted); white-space: nowrap; }
#player-backend { padding: 0 .75rem; border: 1px solid var(--gallery-border); border-radius: 8px; background: var(--gallery-surface); font-weight: 600; text-decoration: none; white-space: nowrap; }
#player-backend:hover { border-color: var(--gallery-accent); }
#close-player { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .45rem .85rem; border: 1px solid var(--gallery-border); border-radius: 8px; background: var(--gallery-surface); color: var(--gallery-text); font: inherit; font-size: .8rem; font-weight: 550; white-space: nowrap; }
#close-player:hover { border-color: var(--gallery-accent); background: var(--gallery-muted-surface); }
#close-player span { font-size: 1rem; }
#player-description { max-width: 90ch; margin: 0 0 .85rem; font-size: .84rem; }
#player-host isaaclab-browser-demo { min-height: 0; margin: 0; }
#player-status { margin: .65rem 0 0; font-size: .8rem; }
#player-status:empty { display: none; }
#player-host isaaclab-browser-demo[data-state="ready"] .browser-demo-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; border: 0; }
.is-viewing body { padding: 0 18px 18px; }
.is-viewing .gallery-intro, .is-viewing #gallery-controls, .is-viewing #content, .is-viewing .gallery-footer, .is-viewing #player-description { display: none; }
.is-viewing .gallery-header { position: sticky; top: 0; z-index: 5; background: var(--gallery-bg); }
.is-viewing .gallery-nav { min-height: 52px; }
.is-viewing .gallery-brand::before { height: 21px; }
.is-viewing .gallery-vendor { font-size: .75rem; }
.is-viewing .gallery-product { font-size: .85rem; }
.is-viewing #inline-player { margin: 0; }
.is-viewing .player-heading { position: sticky; top: 52px; z-index: 4; min-height: 64px; background: var(--gallery-bg); }

/* Parent-provided theme and type tokens keep documentation embeds native to the page. */
.embedded { overflow: hidden; font-size: var(--gallery-font-size, 16px); --gallery-card-min: 230px; }
.embedded body { display: flow-root; padding: .25rem; background: transparent; font-family: var(--gallery-font-family, system-ui, sans-serif); font-size: inherit; line-height: var(--gallery-line-height, 1.5); }
.embedded .gallery-header, .embedded .skip-link, .embedded .gallery-footer { display: none; }
.embedded #gallery-controls { margin-bottom: 1.25rem; }
.embedded .gallery-search { width: min(100%, 320px); }
.embedded.contextual .gallery-search { display: none; }
.embedded .gallery-toolbar { margin-bottom: .65rem; }
.embedded.contextual .gallery-toolbar { justify-content: flex-end; }
.embedded .filter-row { gap: .65rem; }
.embedded .filter-label { flex-basis: 3.75rem; }
.embedded .filter-pill { padding: .35rem .65rem; }
.embedded .grid { gap: .8rem; }
.embedded .card { border-radius: 8px; }
.embedded .card:hover { transform: none; }
.embedded .card-body { padding: .85rem; }
.embedded .card p { font-size: .9rem; line-height: 1.5; }
.embedded .card-launch { width: 32px; height: 32px; right: 8px; bottom: 8px; }
.embedded .demo-section + .demo-section { margin-top: 1.75rem; }
.embedded .results { min-height: 44px; }
.embedded.contextual .demo-section > h2, .embedded.contextual .section-description { display: none; }
.embedded.contextual .demo-section + .demo-section { margin-top: .8rem; }
.embedded .single-demo .grid { grid-template-columns: 1fr; }
.embedded .single-demo .card { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(0, 1.3fr); align-items: center; }
.embedded .single-demo .card-preview { align-self: stretch; border-right: 1px solid var(--gallery-border); border-bottom: 0; }
.embedded .single-demo .card img { height: 100%; min-height: 170px; max-height: 245px; }

@media (max-width: 600px) {
  body { padding: 0 16px; }
  .gallery-nav { min-height: 68px; gap: .5rem; }
  .gallery-brand { gap: .6rem; }
  .gallery-product { padding-left: .6rem; font-size: .9rem; }
  .gallery-nav-actions { gap: .5rem; }
  .gallery-documentation { font-size: .7rem; }
  #theme-toggle { border-color: transparent; }
  .gallery-intro { align-items: start; flex-direction: column; gap: .85rem; padding: 28px 0 24px; }
  .gallery-runtime { font-size: .7rem; }
  .gallery-toolbar { align-items: stretch; flex-direction: column; gap: .35rem; margin-bottom: .65rem; }
  .gallery-search { width: 100%; }
  .results { justify-content: space-between; min-height: 36px; }
  .filter-options { gap: .25rem; }
  .filter-pill { padding-right: .6rem; padding-left: .6rem; }
  #gallery-controls { margin-bottom: 1.5rem; }
  .grid { gap: 1rem; }
  .filter-row, .embedded .filter-row { align-items: stretch; flex-direction: column; gap: .4rem; }
  .filter-label, .embedded .filter-label { flex-basis: auto; }
  .player-heading { grid-template-columns: auto minmax(0, 1fr); gap: .65rem; min-height: 64px; }
  .player-heading h2 { font-size: 1rem; }
  .player-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .is-viewing body { padding: 0 10px 10px; }
  .is-viewing .player-heading { min-height: 66px; }
  #close-player { padding: .4rem .65rem; font-size: .75rem; }
  .embedded .single-demo .card { display: block; }
  .embedded .single-demo .card-preview { border-right: 0; border-bottom: 1px solid var(--gallery-border); }
  .embedded .single-demo .card img { height: auto; min-height: 0; max-height: none; }
}
@media (prefers-reduced-motion: reduce) { .card, .card-launch { transition: none; } .card:hover { transform: none; } }
