/* ==========================================================================
   Components: navigation, laptop mockup, screen content, tags
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Floating top bar                                                           */
/* -------------------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 14px;
  left: 0;
  right: 0;
  z-index: 50;
  width: min(100% - 24px, 940px);
  height: var(--topbar-h);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  background: var(--nav-bg);
  box-shadow: var(--nav-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  transition: background-color var(--dur-2) ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand__mark {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: #000;
}

.nav__list {
  display: flex;
  gap: 2px;
}

/* Like VitePress's navbar links: plain text, brand color when hovered or active. */
.nav__link {
  display: block;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: color 0.25s;
}

.nav__link:hover,
.nav__link.is-active {
  color: var(--brand-1);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.icon-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition:
    color var(--dur-2) ease,
    background-color var(--dur-2) ease;
}

.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
  color: var(--text);
  background: var(--line);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* Theme toggle shows the sun in dark mode and the moon in light mode. */
.theme-icon--moon,
:root[data-theme="light"] .theme-icon--sun {
  display: none;
}

:root[data-theme="light"] .theme-icon--moon {
  display: inline-flex;
}

/* -------------------------------------------------------------------------- */
/* Language menu                                                              */
/* -------------------------------------------------------------------------- */

.lang {
  position: relative;
}

.lang__menu {
  position: absolute;
  top: calc(100% + 12px);
  right: -4px;
  min-width: 200px;
  padding: 6px;
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: var(--menu-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition:
    opacity var(--dur-2) var(--ease-out),
    transform var(--dur-2) var(--ease-out),
    visibility 0s linear var(--dur-2);
}

.lang.is-open .lang__menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.lang__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-s);
  font-size: var(--fs-s);
  color: var(--text-muted);
  text-align: left;
  transition:
    color var(--dur-1) ease,
    background-color var(--dur-1) ease;
}

.lang__option:hover,
.lang__option:focus-visible {
  color: var(--text);
  background: var(--line);
  outline: none;
}

.lang__option[aria-current="true"] {
  color: var(--text);
}

.lang__option-code {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-faint);
}

.lang__option[aria-current="true"] .lang__option-code {
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* Mobile menu                                                                */
/* -------------------------------------------------------------------------- */

.menu-toggle {
  display: none;
}

.menu-toggle__lines {
  position: relative;
  width: 16px;
  height: 10px;
}

.menu-toggle__lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transition:
    transform var(--dur-2) var(--ease-out),
    top var(--dur-2) var(--ease-out);
}

.menu-toggle__lines span:first-child {
  top: 1px;
}

.menu-toggle__lines span:last-child {
  top: 7.5px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__lines span:first-child {
  top: 4.25px;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__lines span:last-child {
  top: 4.25px;
  transform: rotate(-45deg);
}

/* Full-screen menu on phones, a plain list of links like VitePress's mobile nav. */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: calc(var(--topbar-h) + 40px) var(--gutter) max(32px, env(safe-area-inset-bottom));
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s,
    visibility 0s linear 0.25s;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.mobile-menu__list {
  display: grid;
  gap: 4px;
}

.mobile-menu__list a {
  display: block;
  padding: 12px 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  transition: color 0.25s;
}

.mobile-menu__list a.is-active,
.mobile-menu__list a:hover {
  color: var(--brand-1);
}

@media (max-width: 860px) {
  .nav {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }
}

/* Small phones: a smaller avatar and tighter buttons keep everything in the bar. */
@media (max-width: 400px) {
  :root {
    --topbar-h: 64px;
  }

  .topbar {
    gap: 8px;
  }

  .brand {
    gap: 8px;
    font-size: 14px;
  }

  .brand__mark {
    width: 48px;
    height: 48px;
  }

  .icon-btn {
    min-width: 36px;
    padding: 0 8px;
  }
}

@media (max-width: 340px) {
  .brand {
    font-size: 12px;
  }

  .brand__mark {
    width: 44px;
    height: 44px;
  }
}

/* -------------------------------------------------------------------------- */
/* Laptop mockup                                                              */
/* All inner sizes use cqw so the device scales as one piece.                 */
/* -------------------------------------------------------------------------- */

.device {
  container-type: inline-size;
  position: relative;
  width: 100%;
  isolation: isolate;
}

.device__lid {
  position: relative;
  width: 84%;
  margin-inline: auto;
  padding: 0.42cqw;
  border-radius: 2.1cqw 2.1cqw 0.5cqw 0.5cqw;
  background: var(--device-shell);
  box-shadow:
    inset 0 0 0 1px var(--device-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    var(--device-lift);
}

.device__bezel {
  position: relative;
  padding: 1.35cqw 1.3cqw 1.55cqw;
  border-radius: 1.75cqw 1.75cqw 0.35cqw 0.35cqw;
  background: #050506;
}

.device__camera {
  position: absolute;
  top: 0.45cqw;
  left: 50%;
  width: 0.5cqw;
  height: 0.5cqw;
  margin-left: -0.25cqw;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #313848 0%, #0a0b0f 70%);
}

.device__screen {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 0.45cqw;
  background: var(--screen-bg);
  isolation: isolate;
}

/* Soft glass reflection across the screen. */
.device__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 36%);
}

.device__hinge {
  width: 76%;
  height: 0.55cqw;
  margin-inline: auto;
  border-radius: 0 0 0.6cqw 0.6cqw;
  background: linear-gradient(180deg, #050506 0%, var(--device-base-mid) 100%);
}

.device__base {
  position: relative;
  width: 100%;
  height: 1.7cqw;
  margin-top: -0.2cqw;
  border-radius: 0.3cqw 0.3cqw 3cqw 3cqw / 0.3cqw 0.3cqw 1.4cqw 1.4cqw;
  background: linear-gradient(
    180deg,
    var(--device-base-top) 0%,
    var(--device-base-mid) 38%,
    var(--device-base-bottom) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 1px rgba(0, 0, 0, 0.25);
}

/* Thumb notch to open the lid. */
.device__base::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 12%;
  height: 0.6cqw;
  transform: translateX(-50%);
  border-radius: 0 0 0.9cqw 0.9cqw;
  background: linear-gradient(180deg, var(--device-groove) 0%, var(--device-base-mid) 100%);
}

.device__shadow {
  position: absolute;
  z-index: -1;
  left: 6%;
  right: 6%;
  bottom: -2.4cqw;
  height: 4cqw;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--device-shadow), transparent);
  filter: blur(1.2cqw);
}

