/* Shared thin scrollbar */
.ps-scroll-thin,
.modalThumbs,
.modalCardBody {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,45,45,0.72) rgba(255,255,255,0.1);
}
.ps-scroll-thin::-webkit-scrollbar,
.modalThumbs::-webkit-scrollbar,
.modalCardBody::-webkit-scrollbar { width: 8px; height: 8px; }
.ps-scroll-thin::-webkit-scrollbar-track,
.modalThumbs::-webkit-scrollbar-track,
.modalCardBody::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 999px; }
.ps-scroll-thin::-webkit-scrollbar-thumb,
.modalThumbs::-webkit-scrollbar-thumb,
.modalCardBody::-webkit-scrollbar-thumb { background: rgba(255,45,45,0.78); border-radius: 999px; }

/* Modal */
.modal {
  position: fixed;
  top: 3vh;
  left: 0;
  right: 0;
  width: min(1600px, calc(100% - 32px));
  border: 1px solid var(--frame-border);
  border-radius: var(--frame-radius-lg);
  background: var(--frame-surface-strong);
  color: var(--text);
  box-shadow: 0 26px 72px rgba(0,0,0,0.62);
  padding: 0;
  margin: 0 auto;
  height: auto;
  max-height: calc(100vh - 6vh);
  overflow: hidden;
}

@media (min-width: 1100px) {
  .modal {
    height: min(850px, calc(100vh - 6vh));
  }
  .modalInner {
    height: 100%;
    max-height: none;
  }
}


.modal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(600px 220px at 10% -10%, var(--frame-fade-blue), transparent 60%),
    radial-gradient(600px 220px at 95% 0%, var(--frame-fade-red), transparent 65%);
  opacity: 0.7;
}

.modal::backdrop {
  background: rgba(0,0,0,.6);
  animation: backdropIn .2s ease;
}

.modal[open] {
  animation: modalIn .22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modalInner {
  position: relative;
  z-index: 1;
  padding: 26px;
  max-height: calc(100vh - 6vh);
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding-top: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,45,45,0.72) rgba(255,255,255,0.12);
}
.modalInner::-webkit-scrollbar { width: 10px; height: 10px; }
.modalInner::-webkit-scrollbar-track { background: rgba(255,255,255,0.06); border-radius: 999px; }
.modalInner::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,45,45,0.92), rgba(185,15,31,0.92));
  border: 2px solid rgba(10,10,18,0.85);
  border-radius: 999px;
}

.modalBody {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 26px;
  align-items: start;
}

.modalMediaCol {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.modalPreview {
  appearance: none;
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  border-radius: var(--frame-radius-lg);
  padding: 16px;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  min-height: clamp(240px, 34vh, 400px);
  max-height: clamp(320px, 52vh, 520px);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.modalPreview img {
  width: 100%;
  height: 100%;
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  border-radius: var(--frame-radius-md);
  background: rgba(9,9,16,0.92);
}

.modalPreviewGlow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px 180px at 20% 10%, rgba(255,255,255,0.08), transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.modalPreview::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 35%, rgba(255,45,45,0.9) 50%, transparent 65%);
  opacity: 0.6;
  background-size: 220% 100%;
  animation: scanline 18s ease-in-out infinite;
  mix-blend-mode: screen;
}

.modalPreview:hover,
.modalPreview:focus-visible {
  border-color: var(--accent-magenta-border);
  box-shadow: var(--frame-shadow-hover), var(--glow-magenta-soft);
  transform: translateY(-1px);
}

.modalPreview.is-hidden { display: none; }

.modalPreview.is-landscape { aspect-ratio: 16 / 10; }
.modalPreview.is-portrait { aspect-ratio: 3 / 4; }

.modalPreview.is-square {
  aspect-ratio: 1 / 1;
  min-height: clamp(200px, 28vh, 320px);
  max-height: 46vh;
}

.modalPreview.is-square img {
  width: 62%;
  height: 62%;
}

.modalHeroCaption {
  align-self: center;
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  color: rgba(245,247,255,0.92);
  border-radius: var(--frame-radius-sm);
  background: var(--frame-surface);
  border: 1px solid var(--frame-border);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  text-align: center;
  backdrop-filter: blur(6px);
}

.modalHeroCaption.is-hidden { display: none; }
.modalHeroCaption.is-animating { animation: captionPop 0.35s ease; }

.modalThumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 120px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}
.modalThumbs.is-hidden { display: none; }

.modalShot {
  border-radius: var(--frame-radius-md);
  overflow: hidden;
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  box-shadow: var(--frame-shadow);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
  padding: 0;
  cursor: pointer;
  position: relative;
  height: 92px;
  scroll-snap-align: start;
}

.modalShot::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(255,255,255,0.06), transparent 60%);
  opacity: 0.7;
}

