/* ==========================================================================
   NCSK Applications — store
   Browse = one shelf of app cards. Product = one app: hero + downloads +
   screenshots + notes. Built on the landing tokens and the §6 content panels.
   ========================================================================== */

.apps-hero {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 2.25rem 0 0.5rem;
  gap: 1rem;
}
.apps-hero h1 { font-size: clamp(2.3rem, 4.4vw, 3.6rem); }
.apps-hero .hero-lead { font-size: 1rem; max-width: 46rem; }

.store {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- shelf ---------- */
.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.shelf-head .panel-eyebrow { margin: 0; }
.shelf-count {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.68rem;
  color: var(--ink-3);
}

.shelf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.shelf-app {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.2rem 1.25rem;
  border-left: 1px solid var(--line);
  color: var(--ink);
  transition: background-color 0.14s ease;
}
.shelf-app:first-child { border-left: 0; }
.shelf-app:hover { background: var(--surface-alt); }
.shelf-app:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.shelf-icon { width: 2.75rem; height: 2.75rem; display: block; border-radius: var(--r); }
.shelf-body { display: flex; flex-direction: column; gap: 0.18rem; min-width: 0; }
.shelf-name { font-size: 0.94rem; font-weight: 600; line-height: 1.3; }
.shelf-tag {
  display: block;
  min-width: 0;
  font-size: 0.77rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.shelf-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.4rem;
}
.shelf-version {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.63rem;
  color: var(--ink-3);
}
.shelf-platforms { display: flex; align-items: center; gap: 0.3rem; color: var(--ink-3); font-size: 0.78rem; }
.shelf-arrow {
  position: absolute;
  top: 1.05rem;
  right: 0.9rem;
  font-size: 0.8rem;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity 0.14s ease, color 0.14s ease;
}
.shelf-app:hover .shelf-arrow { opacity: 1; color: var(--blue); }

/* ---------- product ---------- */
.product-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-3);
}
.product-back:hover { color: var(--ink); }
.product-back i { font-size: 0.95rem; }

.product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  grid-template-areas:
    "hero downloads"
    "media downloads";
  gap: 1rem;
  align-items: start;
}
.product-hero { grid-area: hero; min-width: 0; padding: 1.55rem 1.7rem; }
.product-downloads { grid-area: downloads; min-width: 0; position: sticky; top: 1.25rem; padding: 1.15rem 1.3rem; }
.product-media { grid-area: media; min-width: 0; }

.product-head { display: flex; align-items: flex-start; gap: 0.95rem; }
.product-icon { width: 3.4rem; height: 3.4rem; display: block; border-radius: var(--r); flex-shrink: 0; }
.product-id { min-width: 0; }
.product-name {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.product-tag { margin: 0.2rem 0 0; font-size: 0.85rem; line-height: 1.45; color: var(--ink-2); }
.product-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }
.product-version {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--blue);
  background: var(--surface-alt);
  padding: 0.1rem 0.4rem;
  border-radius: var(--r);
}
.product-platforms { display: flex; align-items: center; gap: 0.35rem; color: var(--ink-3); font-size: 0.85rem; }

.product-hero .docs-lead {
  margin: 1.05rem 0 0;
  max-width: 66ch;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink-2);
}

/* ---------- downloads ---------- */
.panel-eyebrow {
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.dl-list .pkg-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}
.dl-list .pkg-card:first-child { border-top: 0; padding-top: 0; }
.dl-list .pkg-card:last-child { padding-bottom: 0; }
.pkg-card-head { display: flex; align-items: flex-start; gap: 0.55rem; }
.pkg-card-icon { color: var(--ink-3); font-size: 1.05rem; margin-top: 0.1rem; flex-shrink: 0; }
.pkg-title { margin: 0; font-size: 0.86rem; font-weight: 600; color: var(--ink); }
.pkg-subtitle { margin: 0.1rem 0 0; font-size: 0.7rem; color: var(--ink-3); }
.pkg-file-meta {
  margin-top: 0.25rem;
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: 0.66rem;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.pkg-sha { margin-top: 0.2rem; font-size: 0.64rem; color: var(--ink-3); }
.pkg-sha summary { cursor: pointer; color: var(--ink-3); }
.pkg-sha code { display: block; margin-top: 0.2rem; font-size: 0.6rem; word-break: break-all; color: var(--ink-3); }
.pkg-card > div:last-child { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.pkg-btn-download, .pkg-btn-obtainium {
  flex: 1 1 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.48rem 0.7rem;
  border: 0;
  border-radius: var(--r);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--e1);
  transition: background-color 0.14s ease, filter 0.14s ease;
}
.pkg-btn-download { background: var(--surface-alt); color: var(--ink); }
.pkg-btn-download:hover { background: var(--surface-hover); }
.pkg-btn-obtainium { background: var(--grad); color: #FFFFFF; }
.pkg-btn-obtainium:hover { filter: brightness(1.06); }
.pkg-btn-obtainium .obtainium-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #FFFFFF;
  overflow: hidden;
}
.pkg-btn-obtainium .obtainium-badge img { width: 16px; height: 16px; display: block; object-fit: contain; }
.pkg-note { margin: 0.85rem 0 0; font-size: 0.72rem; line-height: 1.5; color: var(--ink-3); }

/* ---------- screenshots + notes ---------- */
.media-shots { padding: 1.15rem 1.35rem 1.25rem; }
.media-notes { padding: 1.15rem 1.35rem 1.35rem; border-top: 1px solid var(--line); }
.media-notes .panel-eyebrow { margin-bottom: 0.55rem; }

.shots .docs-hero-screenshots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
}
.shots .docs-screenshot-card {
  margin: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-alt);
  box-shadow: var(--e1);
  cursor: zoom-in;
}
.shots .docs-screenshot-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}
.shots .docs-screenshot-badge { display: none; }
.shots .app-showcase {
  max-width: 680px;
  margin: 0;
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--e1);
  line-height: 0;
  cursor: zoom-in;
}
.shots .app-showcase img { display: block; width: 100%; height: auto; }