/* -------------------------------------------------------------------------- */
/* Miniature browser window (inside the screen)                               */
/* -------------------------------------------------------------------------- */

.browser {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--screen-bg);
}

.browser__bar {
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 3.1cqw;
  padding: 0 1.2cqw;
  background: var(--chrome-bg);
  border-bottom: 1px solid var(--chrome-line);
}

.browser__dots {
  display: flex;
  gap: 0.55cqw;
}

.browser__dots span {
  width: 0.7cqw;
  height: 0.7cqw;
  border-radius: 50%;
  background: var(--chrome-dot);
}

.browser__url {
  min-width: 24cqw;
  max-width: 40cqw;
  height: 1.85cqw;
  padding: 0 1.4cqw;
  overflow: hidden;
  border-radius: 0.55cqw;
  background: var(--chrome-url-bg);
  color: var(--chrome-text);
  font-size: 0.95cqw;
  font-weight: 500;
  line-height: 1.85cqw;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.browser__view {
  position: relative;
  flex: 1;
  overflow: hidden;
}

/* Screenshot. Tall captures scroll from top to bottom on hover. */
.shot {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--screen-bg);
}

.shot img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.shot.is-tall img {
  height: auto;
  transition:
    top var(--scroll-dur, 6s) var(--ease-in-out),
    transform var(--scroll-dur, 6s) var(--ease-in-out);
}

.is-scrollable:hover .shot.is-tall img,
.is-scrollable:focus-visible .shot.is-tall img {
  top: 100%;
  transform: translateY(-100%);
}

.shot.is-broken img {
  display: none;
}

/* Slideshow (hero): screenshots cross-fade. */
.slides {
  position: absolute;
  inset: 0;
}

.slides .shot {
  opacity: 0;
  transition: opacity 1200ms var(--ease-in-out);
}

.slides .shot.is-active {
  opacity: 1;
}

/* Hero wallpaper shown when there is no screenshot yet. */
.wallpaper {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(55% 75% at 18% 12%, rgba(var(--glow-rgb), 0.42), transparent 62%),
    radial-gradient(45% 65% at 88% 92%, rgba(255, 150, 110, 0.2), transparent 62%),
    radial-gradient(40% 50% at 70% 20%, rgba(90, 200, 220, 0.12), transparent 60%),
    linear-gradient(160deg, #11111a 0%, #07070a 100%);
}

.wallpaper__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.5cqw;
  padding: 0 1.6cqw;
  background: rgba(0, 0, 0, 0.22);
  -webkit-backdrop-filter: blur(1cqw);
  backdrop-filter: blur(1cqw);
  font-size: 0.95cqw;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
}

.wallpaper__bar-left {
  display: flex;
  align-items: center;
  gap: 1.4cqw;
}

.wallpaper__bar-left i {
  width: 0.8cqw;
  height: 0.8cqw;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.wallpaper__center {
  display: grid;
  justify-items: center;
  gap: 1.3cqw;
  text-align: center;
}

.wallpaper__name {
  font-family: var(--font-display);
  font-size: 6.4cqw;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.035em;
}

.wallpaper__role {
  font-family: var(--font-sans);
  font-size: 1.05cqw;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.wallpaper__dock {
  position: absolute;
  bottom: 1.4cqw;
  left: 50%;
  display: flex;
  gap: 0.9cqw;
  padding: 0.8cqw;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.4cqw;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(1cqw);
  backdrop-filter: blur(1cqw);
}

.wallpaper__dock i,
.wallpaper__dock img {
  width: 3cqw;
  height: 3cqw;
  border-radius: 0.8cqw;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
}

.wallpaper__dock img {
  padding: 0.28cqw;
  object-fit: contain;
}

/* -------------------------------------------------------------------------- */
/* Tags                                                                       */
/* -------------------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* VitePress's VPBadge: gray by default, brand-tinted with .tag--brand. */
.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--line);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition:
    color 0.25s,
    background-color 0.25s;
}

.tag--brand {
  background: var(--brand-soft);
  color: var(--brand-1);
}

a.tag:hover {
  color: var(--brand-1);
}

.tag.is-pending {
  width: var(--w, 72px);
  background: var(--skeleton);
}