.modalShot::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255,45,45,0.9), transparent);
  opacity: 0;
  transform: scaleX(0.5);
  transition: opacity .2s ease, transform .2s ease;
}

.modalShot.is-active::after {
  opacity: 0.9;
  transform: scaleX(1);
}


.modalShot:hover,
.modalShot:focus-visible {
  transform: translateY(-1px);
  border-color: var(--accent-magenta-border);
  box-shadow: var(--frame-shadow-hover), var(--glow-magenta-soft);
}

.modalShot.is-active {
  border-color: rgba(255,45,45,0.7);
  box-shadow: var(--frame-shadow-hover);
}

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

@keyframes captionPop {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.modalInfoCol {
  display: grid;
  gap: 16px;
  align-content: start;
  min-width: 0;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modalHeaderLeft {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.modalTitleBlock {
  min-width: 0;
}

.modalIcon {
  width: 56px;
  height: 56px;
  aspect-ratio: 1 / 1;
  border: 0;
  background: transparent;
  display: inline-grid;
  place-items: center;
  overflow: visible;
  padding: 0;
  flex: 0 0 56px;
  box-shadow: none;
}

#modalIconImg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: var(--frame-radius-md);
  background: transparent;
  border: 0;
  box-shadow: none;
}

#modalTitle {
  margin: 0;
  font-size: clamp(28px, 3vw, 34px);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.modalTagline {
  margin-top: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted2);
}

.modalTagline.is-hidden {
  display: none;
}

.modalOneLiner {
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.6;
  color: rgba(245,247,250,0.94);
}

.modalOneLiner.is-hidden { display: none; }

.modalMetaRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.modalMetaRow.is-hidden {
  display: none;
}

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

.badge {
  font-size: var(--fs-sm);
  border: 1px solid rgba(245,247,250,.12);
  background: rgba(255,255,255,.03);
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
}

.badge.live {
  border-color: rgba(76,141,255,.35);
  background: rgba(76,141,255,.12);
  color: var(--text);
}

.badge-release {
  border-color: rgba(255,45,45,.45);
  background: rgba(255,45,45,.12);
  color: var(--text);
}


.modalPlatforms {
  display: flex;
  gap: 8px;
  align-items: center;
}

.modalPlatforms.is-hidden { display: none; }

.modalPlatform {
  width: 26px;
  height: 26px;
  border-radius: var(--frame-radius-xs);
  display: grid;
  place-items: center;
  background: var(--frame-surface);
  border: 1px solid var(--frame-border);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), var(--frame-shadow);
}

.modalPlatform img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}

.modalActions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.modalActions:empty { display: none; }

.modalDesc {
  margin: 0;
  color: rgba(236,238,246,0.8);
  line-height: 1.7;
  font-size: clamp(14px, 1.2vw, 15px);
}

.modalDesc:empty { display: none; }

.modalFacts {
  display: grid;
  gap: 12px;
  align-items: start;
}

.modalFacts.is-hidden { display: none; }

.modalCard {
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  border-radius: var(--frame-radius-md);
  padding: 14px 16px;
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.modalCard:hover {
  border-color: var(--accent-magenta-border);
  box-shadow: var(--frame-shadow), var(--glow-magenta-soft);
}

.modalCard:focus-within {
  border-color: var(--accent-magenta-border);
  box-shadow: var(--frame-shadow), var(--glow-magenta-soft);
}

.modalCard.modalCollapsible {
  padding: 0;
  overflow: hidden;
}

.modalCard.modalCollapsible:not([open]) {
  background: rgba(10,10,18,0.52);
  border-color: var(--frame-border);
  box-shadow: none;
}

.modalCardSummary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted2);
}

.modalCardSummary::-webkit-details-marker { display: none; }

.modalCardSummary::after {
  content: "+";
  font-size: 14px;
  color: rgba(245,247,250,0.7);
}

.modalCard[open] .modalCardSummary {
  color: var(--text);
}

.modalCard[open] .modalCardSummary::after {
  content: "-";
}

.modalCardBody {
  padding: 0 16px 14px;
  display: grid;
  gap: 8px;
  max-height: clamp(180px, 32vh, 360px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modalValueCard[open] {
  border-color: var(--frame-border-strong);
  background: linear-gradient(150deg, rgba(255,45,45,0.1), rgba(10,10,18,0.62));
  box-shadow: var(--frame-shadow-hover);
  position: relative;
}

.modalValueCard[open]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px 140px at 15% 0%, rgba(255,45,45,0.25), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
}


.modalCardTitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--muted2);
  margin-bottom: 8px;
}

.modalCardText {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(245,247,250,0.9);
}

.modalFeatureList {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.modalFeatureList li {
  position: relative;
  padding-left: 16px;
  color: rgba(236,238,246,0.82);
  font-size: 14px;
  line-height: 1.55;
}

.modalFeatureList li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,45,45,0.85);
  box-shadow: 0 0 10px rgba(255,45,45,0.6);
}

