.atlas-nav, .trail, .collection-list, .atlas-controls, .scene-controls {
  display: flex;
  align-items: center;
}
.atlas-nav { gap: clamp(.8rem, 2.2vw, 2.2rem); }
.atlas-nav a { color: #d5d5e5; }
.atlas-nav #all-demos { text-decoration: underline; text-decoration-color: #b3a3f3; text-underline-offset: .45rem; }
.atlas {
  --violet: #c4b8ff;
  --muted: #bfc3d5;
  --night: #0a0d18;
  --paper: #edeff2;
  --paper-ink: #151927;
  --paper-muted: #475060;
  min-height: 75svh;
  isolation: isolate;
  color: #f5f4fa;
}
.atlas [data-category="3d-property"] { --tone: #127c78; }
.atlas [data-category="programbench"] { --tone: #4e60ac; }
.atlas [data-category="cnc"] { --tone: #856127; }
.atlas [data-category="terminalbench-4"] { --tone: #7954a1; }
.atlas [data-category="terminalbench-science"] { --tone: #326987; }
.atlas [data-category="hle"] { --tone: #995773; }

.atlas-intro {
  display: grid;
  grid-template-columns: minmax(0, .97fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 6.1rem);
  padding-block: clamp(2.7rem, 4.6vw, 5.5rem);
}
.atlas h1 { overflow-wrap: anywhere; text-wrap: balance; letter-spacing: -.065em; }
.atlas-intro h1 { margin-block: .7rem 1rem; font-size: clamp(3.5rem, 6.3vw, 6.9rem); line-height: .98; }
.atlas-count, .detail-series {
  display: flex;
  gap: .7rem;
  align-items: center;
  color: #d1c6f5;
  font-size: .94rem;
  font-weight: 550;
}
.atlas-count::before, .detail-series::before {
  content: '';
  flex: 0 0 1.9rem;
  height: 2px;
  background: linear-gradient(90deg, #a497d7, #f0c49a);
}
.atlas-lede {
  max-width: 48rem;
  font-size: clamp(1rem, 1.3vw, 1.22rem);
  color: var(--muted);
  line-height: 1.52;
}
.catalog-copy .atlas-lede { max-width: 34rem; }
.preview-strip {
  display: grid;
  grid-template-columns: 1.18fr .9fr .92fr;
  gap: clamp(.35rem, .7vw, .75rem);
  align-items: start;
  position: relative;
}
.preview-tile {
  position: relative;
  display: block;
  min-width: 0;
  aspect-ratio: .89;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #454b60;
  border-radius: 3px;
  background: #172237;
}
.preview-tile:nth-child(2) { margin-top: 1.65rem; }
.preview-tile:nth-child(3) { margin-top: 3.3rem; }
.preview-tile img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
}
.preview-tile[data-category="hle"] img {
  position: absolute; width: 316%; height: auto; max-width: none;
  left: 50%; top: 50%; transform: translate(-25%, -63%);
}
.preview-tile[data-category="3d-property"] img { object-position: 58% center; }
.preview-tile::after {
  content: '';
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, #080c1ce6);
  z-index: 1;
  pointer-events: none;
}
.preview-label {
  position: absolute;
  inset: auto .7rem .75rem;
  z-index: 2;
  color: #fff;
  font-size: clamp(.8rem, 1vw, .92rem);
  line-height: 1.16;
  font-weight: 550;
  text-shadow: 0 1px 3px #000b;
}
.library {
  position: relative;
  isolation: isolate;
  color: var(--paper-ink);
  padding-block: clamp(1.5rem, 2.2vw, 2.4rem) clamp(3rem, 5vw, 6rem);
}
.library::before {
  content: '';
  position: absolute; z-index: -1;
  inset: 0;
  background: var(--paper);
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
}
.atlas-controls { justify-content: space-between; flex-wrap: wrap; gap: .85rem .6rem; }
.collection-list { flex-wrap: wrap; gap: .25rem; }
.collection-list button, .mobile-filter {
  border: 1px solid transparent;
  border-radius: .3rem;
  padding: .55rem .74rem;
  min-height: 2.52rem;
  color: #3d4254; background: transparent;
  font: inherit;
  font-size: .93rem;
}
.collection-list button:hover { background: #dcdfe8; }
.collection-list button[aria-pressed=true] { color: #fff; background: var(--paper-ink); }
.atlas .search-wrap { position: relative; display: block; width: min(100%, 13rem); }
.search-wrap::before {
  content: '';
  position: absolute; inset: 50% auto auto .84rem; margin-top: -.43rem;
  width: .66rem; height: .66rem; border: 1.5px solid #666d80; border-radius: 50%; pointer-events: none;
}
.search-wrap::after {
  content: '';
  position: absolute; inset: 50% auto auto 1.44rem; margin-top: .17rem;
  width: .35rem; height: 1.5px; background: #666d80; transform: rotate(45deg); pointer-events: none;
}
.search, .mobile-filter {
  display: block; width: 100%; height: 2.55rem; min-width: 0;
  border: 1px solid #bac0cf; border-radius: .32rem;
  background: #f9fafc; color: #151927;
  font: inherit; font-size: .94rem;
}
.search { padding: .45rem .55rem .45rem 2.25rem; }
.search::placeholder { color: #676e7c; }
.search:focus-visible, .mobile-filter:focus-visible { outline: 2px solid #7056af; outline-offset: 2px; }
.mobile-filter { display: none; }
.catalog-context {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 1.15rem 0;
  padding-top: .85rem;
  border-top: 1px solid #c7ccd5;
}
.grid-meta { color: #4e5667; font-size: .9rem; flex-shrink: 0; max-width: 100%; }
.collection-desc { max-width: 76ch; color: var(--paper-muted); font-size: .94rem; line-height: 1.48; }
.collection-desc strong { color: var(--paper-ink); margin-inline-end: .55rem; }
.atlas-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.4rem, 2.7vw, 2.8rem) clamp(.9rem, 1.8vw, 1.9rem);
}
.demo-card { min-width: 0; display: flex; flex-direction: column; color: var(--paper-ink); }
.card-art { overflow: hidden; border-radius: 4px; background: #151c2c; border: 1px solid #ccd0d8; }
.card-art img { display: block; width: 100%; aspect-ratio: 1.78; object-fit: contain; transition: transform .38s ease; }
@media(hover:hover) { .demo-card:hover .card-art img { transform: scale(1.025); } }
.demo-card-copy { padding: .9rem 0 1.05rem; border-bottom: 1px solid #c4cbd5; flex: 1; }
.collection-name {
  display: flex; align-items: center; gap: .44rem;
  color: var(--tone, #475571);
  font-size: .87rem; font-weight: 640;
}
.collection-name::before { content: ''; width: .45rem; height: .45rem; transform: rotate(45deg); background: currentColor; }
.demo-card h2 {
  font-size: clamp(1.27rem, 1.7vw, 1.74rem);
  letter-spacing: -.035em; line-height: 1.14;
  margin: .48rem 0 .5rem; text-wrap: pretty;
}
.demo-card p { color: var(--paper-muted); font-size: 1rem; line-height: 1.48; text-wrap: pretty; }
.atlas[data-view="detail"] { padding-bottom: clamp(3rem, 6vw, 7rem); }
.detail-heading { padding-top: clamp(1.5rem, 3.4vw, 4rem); }
.trail { gap: .65rem; flex-wrap: wrap; font-size: .94rem; margin-bottom: clamp(1.35rem, 2.2vw, 2.25rem); color: #b9bfd2; }
.trail a { text-decoration: underline; text-decoration-color: #777b90; text-underline-offset: .22em; }
.detail-heading h1 { margin-block: .65rem 1rem; line-height: 1.02; font-size: clamp(2.35rem, 4.9vw, 5.25rem); max-width: 23ch; }
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .85fr);
  align-items: start;
  gap: clamp(1.5rem, 4vw, 4.5rem);
  margin-block: clamp(1.65rem, 3vw, 3.4rem);
}
.detail-gallery, .detail-body { min-width: 0; }
.detail-gallery-title, .detail-body h2, .live h2 { font-size: 1.32rem; letter-spacing: -.025em; margin-bottom: .7rem; }
.detail-gallery-title { margin-bottom: 1.1rem; }
.detail-gallery figure { margin-bottom: 1.2rem; }
.detail-gallery figure a {
  display: block; border: 1px solid #41485b; background: #141d2e; border-radius: .25rem; overflow: hidden;
}
.detail-gallery figure img { display: block; width: 100%; height: auto; max-height: 65vh; object-fit: contain; }
.detail-gallery figcaption { font-size: .92rem; color: #c1c6d8; line-height: 1.44; margin-top: .65rem; }
.detail-body { border-top: 1px solid #6e7084; }
.detail-body section { padding: 1.2rem 0; border-bottom: 1px solid #373d52; }
.detail-body h2 { color: #eeeaf8; }
.detail-body p, .scene-note, .original pre { color: #c2c8d7; font-size: 1.02rem; line-height: 1.59; }
.detail-body p { white-space: pre-line; }
.original { border-top: 1px solid #464b60; padding: 1rem .25rem; }
.original summary { font-weight: 560; cursor: pointer; width: fit-content; overflow-wrap: anywhere; }
.original pre { font: inherit; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 86ch; }
.live { margin: 1.8rem 0; padding: 1.25rem; border: 1px solid #3d445b; background: #111725; }
.scene-controls { gap: 1rem; flex-wrap: wrap; }
.scene-expand { background: transparent; border: 0; color: #d6d0f9; text-decoration: underline; padding: .7rem; }
.scene-note { margin: .75rem 0 1rem; }
.live iframe { display: block; width: 100%; height: clamp(370px,60vw,710px); border: 1px solid #484f66; margin-top: 1rem; background: #10131d; }
.live iframe:fullscreen { width: 100vw; height: 100vh; border: 0; }
.return-link { display: inline-flex; margin-top: 1.6rem; }
html:lang(zh) .atlas .detail-body h2, html:lang(zh) .atlas .detail-gallery-title, html:lang(zh) .atlas .live h2 {
  font-size: 1.35rem; line-height: 1.3;
}
html:lang(zh) .atlas-intro h1 { font-size: clamp(3rem, 5.5vw, 5.7rem); }
html:lang(zh) .detail-heading h1 { font-size: clamp(2.1rem, 4.25vw, 4.65rem); max-width: 18em; }
html:lang(zh) .demo-card h2 { font-size: clamp(1.28rem, 1.54vw, 1.65rem); line-height: 1.3; }
@media(min-width:1400px) { .atlas-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media(max-width:1100px) and (min-width:741px) {
  .atlas-controls { display: grid; grid-template-columns: minmax(0,1fr); }
  .atlas .search-wrap { width: 15rem; }
}
@media(max-width:970px) {
  .atlas-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .preview-strip { gap: .35rem; }
  .preview-label { inset-inline: .4rem; }
}
@media(max-width:740px) {
  .atlas-intro { grid-template-columns: 1fr; gap: 1.15rem; padding-block: 1.65rem 1.45rem; }
  .atlas-intro h1 { margin-block: .5rem .65rem; }
  .catalog-copy .atlas-lede { max-width: 40ch; }
  .preview-strip { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .4rem; }
  .preview-tile, .preview-tile:nth-child(n) { aspect-ratio: auto; height: clamp(4.4rem, 16vw, 7rem); margin: 0; }
  .preview-label { inset: auto .4rem .4rem; font-size: .76rem; }
  .atlas-controls { display: grid; grid-template-columns: minmax(0,.98fr) minmax(0,1.02fr); gap: .65rem; }
  .collection-list { display: none; }
  .mobile-filter {
    display: block;
    appearance: none;
    padding-inline: .65rem 1.45rem;
    background-image: linear-gradient(45deg, transparent 43%, #545b69 44% 66%, transparent 67%),
                      linear-gradient(-45deg, transparent 43%, #545b69 44% 66%, transparent 67%);
    background-position: right .88rem center, right .62rem center;
    background-size: .3rem .3rem; background-repeat: no-repeat;
  }
  .atlas .search-wrap { width: 100%; }
  .library { padding-top: 1.1rem; }
  .catalog-context { flex-direction: column; align-items: stretch; gap: .5rem; margin: .8rem 0; padding-top: .65rem; }
  .detail-layout { display: grid; grid-template-columns: 1fr; gap: .9rem; }
  .detail-gallery { display: contents; }
  .detail-gallery-title { order: 0; margin-bottom: 0; }
  .detail-gallery .lead-figure { order: 1; }
  .detail-body { order: 2; }
  .detail-gallery .support-figure { order: 3; }
  .detail-gallery figure { margin-bottom: 0; }
}
@media(max-width:570px) {
  .atlas-grid { grid-template-columns: 1fr; gap: 1.3rem; }
  .atlas-nav, .mast-inner { gap: .7rem; }
  .atlas-nav a { font-size: .88rem; }
  .detail-gallery img { max-height: 52vh; }
  .demo-card h2 { font-size: 1.55rem; }
}
@media(max-width:355px) { .atlas-nav #home { display:none; } }
.preview-strip { isolation: isolate; }
.preview-strip::before {
  content: '';
  position: absolute; z-index: -1; pointer-events: none;
  inset: -8% -1% -7%;
  background: radial-gradient(ellipse at 25% 56%, #4c5a9233, transparent 59%),
              radial-gradient(ellipse at 73% 65%, #9c76552e, transparent 56%);
  filter: blur(14px);
}
.preview-tile { box-shadow: 0 6px 17px #0004; }
@media (prefers-reduced-motion: reduce) { .demo-card:hover .card-art img { transform: none; } }

@media (max-width:460px) {
  .atlas-nav { gap: .45rem; }
  .atlas-nav #home { display: none; }
}
@media (max-width:355px) {
  .mast-inner { gap: .3rem; padding-inline: .65rem; }
  .atlas-nav { gap: .24rem; }
}
