/* PSC compact layout v1 (Ahmed, 25 Nov 2026: "minimize space but make everything clear", publish directly)
   Browsers only: not the PSC apps (html.psc-in-app) and not embedded views ([data-psc-view]).
   Mostly theme variables, so Invision's own pages and PSC's pages shrink together. */

/* 1. Spacing between blocks (theme: clamp(1rem, 1.6vw, 1.375rem)) */
html[data-ips-scheme]:not(.psc-in-app):not([data-psc-view]) {
  --i-sp_block: clamp(.7rem, 1vw, .9rem);
  --i-headerSecondary--he: 42px;
  --i-mobileHeader--he: 48px;
}

/* 2. Big buttons (Start new topic, Reply, Add images, Create event ...): 53 px -> 36 px */
html:not(.psc-in-app):not([data-psc-view]) :is(.ipsButtons--main, .ipsButtons--large, .ipsButton--large) {
  --i-button--pa-bl: .7em;
  --i-button--pa-in: 1.15em;
}

/* 3. Page titles: 42 px -> 32 px on computers, about 24 px on phones */
html:not(.psc-in-app):not([data-psc-view]) .ipsPageHeader:not(.ipsBox--topicHeader > .ipsPageHeader) :is(h1, .ipsPageHeader__title),
html:not(.psc-in-app):not([data-psc-view]) .ipsLayout__primary-column h1:not(.ipsRichText h1, .ipsEntry h1, .ipsBox--topicHeader h1, .ipsPageHeader h1) {
  font-size: clamp(1.45rem, 1.05rem + 1.1vw, 2rem) !important;
  line-height: 1.18 !important;
  letter-spacing: -.012em;
}
html:not(.psc-in-app):not([data-psc-view]) header.ipsPageHeader.ipsBox > .ipsPageHeader__row {
  padding: .85rem 1.25rem;
  gap: .75rem;
  align-items: center;
}

/* 4. Box headers ("Featured Downloads", "Categories", "Search Events" ...) */
html:not(.psc-in-app):not([data-psc-view]) .ipsBox__header {
  padding: .65rem 1.1rem;
  min-height: 0;
}
html:not(.psc-in-app):not([data-psc-view]) .ipsBox__header :is(h2, h3, .ipsBox__title) {
  font-size: 1.08rem;
}

/* 5. Lists and grids (topic lists, downloads, clubs ...) */
html:not(.psc-in-app):not([data-psc-view]) .ipsData { --i-data--padding: .9em; }
html:not(.psc-in-app):not([data-psc-view]) .ipsData--table { --i-data--padding: clamp(.65em, 1.4cqw, .9em); }
html:not(.psc-in-app):not([data-psc-view]) .ipsData--grid:has(.ipsData__image) { --i-data--padding: 1em; }
html:not(.psc-in-app):not([data-psc-view]) .ipsData--snippet,
html:not(.psc-in-app):not([data-psc-view]) body.ipsApp_front[data-pageapp] [data-ips-hook="topicListTable"] .ipsData--topic-list { --i-data--padding: clamp(.7rem, 1.2vw, .95rem); }
html:not(.psc-in-app):not([data-psc-view]) .ipsButtonBar__end,
html:not(.psc-in-app):not([data-psc-view]) .ipsButtonBar__start { padding-block: .25rem; }

/* 6. Top strip (PSC Home / Forums / Videos) and side menu */
html:not(.psc-in-app):not([data-psc-view]) .psc-network { padding-block: 2px; min-block-size: 40px; }
html:not(.psc-in-app):not([data-psc-view]) .psc-network :is(a, button) { block-size: 34px; min-block-size: 0; }
html:not(.psc-in-app):not([data-psc-view]) .ipsNavPanelBreadcrumbs .ipsHeader__align { padding-block: 2px; }
@media (min-width: 980px) {
  html:not(.psc-in-app):not([data-psc-view]) .ipsNavPanel__nav a { padding-block: 6px; }
  html:not(.psc-in-app):not([data-psc-view]) body.ipsApp_front .ipsNavPanel .ipsLogo--side { block-size: 60px; min-block-size: 3.75rem; }
}

/* 7. Footer */
html:not(.psc-in-app):not([data-psc-view]) .psc-footer { padding: 1.4rem 1.25rem .9rem; }
html:not(.psc-in-app):not([data-psc-view]) .psc-footer__base { margin-top: 1rem; padding-top: .75rem; }
html:not(.psc-in-app):not([data-psc-view]) .ipsFooter__widgets { margin-bottom: 1rem; }