.modalDetailList {
  display: grid;
  gap: 10px;
}

.modalDetailItem {
  display: grid;
  gap: 4px;
}

.modalDetailLabel {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted2);
}

.modalDetailValue {
  font-size: 14px;
  color: rgba(245,247,250,0.9);
  line-height: 1.55;
  white-space: pre-wrap;
}

.modalAccordion {
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  border-radius: var(--frame-radius-md);
  padding: 8px 12px 10px;
}

.modalAccordion summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted2);
}

.modalAccordion summary::-webkit-details-marker { display: none; }

.modalAccordion[open] summary {
  color: var(--text);
}

.modalAccordion.is-hidden { display: none; }

.modalAccordion .featureList {
  margin: 10px 0 2px;
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 8px;
}

.modalAccordion .featureList li {
  position: relative;
  padding-left: 16px;
  color: rgba(236,238,246,0.82);
  font-size: 14px;
}

.modalAccordion .featureList li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,45,45,0.85);
  box-shadow: 0 0 10px rgba(255,45,45,0.6);
}

.modalClose {
  width: 38px;
  height: 38px;
  border-radius: var(--frame-radius-sm);
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

.modalClose:hover {
  border-color: var(--frame-border-strong);
  background: rgba(255,45,45,0.1);
  transform: translateY(-1px);
}

.modalPreview:focus-visible,
.modalClose:focus-visible,
.modalShot:focus-visible {
  outline: 2px solid var(--accent-magenta-focus);
  outline-offset: 2px;
}

.modalCardSummary:focus-visible,
.modalAccordion summary:focus-visible,
.lightboxClose:focus-visible,
.lightboxNav:focus-visible {
  outline: 2px solid var(--accent-magenta-focus);
  outline-offset: 2px;
}

/*Hvor mange info bokser du vil ha pr rad i modal kort.*/
@media (min-width: 1100px) {
  .modalFacts {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .modal { width: min(980px, calc(100% - 16px)); }
  .modalBody { grid-template-columns: 1fr; }
  .modalPreview { min-height: clamp(220px, 38vh, 340px); max-height: 50vh; }
  .modalThumbs { grid-auto-columns: 104px; }
}

@media (max-width: 720px) {
  .modal {
    top: max(8px, env(safe-area-inset-top));
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 8px);
  }
  .modalInner {
    padding: 18px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    max-height: calc(100dvh - max(8px, env(safe-area-inset-top)) - env(safe-area-inset-bottom) - 8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modalHeader { align-items: flex-start; }
  #modalTitle { font-size: clamp(24px, 7vw, 30px); }
  .modalIcon { width: 50px; height: 50px; flex: 0 0 50px; }
  .modalActions { flex-direction: column; align-items: stretch; }
  .modalPreview { max-height: 44vh; }
  .modalCardBody {
    max-height: none;
    overflow-y: visible;
  }
}
/* Lightbox */
.lightbox {
  width: min(1080px, calc(100% - 24px));
  border: 1px solid var(--frame-border);
  border-radius: var(--frame-radius-lg);
  background: var(--frame-surface-strong);
  color: var(--text);
  box-shadow: 0 22px 64px rgba(0,0,0,0.62);
  padding: 0;
}

.lightbox::backdrop { background: rgba(0,0,0,0.75); }

.lightboxInner {
  position: relative;
  padding: 18px;
  display: grid;
  gap: 12px;
}

.lightboxImg {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--frame-radius-md);
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
}

.lightboxCaption {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
}

.lightboxClose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: var(--frame-radius-sm);
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  color: var(--text);
  cursor: pointer;
}

.lightboxNav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 62px;
  border-radius: var(--frame-radius-sm);
  border: 1px solid var(--frame-border);
  background: var(--frame-surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--btnShadow);
}

.lightboxNav.prev { left: 12px; }
.lightboxNav.next { right: 12px; }

.lightboxNav:disabled {
  opacity: 0.4;
  cursor: default;
}

.lightboxNav:hover:not(:disabled),
.lightboxClose:hover {
  border-color: var(--frame-border-strong);
  background: rgba(255,255,255,.08);
}

@media (prefers-reduced-motion: reduce) {
  .modal[open],
  .modal::backdrop,
  .modalPreview::after,
  .modalHeroCaption.is-animating {
    animation: none;
  }

  .modalPreview,
  .modalShot,
  .modalClose,
  .lightboxNav,
  .lightboxClose {
    transition: none;
  }
}

@media (max-height: 760px) {
  .modal {
    top: 2vh;
    height: auto;
    max-height: calc(100vh - 4vh);
    max-height: calc(100dvh - 4vh);
  }
  .modalInner {
    height: auto;
    max-height: calc(100vh - 4vh);
    max-height: calc(100dvh - 4vh);
  }
}



