.os-scroll-stop {
  position: absolute;
  inset-inline-start: 0;
  pointer-events: none;
}

.os-nav-short {
  display: none;
}

.journey {
  height: 975vh;
}

.scene.os-chapter {
  padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .journey-pin:has(.os-chapter:not([inert])) { overflow: clip; }
}

.journey-pin:has(.os-inspecting) :is(.stage-nav, .journey-status) { opacity: 0; }

.os-layout {
  position: absolute;
  inset: 0;
  isolation: isolate;
}

.os-heading {
  position: absolute;
  z-index: 1;
  inset: max(78px, 10dvh) 18px auto;
  pointer-events: none;
}

.os-heading h2 {
  margin: 0 0 9px;
  font-size: clamp(31px, 4vw, 52px);
}

.os-heading p {
  margin: 0 auto;
  color: #e4d8ee;
  font-size: 14px;
  text-shadow: 0 2px 12px #000, 0 2px 20px #000;
}

.os-orbit {
  --orbit-center-y: 54.5%;
  --orbit-radius-x: min(35vw, 620px);
  --orbit-edge-space: 24px;
  --orbit-y: min(13.5dvh, 150px);
  --glyph-size: clamp(54px, 6.25vw, 96px);
  position: absolute;
  inset: 0;
}

.os-tiles {
  --orbit-x: min(var(--orbit-radius-x), calc(var(--orbit-half-width, 50vw) - var(--glyph-size) / 2 - var(--orbit-edge-space)));
  position: absolute;
  inset: 0;
}