.media-notes .docs-notes-plain {
  display: grid;
  gap: 0.4rem;
  max-width: 66ch;
  margin: 0;
  padding-left: 1.05rem;
}
.media-notes .docs-notes-plain li {
  padding-left: 0.1rem;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.media-notes .docs-notes-plain li::marker { color: var(--ink-3); }
.media-notes .docs-notes-plain li strong { color: var(--ink); font-weight: 600; }

/* ---------- more by NCSK ---------- */
.more { margin-top: 1.1rem; }
.more .panel-eyebrow { margin: 0 0 0.6rem 0.1rem; }
.more-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.55rem; }
.more-app {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--e1);
  color: var(--ink);
  transition: background-color 0.14s ease;
}
.more-app:hover { background: var(--surface-alt); }
.more-icon { width: 1.9rem; height: 1.9rem; display: block; border-radius: var(--r); flex-shrink: 0; }
.more-text { display: flex; flex-direction: column; min-width: 0; }
.more-name { font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-version { font-family: ui-monospace, "JetBrains Mono", monospace; font-size: 0.63rem; color: var(--ink-3); }

/* ---------- lightbox ---------- */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: rgba(6, 10, 18, 0.86);
}
.lightbox-modal.active { display: flex; }
.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  max-width: 94vw;
}
.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
  border-radius: var(--r);
  box-shadow: var(--e2);
  background: rgba(0, 0, 0, 0.35);
}
.lightbox-stage.is-zoomed { cursor: grab; }
.lightbox-stage.is-dragging { cursor: grabbing; }
.lightbox-img {
  display: block;
  max-width: 88vw;
  max-height: 76vh;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
}
.lightbox-caption-text {
  max-width: 72ch;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #B2C0D4;
  text-align: center;
}
.lightbox-close-btn {
  position: absolute;
  top: -2.7rem;
  right: 0;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--e2);
  cursor: pointer;
}
.lightbox-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 2.6rem;
  height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--e2);
  cursor: pointer;
}
.lightbox-prev { left: 1.4vw; }
.lightbox-next { right: 1.4vw; }
.lightbox-modal.is-single .lightbox-nav-btn { display: none; }

.lightbox-modal.is-zoomed { padding: 0; }
.lightbox-modal.is-zoomed .lightbox-content,
.lightbox-modal.is-zoomed .lightbox-stage {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.lightbox-modal.is-zoomed .lightbox-img { max-width: 100vw; max-height: 100vh; }
.lightbox-modal.is-zoomed .lightbox-caption-text,
.lightbox-modal.is-zoomed .lightbox-nav-btn { opacity: 0; pointer-events: none; }
.lightbox-modal.is-zoomed .lightbox-close-btn { position: fixed; top: 12px; right: 12px; }

/* ---------- shared ---------- */
i[class*="mgc-"] { font-style: normal; line-height: 1; display: inline-block; }
.distro-icon {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.app-brand-prefix {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[hidden] { display: none !important; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .shelf { grid-template-columns: minmax(0, 1fr); }
  .shelf-app {
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.1rem;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .shelf-app:first-child { border-top: 0; }
  .shelf-icon { width: 2.2rem; height: 2.2rem; flex-shrink: 0; }
  .shelf-body { flex: 1; }
  .shelf-tag {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .shelf-meta { margin-top: 0; padding-top: 0.1rem; }
  .shelf-arrow {
    position: static;
    opacity: 1;
    flex: 0 0 auto;
    margin-left: 0.35rem;
    font-size: 0.9rem;
  }

  .product-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "hero" "downloads" "media";
  }
  .product-downloads { position: static; }
}

@media (max-width: 720px) {
  .apps-hero { padding: 1.75rem 0 1.25rem; }
  .apps-hero h1 { font-size: clamp(2.1rem, 8vw, 2.7rem); }
  .apps-hero .hero-lead { font-size: 0.92rem; }

  .shelf-head { padding: 0.75rem 1rem; }
  .shelf-app { padding: 0.75rem 1rem; }

  .product-hero { padding: 1.2rem 1.15rem 1.3rem; }
  .product-icon { width: 2.8rem; height: 2.8rem; }
  .product-name { font-size: 1.3rem; }
  .product-tag { font-size: 0.8rem; }
  .product-downloads { padding: 1.1rem 1.15rem; }
  .media-shots { padding: 1rem 1.15rem; }
  .media-notes { padding: 1rem 1.15rem 1.2rem; }

  .shots .docs-hero-screenshots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.5rem;
    padding-bottom: 0.3rem;
  }
  .shots .docs-screenshot-card { flex: 0 0 82%; scroll-snap-align: start; }
  .shots .app-showcase { max-width: 100%; }

  .more-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .lightbox-modal { padding: 1rem; }
  .lightbox-close-btn { top: -2.5rem; }
}
