/* Feature Browser - page-specific styles. Shared header/brand rules live in styles.css. */

html {
  scroll-behavior: smooth;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--ns-border);
  color: var(--fg-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.back-link:hover {
  border-color: var(--ns-blue-400);
  background: rgba(64, 153, 217, 0.1);
  color: var(--fg-primary);
}

.back-link svg {
  width: 14px;
  height: 14px;
}

.site-nav {
  justify-content: space-between;
}

main {
  position: relative;
  z-index: 1;
}

.intro {
  max-width: 1280px;
  margin: 0 auto;
  padding: 72px 32px 56px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ns-blue-400);
  margin-bottom: 18px;
}

.intro-h {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.01em;
  max-width: 900px;
  margin: 0 0 22px;
}

.intro-h span {
  background: var(--gradient-text);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.intro-lede {
  max-width: 640px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg-secondary);
  margin: 0 0 20px;
}

.intro-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ns-text-muted);
  letter-spacing: 0.02em;
}

.intro-meta strong {
  color: var(--fg-primary);
  font-weight: 600;
}

.browser {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 56px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px 140px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 96px;
}

.rail-track {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ns-text-muted);
  margin-bottom: 6px;
  padding: 0 14px;
}

.rail-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.rail-btn-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rail-btn:hover {
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.03);
}

.rail-btn.active {
  color: var(--fg-primary);
  background: rgba(64, 153, 217, 0.1);
  border-color: rgba(64, 153, 217, 0.32);
}

.rail-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ns-text-muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 1px 7px;
}

/* Mobile-only jump dropdown, populated from .rail-track by features.js. Hidden on desktop. */
.rail-select {
  display: none;
}

/* Open-slot rail links share one generic label; number them by position
   so slots stay distinguishable without hand-typing "#07", "#08", etc. */
.rail-group--open {
  counter-reset: open-slot;
}

.rail-group--open .rail-btn-text::before {
  counter-increment: open-slot;
  content: "Slot " counter(open-slot) ": ";
  color: var(--ns-text-muted);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 108px;
  counter-reset: feature-counter;
}

.feature-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 52px;
  align-items: center;
  scroll-margin-top: 96px;
}

.feature-band:not(.is-open) {
  counter-increment: feature-counter;
}

/* Alternates media/content side automatically by document position -
   inserting or removing a feature anywhere never needs a manual "reverse" class. */
.feature-band:nth-of-type(even) .f-media {
  order: 2;
}

.feature-band:nth-of-type(even) .f-content {
  order: 1;
}

.f-media {
  position: relative;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 16 / 10.5;
  background: linear-gradient(135deg, #1c1c24 0%, #1a1a28 100%);
  border: 1px solid var(--ns-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: zoom-in;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

button.f-media:hover {
  transform: translateY(-2px);
  border-color: var(--ns-border-bright);
}

.f-media.is-open {
  background: rgba(255, 255, 255, 0.015);
  border: 1.5px dashed var(--ns-border-bright);
  box-shadow: none;
  cursor: default;
}

.f-media-icon {
  width: 46px;
  height: 46px;
  opacity: 0.5;
}

.f-media-icon svg {
  width: 100%;
  height: 100%;
}

.f-media-icon--blue { color: var(--ns-blue-300); }
.f-media-icon--purple { color: var(--ns-purple-200); }
.f-media-icon--muted { color: var(--ns-text-muted); }

.f-media-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.shot-tag {
  position: absolute;
  left: 14px;
  top: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ns-text-muted);
  background: rgba(10, 10, 15, 0.65);
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--ns-border);
}

.f-content {
  min-width: 0;
}

.f-index {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ns-text-muted);
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.f-index::before {
  content: counter(feature-counter, decimal-leading-zero);
}

.f-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.f-chip--blue { background: rgba(64, 153, 217, 0.12); color: #69b4ff; border: 1px solid rgba(64, 153, 217, 0.3); }
.f-chip--purple { background: rgba(146, 84, 222, 0.14); color: #d3adf7; border: 1px solid rgba(146, 84, 222, 0.32); }
.f-chip--muted { background: rgba(255, 255, 255, 0.04); color: var(--ns-text-muted); border: 1px solid var(--ns-border); }

.f-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.12;
  color: var(--fg-primary);
  margin: 0 0 14px;
}

.f-body {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--fg-secondary);
  max-width: 460px;
  margin: 0;
}

.feature-band.is-open .f-headline,
.feature-band.is-open .f-body {
  color: var(--ns-text-muted);
}

.cta-band {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px 120px;
  text-align: center;
}

.cta-inner {
  border-top: 1px solid var(--ns-border);
  padding-top: 64px;
}

.cta-returning {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 2px #ffffff, 0 0 8px rgba(105, 180, 255, 0.9), 0 0 16px rgba(146, 84, 222, 0.8);
  margin-bottom: 14px;
}

.cta-band .cta-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ns-text-muted);
  max-width: 460px;
  margin: 0 auto;
}

/* Lightbox preview */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(6, 6, 10, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--ns-border);
  background: rgba(20, 20, 25, 0.8);
  color: var(--fg-primary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lightbox-close:hover {
  border-color: var(--ns-border-bright);
  background: rgba(28, 28, 36, 0.9);
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
}

.lightbox-panel {
  width: min(100%, 1100px);
}

.lightbox-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(135deg, #1c1c24 0%, #1a1a28 100%);
  border: 1px solid var(--ns-border-bright);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 48px rgba(64, 153, 217, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media .f-media-icon {
  width: 96px;
  height: 96px;
  opacity: 0.45;
}

.lightbox-media-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lightbox-caption {
  margin-top: 20px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--fg-primary);
}

@media (max-width: 980px) {
  .browser {
    display: block;
    padding: 0 24px 100px;
  }

  .rail {
    position: sticky;
    top: 56px;
    margin-bottom: 28px;
    padding: 12px 0;
    background: #0d0d13;
    z-index: 15;
  }

  /* Horizontal chip strip doesn't hold up on mobile (cramped, sticky/scroll
     glitches on real devices) - swap it for a plain jump dropdown instead. */
  .rail-track {
    display: none;
  }

  .rail-select {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--ns-border);
    background: var(--ns-card);
    color: var(--fg-primary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 600;
  }

  .feature-band {
    grid-template-columns: 1fr;
    gap: 22px;
    /* Mobile's sticky bar (select + padding) is taller than the desktop nav
       offset this inherits by default - give jumps extra clearance. */
    scroll-margin-top: 140px;
  }

  .feature-band:nth-of-type(even) .f-media,
  .feature-band:nth-of-type(even) .f-content {
    order: 0;
  }

  .feature-list {
    gap: 72px;
  }

  .intro {
    padding: 44px 20px 40px;
  }

  .lightbox {
    padding: 24px;
  }
}

@media (max-width: 560px) {
  .back-link span {
    display: none;
  }

  .intro-h {
    font-size: clamp(30px, 9vw, 40px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