.os-tiles::before,
.os-tiles::after {
  content: '';
  position: absolute;
  left: 50%;
  top: var(--orbit-center-y);
  width: calc(var(--orbit-x) * 2);
  height: calc(var(--orbit-y) * 2);
  border-radius: 50%;
  border: 1px solid #a079d132;
  box-shadow: 0 0 28px #8b31f00e, inset 0 0 28px #8b31f00e;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.os-tiles::before {
  mask-image: radial-gradient(circle, transparent var(--os-core-radius), #000 calc(var(--os-core-radius) + 1px));
}

.os-tiles::after {
  clip-path: inset(50% 0 0);
}

.os-tile {
  --position: calc(var(--orbit-turn) + var(--orbit-phase, 0turn) + var(--orbit-scroll, 0turn));
  --height: sin(var(--position));
  --depth-scale: calc(0.94 + var(--height) * .13);
  position: absolute;
  left: calc(50% + cos(var(--position)) * var(--orbit-x));
  top: calc(var(--orbit-center-y) + var(--height) * var(--orbit-y));
  width: var(--glyph-size);
  height: var(--glyph-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f5eef9;
  cursor: pointer;
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity .45s ease, scale .55s ease, filter .45s ease;
}

.os-orbit-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.os-tile.os-behind:not(:focus-visible) .os-orbit-art {
  /* The mask extends beyond the button so a tilted logo can keep its full silhouette. */
  mask-size: calc(100% + 96px) calc(100% + 96px);
  mask-position: center;
  mask-repeat: no-repeat;
  mask-clip: no-clip;
  mask-image: radial-gradient(
    circle at calc(50% - cos(var(--position)) * var(--orbit-x))
              calc(50% - var(--height) * var(--orbit-y)),
    transparent calc(var(--os-core-radius) - 1px),
    #000 calc(var(--os-core-radius) + 1px)
  );
}

.os-tile.os-eclipsed:not(:focus-visible) { pointer-events: none; }

.os-inspecting .os-heading,
.os-inspecting .os-tiles::before,
.os-inspecting .os-tiles::after { opacity: 0; }

.os-heading,
.os-tiles::before,
.os-tiles::after { transition: opacity .4s ease; }

.os-inspecting .os-tile {
  opacity: 0;
  scale: .7;
  filter: blur(5px);
}

.os-inspecting .os-tile.os-selected { transition: none; }

.os-tile:focus-visible {
  outline: 1px solid var(--os-color);
  outline-offset: 6px;
}

.os-tile:is(:hover, :focus-visible) {
  z-index: 2;
}

.os-glyph {
  position: absolute;
  inset: 4%;
  perspective: 430px;
  transform: scale(var(--depth-scale));
  pointer-events: none;
}

.os-solid {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: os-twirl 22s ease-in-out var(--spin-delay, 0s) infinite;
}

@keyframes os-twirl {
  0% { transform: rotateX(-11deg) rotateY(-26deg) rotateZ(-6deg); }
  25% { transform: rotateX(13deg) rotateY(24deg) rotateZ(4deg); }
  52% { transform: rotateX(-7deg) rotateY(-24deg) rotateZ(-7deg); }
  70% { transform: rotateX(12deg) rotateY(172deg) rotateZ(4deg); }
  84% { transform: rotateX(7deg) rotateY(337deg) rotateZ(7deg); }
  100% { transform: rotateX(-11deg) rotateY(334deg) rotateZ(-6deg); }
}

.os-face,
.os-layer {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 0;
}

.os-layer {
  --layer-light: calc(31% + var(--layer) * 4%);
  transform: translateZ(calc((var(--layer) - 5) * .88px));
  background: color-mix(in srgb, var(--os-color) var(--layer-light), #130b1f);
  mask: var(--os-mask) center / contain no-repeat;
}

.os-face {
  transform: translateZ(5px);
}

.os-face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(1.22) drop-shadow(0 0 9px color-mix(in srgb, var(--os-color), transparent 64%));
}

[data-os="debian"] .os-face img,
[data-os="kali"] .os-face img {
  filter: brightness(1.7) drop-shadow(0 0 9px color-mix(in srgb, var(--os-color), transparent 58%));
}

[data-os="shell"] .os-layer,
.os-shell-mark {
  background: none;
  color: var(--os-color);
  font: 750 14px/1 Inter, Arial, sans-serif;
  letter-spacing: -.12em;
}

[data-os="shell"] .os-layer,
.os-glyph .os-shell-mark {
  font-size: calc(var(--glyph-size) * .55);
}

[data-os="shell"] .os-layer {
  color: color-mix(in srgb, var(--os-color) var(--layer-light), #130b1f);
}

.os-glyph .os-shell-mark {
  text-shadow: 0 0 14px color-mix(in srgb, var(--os-color), transparent 57%);
}

.os-name {
  position: absolute;
  inset: calc(100% + 2px) -20px auto;
  color: #f0e7f8;
  font: 600 12px/1.24 Inter, Arial, sans-serif;
  text-align: center;
  text-shadow: 0 1px 3px #08050f, 0 0 8px #08050f, 0 0 18px #08050f;
  pointer-events: none;
  opacity: var(--os-caption-opacity, 1);
}

.os-tile:is(:hover, :focus-visible) .os-name {
  color: var(--os-color);
}

.os-tile:focus-visible .os-name { opacity: 1; }

.os-chapter[inert] .os-solid,
.os-tile:is(.os-hovered, :focus-visible) .os-solid {
  animation-play-state: paused;
}

.os-drawer-open {
  overflow: hidden;
}

dialog.os-catalog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f4effa;
  overflow: auto;
  overscroll-behavior: contain;
}

dialog.os-catalog::backdrop {
  background: #09051667;
}

.os-blueprint {
  --focus-y: 54.5dvh;
  --focus-size: clamp(126px, 17vmin, 175px);
  --sheet-gutter: max(7%, calc((100% - 1150px) / 2));
  --node-width: clamp(180px, 23vw, 295px);
  --rule: color-mix(in srgb, var(--os-color) 57%, #706187);
  position: relative;
  isolation: isolate;
  min-height: 100%;
  text-align: left;
}

.os-blueprint::before {
  content: '';
  position: absolute;
  inset: 11dvh 3vw 4dvh;
  z-index: -1;
  background: linear-gradient(#cebdff17 1px, transparent 1px), linear-gradient(90deg, #cebdff17 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 78%);
  pointer-events: none;
}

.os-blueprint-nav {
  position: absolute;
  z-index: 3;
  top: max(82px, 11dvh);
  left: var(--sheet-gutter);
}

.os-close {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid #e6d5ff59;
  border-radius: 6px;
  background: #110c1ee0;
  color: #eee4ff;
  font: 600 12px/1.2 Inter, Arial, sans-serif;
  cursor: pointer;
}

.os-close:hover { border-color: #d9c4ff; background: #261b3b; }

.os-focus-visual {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.os-focus-guide {
  position: absolute;
  top: var(--focus-y);
  left: 50%;
  width: calc(var(--focus-size) * 1.5);
  aspect-ratio: 1;
  border: 1px dashed var(--rule);
  border-radius: 50%;
  opacity: .66;
  transform: translate(-50%, -50%);
  animation: os-sheet-enter .45s .38s both;
}

.os-focus-guide::before,
.os-focus-guide::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--rule);
  transform: translate(-50%, -50%);
  opacity: .45;
}

.os-focus-guide::before { width: 124%; height: 1px; }
.os-focus-guide::after { width: 1px; height: 124%; }

.os-focus-model {
  --glyph-size: var(--focus-size);
  --depth-scale: 1;
  position: absolute;
  top: calc(var(--focus-y) - var(--focus-size) / 2);
  left: calc(50% - var(--focus-size) / 2);
  width: var(--focus-size);
  height: var(--focus-size);
  perspective: 580px;
}

.os-focus-twist {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.os-focus-model .os-solid {
  animation: none;
  transform: rotateX(-10deg) rotateY(-18deg) rotateZ(-5deg);
}

.os-focus-model .os-face img {
  filter: brightness(1.3) drop-shadow(0 0 17px color-mix(in srgb, var(--os-color), transparent 53%));
}

.os-detail {
  position: static;
  min-height: 0;
  padding: 0;
  overflow: visible;
  animation: os-sheet-enter .44s .35s both;
}

@keyframes os-sheet-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

.os-detail-heading {
  position: absolute;
  top: max(100px, 15.4dvh);
  left: 50%;
  width: max-content;
  max-width: 92vw;
  transform: translateX(-50%);
  text-align: center;
}

.os-detail-heading h3 {
  margin: 0;
  font-size: clamp(30px, 5vw, 59px);
  font-weight: 670;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.os-detail-heading p {
  margin: 8px 0 0;
  color: #e0d2ee;
  font-size: 13px;
  text-shadow: none;
}

.os-node {
  position: absolute;
  top: var(--focus-y);
  width: var(--node-width);
  padding: 16px 17px;
  transform: translateY(-50%);
}

.os-node-standard { left: var(--sheet-gutter); }
.os-node-desktop { right: var(--sheet-gutter); }

.os-node h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 9px;
  color: #fbf6ff;
  font: 650 14px/1.25 Inter, Arial, sans-serif;
  letter-spacing: -.015em;
}

.os-panel-mark {
  display: grid;
  flex: 0 0 29px;
  height: 29px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--os-color) 27%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--os-color) 12%, #1a1226);
  color: color-mix(in srgb, var(--os-color) 70%, #fff);
}

.os-panel-mark::before {
  content: '';
  width: 11px;
  height: 1px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 -4px, 0 4px;
}

.os-node-desktop .os-panel-mark::before {
  width: 12px;
  height: 8px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: transparent;
  box-shadow: 0 4px 0 -3px currentColor;
}

@media (max-width: 900px) {
  .os-orbit { --orbit-radius-x: 38vw; }
}

@media (max-width: 810px) {
  .os-nav-full { display: none; }
  .os-nav-short { display: inline; }
}

@media (max-width: 740px) {
  .journey { height: 855vh; }
  .os-orbit {
    --orbit-radius-x: min(38vw, 266px);
    --orbit-y: min(12.8dvh, 150px);
    --glyph-size: clamp(44px, 12vw, 63px);
  }
  .os-heading { top: max(88px, 12dvh); }
  .os-heading h2 { font-size: clamp(26px, 7.5vw, 38px); }
  .os-heading p { font-size: 13px; }
  .os-name { font-size: 10px; }
}

@media (max-width: 365px) {
  .site-header .brand { font-size: 12px; }
  .site-header nav a { padding-inline: 4px; }
}

@media (max-height: 600px) {
  .os-heading { top: max(75px, 9dvh); }
  .os-heading h2 { font-size: clamp(24px, 4vh, 34px); }
  .os-heading p { font-size: 12px; }
  .os-orbit {
    --orbit-y: 13dvh;
    --glyph-size: clamp(32px, 11dvh, 60px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey { height: auto; }
  .os-scroll-stop { display: none; }
  .scene.os-chapter { scroll-margin-top: 65px; }
  .os-solid, .os-detail, .os-focus-guide { animation: none; }
  .os-tile, .os-heading, .os-tiles::before, .os-tiles::after { transition: none; }
  .os-tile.os-behind:not(:focus-visible) .os-orbit-art, .os-tiles::before { mask-image: none; }
  .os-name { opacity: 1; }
  .os-tile.os-eclipsed:not(:focus-visible) { pointer-events: auto; }
  .os-solid { transform: rotateX(-8deg) rotateY(-22deg) rotateZ(-5deg); }
}