/* 8. Forum lists: "Start new topic" sits in the title card beside Follow (psc-compact-v1.js moves it).
      The old row is collapsed at once; if the script ever fails, it shows again after 4 s. */
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="forums"] .ipsLayout__primary-column > div > ul.ipsButtons--main {
  max-height: 0;
  margin-block: 0;
  overflow: hidden;
  animation: psc-compact-reveal 0s 4s forwards;
}
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="forums"] .ipsLayout__primary-column > div > ul.ipsButtons--main.psc-compact-moved { display: none; }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="forums"] .ipsLayout__primary-column > div > ul.ipsButtons--main.psc-compact-keep {
  max-height: none; margin-block: var(--i-sp_block); overflow: visible; animation: none;
}
@keyframes psc-compact-reveal { to { max-height: 200px; margin-block: var(--i-sp_block); overflow: visible; } }
html:not(.psc-in-app):not([data-psc-view]) .ipsPageHeader .ipsButtons > li > .ipsButton.psc-compact-newtopic {
  --i-button--pa-bl: .55em;
  --i-button--pa-in: 1em;
  --i-button--fo-si: .9em;
}

/* 9. Topic pages (computers): the moderators' select box moves into the Actions row (psc-compact-v1.js);
      its own row collapses at once and shows again after 4 s only if the script never runs. */
@media (min-width: 600px) {
  html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="topic"] .ipsEntries--topic > .ipsButtonBar--top:not(:has(.ipsPagination)) {
    max-height: 0; overflow: hidden; margin-bottom: 0;
    animation: psc-compact-reveal-bar 0s 4s forwards;
  }
}
@keyframes psc-compact-reveal-bar { to { max-height: 120px; overflow: visible; margin-bottom: .4rem; } }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="topic"] .ipsEntries--topic > .ipsButtonBar--top.psc-compact-moved { display: none !important; }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="forums"][data-pagecontroller="topic"] .ipsEntries--topic > .ipsButtonBar--top.psc-compact-keep {
  max-height: none; overflow: visible; margin-bottom: .4rem; animation: none;
}
html:not(.psc-in-app):not([data-psc-view]) .psc-compact-actionrow { justify-content: flex-end; column-gap: .5rem; }
html:not(.psc-in-app):not([data-psc-view]) .psc-compact-actionrow > ul.ipsButtons--main { flex: 0 1 auto; }
html:not(.psc-in-app):not([data-psc-view]) .psc-compact-actionrow > .ipsDataFilters { align-self: center; margin-inline-end: .25rem; }

/* 10. Box header collapse buttons (forum home categories) */
html:not(.psc-in-app):not([data-psc-view]) .ipsBox__header-toggle { inline-size: 2.1rem; block-size: 2.1rem; }

/* 11. Phones and tablets: slimmer section strip, one-line page path (the current page is the title just below) */
@media (max-width: 979.98px) {
  html:not(.psc-in-app):not([data-psc-view]) .psc-sections__inner { padding-block: 4px; }
  html:not(.psc-in-app):not([data-psc-view]) .ipsBreadcrumb--mobile .ipsBreadcrumb__list {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; padding-block: 3px;
  }
  html:not(.psc-in-app):not([data-psc-view]) .ipsBreadcrumb--mobile .ipsBreadcrumb__list::-webkit-scrollbar { display: none; }
  html:not(.psc-in-app):not([data-psc-view]) .ipsBreadcrumb--mobile .ipsBreadcrumb__list > li { flex: none; }
  html:not(.psc-in-app):not([data-psc-view]) .ipsBreadcrumb--mobile .ipsBreadcrumb__list > li:last-of-type:not(:first-of-type) { display: none; }
}

/* 12. Inner box padding (30 px) and the Quizzes page */
html:not(.psc-in-app):not([data-psc-view]) .ipsBox__padding { padding: clamp(.85rem, 1.5vw, 1.25rem); }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="pscquizzes"] .ipsBox__padding > div:first-child { align-items: center; gap: .75rem; flex-wrap: wrap; }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="pscquizzes"] .ipsBox__padding > div:first-child > div { flex: 1 1 auto; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; }
html:not(.psc-in-app):not([data-psc-view]) body[data-pageapp="pscquizzes"] .ipsBox__padding > ul.ipsGrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 185px), 1fr)) !important; gap: .75rem; }

/* Phones */
@media (max-width: 700px) {
  html:not(.psc-in-app):not([data-psc-view]) :is(.ipsButtons--main, .ipsButtons--large, .ipsButton--large) {
    --i-button--pa-bl: .85em;
    --i-button--pa-in: 1em;
  }
  html:not(.psc-in-app):not([data-psc-view]) header.ipsPageHeader.ipsBox > .ipsPageHeader__row { padding: .75rem .9rem; }
  html:not(.psc-in-app):not([data-psc-view]) .ipsBox__header { padding: .6rem .9rem; }
}
