/* ============================================================
   OSpress — Windows (os-window component)
   ============================================================ */

/* ── Window Shell ─────────────────────────────────────────── */
.os-window {
  position: fixed;
  top: 8%;
  left: 8%;
  width: 780px;
  min-width: 340px;
  max-width: calc(100vw - 32px);
  height: 72vh;
  min-height: 220px;
  max-height: calc(100vh - 72px);

  /* Light glass — the defining Win11 look */
  background: var(--win-surf);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid var(--win-border);
  border-radius: var(--ospress-radius-lg);
  box-shadow: var(--win-shadow);

  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
  transition: box-shadow 0.2s, opacity 0.15s;
  color: var(--win-text);
}

.os-window.is-active {
  box-shadow: var(--win-shadow), 0 0 0 1px var(--win-focus-ring);
  z-index: 200;
}

.os-window.is-maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - var(--taskbar-h)) !important;
  border-radius: 0;
  max-width: 100vw;
  max-height: calc(100vh - var(--taskbar-h));
}

.ospress-taskbar--top .os-window.is-maximized {
  top: var(--taskbar-h) !important;
}
.ospress-taskbar--left  .os-window.is-maximized { left:  var(--taskbar-side-w) !important; }
.ospress-taskbar--right .os-window.is-maximized { left:  0 !important; width: calc(100vw - var(--taskbar-side-w)) !important; }

.os-window.is-minimized {
  display: none;
}

/* Resize handle (invisible overlay at edges; JS attaches listeners) */
.os-window[data-resizable="true"] {
  resize: both;
}

/* ── Edge & corner resize handles ─────────────────────────── */
.os-window__resize-handle {
  position: absolute;
  z-index: 10;
  /* Thin transparent hit-area; cursor set inline by JS */
}
/* Edges */
.os-window__resize-handle--n  { top: -4px;  left: 8px;    right:  8px;  height: 8px; }
.os-window__resize-handle--s  { bottom: -4px; left: 8px;  right:  8px;  height: 8px; }
.os-window__resize-handle--w  { left: -4px; top: 8px;     bottom: 8px;  width:  8px; }
.os-window__resize-handle--e  { right: -4px; top: 8px;    bottom: 8px;  width:  8px; }
/* Corners */
.os-window__resize-handle--nw { top: -4px;    left: -4px;  width: 16px; height: 16px; }
.os-window__resize-handle--ne { top: -4px;    right: -4px; width: 16px; height: 16px; }
.os-window__resize-handle--sw { bottom: -4px; left: -4px;  width: 16px; height: 16px; }
.os-window__resize-handle--se { bottom: -4px; right: -4px; width: 16px; height: 16px; }
/* Hide when maximized */
.os-window.is-maximized .os-window__resize-handle { display: none; }

/* ── Title Bar ──────────────────────────────────────────── */
.os-window__titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 4px 0 12px;
  background: var(--win-titlebar);
  border-bottom: 1px solid var(--win-border);
  cursor: default;
  user-select: none;
  flex-shrink: 0;
  -webkit-app-region: drag;
}

.os-window__titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.os-window__app-icon { color: var(--ospress-accent); flex-shrink: 0; }

.os-window__title {
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--win-text);
}

/* ── Window Control Buttons ─────────────────────────────── */
.os-window__controls {
  display: flex;
  gap: 0;
  -webkit-app-region: no-drag;
}

.os-window__btn {
  width: 46px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--win-text);
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  flex-shrink: 0;
}

.os-window__btn:hover              { background: var(--win-hover); }
.os-window__btn--close:hover       { background: #c42b1c !important; color: #fff; }
/* Round last button corner to match window border-radius */
.os-window__btn--close { border-top-right-radius: var(--ospress-radius-lg); }

/* Maximize ↔ Restore icon state */
.os-window__btn-restore { display: none; }
.is-maximized .os-window__btn--maximize .os-window__btn-maximize { display: none; }
.is-maximized .os-window__btn--maximize .os-window__btn-restore  { display: inline-flex; }

/* ── Window Body ─────────────────────────────────────────── */
.os-window__body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--win-surf-solid);
  color: var(--win-text);
}

/* ── Explorer Layout ─────────────────────────────────────── */
.explorer__addressbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--win-toolbar);
  border-bottom: 1px solid var(--win-border);
  flex-shrink: 0;
}

.explorer__nav-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--win-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s, border-color 0.12s;
}
.explorer__nav-btn:hover {
  background: var(--win-hover);
  border-color: var(--win-border);
  color: var(--win-text);
}

.explorer__breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  background: var(--win-input-bg);
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 3px 10px;
  margin: 0 4px;
}

.explorer__crumb-link {
  color: var(--ospress-accent);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.explorer__crumb-link:hover { text-decoration: underline; }
.explorer__crumb-current { color: var(--win-text); white-space: nowrap; font-weight: 500; }
.explorer__crumb-sep { color: var(--win-text-muted); }

/* Explorer search form in toolbar */
.explorer__search-form {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--win-input-bg);
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  width: 160px;
  margin-left: auto;
  flex-shrink: 0;
  transition: width 0.2s ease, border-color 0.15s;
}
.explorer__search-form:focus-within {
  width: 220px;
  border-color: var(--ospress-accent);
}
.explorer__search-icon { color: var(--win-text-muted); flex-shrink: 0; }
.explorer__search-input {
  background: none;
  border: none;
  outline: none;
  font-size: 12px;
  color: var(--win-text);
  font-family: inherit;
  width: 100%;
  padding: 2px 0;
}
.explorer__search-input::placeholder { color: var(--win-text-muted); }

.explorer__toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  background: var(--win-toolbar);
  border-bottom: 1px solid var(--win-border);
  flex-shrink: 0;
}

.explorer__view-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--win-text-muted);
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.12s;
}
.explorer__view-btn.active,
.explorer__view-btn:hover {
  background: var(--win-hover);
  color: var(--win-text);
  border-color: var(--win-border);
}
.explorer__view-btn.active { font-weight: 600; }

.explorer__desc {
  margin-left: auto;
  font-size: 12px;
  color: var(--win-text-muted);
}

.explorer__content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  background: var(--win-surf-solid);
}

/* List view toggle */
.explorer__content.view-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  flex-wrap: unset;
  gap: 0;
}

.explorer__content.view-list .desktop-icon {
  flex-direction: row;
  width: 100%;
  height: 36px;
  padding: 4px 8px;
  gap: 10px;
  border-radius: 4px;
}

.explorer__content.view-list .desktop-icon__graphic { width: 24px; height: 24px; }
.explorer__content.view-list .desktop-icon__folder-svg,
.explorer__content.view-list .desktop-icon__file-svg { width: 20px; height: 20px; }
.explorer__content.view-list .desktop-icon__thumb     { width: 24px; height: 24px; }
.explorer__content.view-list .desktop-icon__label     { text-align: left; -webkit-line-clamp: 1; line-clamp: 1; color: var(--win-text); }
.explorer__content.view-list .desktop-icon__badge     { position: static; font-size: 12px; }

.explorer__empty {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--win-text-muted);
  padding: 48px;
}
.explorer__empty-icon { opacity: 0.35; }

.explorer__pagination {
  padding: 8px 12px;
  border-top: 1px solid var(--win-border);
  display: flex;
  justify-content: center;
}

.explorer__pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--win-text);
  font-size: 13px;
}
.explorer__pagination .page-numbers.current {
  background: var(--ospress-accent);
  color: #fff;
}
.explorer__pagination .page-numbers:hover:not(.current) {
  background: var(--win-hover);
}

.explorer__statusbar {
  padding: 4px 12px;
  font-size: 11px;
  color: var(--win-text-muted);
  border-top: 1px solid var(--win-border);
  background: var(--win-toolbar);
  flex-shrink: 0;
}

/* ── Explorer two-column layout: nav pane + main ────────────── */
.explorer__layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  container-type: inline-size; /* enables @container queries on children */
}

.explorer__nav-pane {
  width: 196px;
  min-width: 130px;
  flex-shrink: 0;
  border-right: 1px solid var(--win-border);
  background: var(--win-toolbar);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  user-select: none;
}

.explorer__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  color: var(--win-text);
  background: var(--win-surf-solid);
}

/* Pane group: collapsible section */
.explorer__pane-group {
  margin-top: 4px;
}

.explorer__pane-group-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  background: none;
  border: none;
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--win-text-muted);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  margin-top: 6px;
}
.explorer__pane-group-toggle:hover { color: var(--win-text); }

.explorer__pane-chevron {
  transition: transform 0.15s;
  flex-shrink: 0;
  opacity: 0.6;
}
.explorer__pane-group-toggle[aria-expanded="false"] .explorer__pane-chevron {
  transform: rotate(-90deg);
}

.explorer__pane-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.explorer__pane-list[hidden] { display: none; }

/* Pane item link */
.explorer__pane-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 14px;
  font-size: 12px;
  color: var(--win-text);
  text-decoration: none;
  border-radius: 5px;
  margin: 1px 5px;
  cursor: pointer;
  transition: background 0.1s;
  min-width: 0;
}
.explorer__pane-item:hover   { background: var(--win-hover); }
.explorer__pane-item.is-active {
  background: var(--win-selected);
  color: var(--ospress-accent);
  font-weight: 600;
}

.explorer__pane-icon   { flex-shrink: 0; opacity: 0.75; }
.explorer__pane-folder { flex-shrink: 0; }
.explorer__pane-label  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer__pane-count  {
  font-size: 10px;
  color: var(--win-text-muted);
  background: var(--win-hover);
  border-radius: 8px;
  padding: 1px 5px;
  flex-shrink: 0;
}

/* ── Document Layout ─────────────────────────────────────── */
.document {
  display: flex;
  flex-direction: column;
  height: 100%;  background: var(--win-surf-solid);
  color: var(--win-text);}

.document__header {
  flex-shrink: 0;
}

.document__hero {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.document__meta {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--win-border);
  background: var(--win-titlebar);
}

.document__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 10px;
  line-height: 1.3;
  color: var(--win-text);
}

.document__info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--win-text-muted);
  margin-bottom: 8px;
}

.document__info a { color: inherit; text-decoration: none; }
.document__info a:hover { color: var(--ospress-accent); }

.document__info span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.document__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--win-text-muted);
  background: rgba(0,103,192,0.08);
  border: 1px solid rgba(0,103,192,0.2);
  border-radius: 20px;
  padding: 2px 10px;
  color: var(--ospress-accent);
  text-decoration: none;
  font-size: 11px;
  transition: background 0.12s;
}

/* Tag chips — standalone rule so they work inside document-explorer too */
.document__tag-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(0,103,192,0.09);
  border: 1px solid rgba(0,103,192,0.22);
  border-radius: 20px;
  padding: 2px 9px;
  color: var(--ospress-accent);
  text-decoration: none;
  font-size: 11px;
  transition: background 0.12s, color 0.12s;
}
.document__tag-chip:hover { background: var(--ospress-accent); border-color: var(--ospress-accent); color: #fff !important; }

/* Dark-mode chips */
[data-theme="dark"] .document__tag-chip,
[data-theme="dark"] .document-explorer__meta-item a.document__tag-chip {
  background: rgba(96,205,255,0.10);
  border-color: rgba(96,205,255,0.22);
  color: var(--ospress-accent-light);
}
[data-theme="dark"] .document__tag-chip:hover { background: var(--ospress-accent-light); border-color: var(--ospress-accent-light); color: #000; }
@media (prefers-color-scheme: dark) {
  .document__tag-chip {
    background: rgba(96,205,255,0.10);
    border-color: rgba(96,205,255,0.22);
    color: var(--ospress-accent-light);
  }
  .document__tag-chip:hover { background: var(--ospress-accent-light); border-color: var(--ospress-accent-light); color: #000; }
}

/* Category meta links in toolbar */
.document-explorer__meta-item a {
  color: var(--win-text-muted);
  text-decoration: none;
  transition: color 0.12s;
}
.document-explorer__meta-item a:hover { color: var(--win-link-color); text-decoration: underline; }

.document__body-wrap {
  flex: 1;
  overflow-y: auto;
  display: flex;
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  background: var(--win-surf-solid);
}

.document__content {
  flex: 1;
  padding: 24px 28px;
  max-width: 98%;
  line-height: 1.75;
  color: var(--win-text);
  font-size: 14px;
}

.document__content h1,.document__content h2,.document__content h3,
.document__content h4,.document__content h5,.document__content h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.document__content a         { color: var(--win-link-color); text-decoration: underline; text-underline-offset: 2px; }
.document__content a:visited { color: var(--win-link-visited); }
.document__content a:hover   { opacity: 0.8; text-decoration: underline; }
.document__content img  { max-width: 100%; border-radius: var(--ospress-radius); }
.document__content pre  { background: rgba(0,0,0,0.06); border: 1px solid var(--win-border); border-radius: 6px; padding: 14px; overflow-x: auto; }
[data-theme="dark"] .document__content pre { background: rgba(0,0,0,0.30); }
@media (prefers-color-scheme: dark) { .document__content pre { background: rgba(0,0,0,0.30); } }
.document__content code { font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace; font-size: 13px; }
.document__content blockquote {
  border-left: 3px solid var(--ospress-accent);
  margin: 1em 0;
  padding-left: 16px;
  color: var(--win-text-muted);
  font-style: italic;
}

.document__comments-panel {
  width: 300px;
  flex-shrink: 0;
  border-left: 1px solid var(--win-border);
  overflow-y: auto;
  padding: 16px;
  background: var(--win-toolbar);
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
}

.document__comments-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--win-text-muted);
}

.document__postnav .nav-links {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--win-border);
  background: var(--win-toolbar);
  font-size: 13px;
}

.document__postnav .nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ospress-accent);
  text-decoration: none;
}

.document__postnav .nav-subtitle { font-size: 11px; color: var(--win-text-muted); }
.document__postnav .nav-title    { font-weight: 600; }
.document__postnav .nav-next     { text-align: right; flex-direction: row-reverse; }

/* ── Document-Explorer (single post in explorer shell) ──── */
.document-explorer__toolbar {
  flex-wrap: wrap;
  gap: 10px;
  min-height: 34px;
}

.document-explorer__meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--win-text-muted);
}
.document-explorer__meta-item a {
  color: var(--win-text-muted);
  text-decoration: none;
}
.document-explorer__meta-item a:hover { color: var(--win-link-color); text-decoration: underline; }

.document-explorer__body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  flex-direction: column;
  background: var(--win-surf-solid);
}

.document-explorer__hero-wrap {
  flex-shrink: 0;
  overflow: hidden;
  height: auto;
  margin: 2rem;
  border-radius: var(--ospress-radius);
}

.document-explorer__hero {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.document-explorer__comments {
  border-top: 1px solid var(--win-border);
  padding: 16px 28px 24px;
  background: var(--win-toolbar);
}

/* ── App icon as thumbnail in title bar ─────────────────── */
.os-window__app-icon--thumb {
  width: 16px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Desktop Right-Click Context Menu ───────────────────── */
.desktop-ctx-menu {
  position: fixed;
  z-index: 9900;
  min-width: 190px;
  background: rgba(24, 24, 38, 0.96);
  backdrop-filter: blur(32px) saturate(1.8);
  -webkit-backdrop-filter: blur(32px) saturate(1.8);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.60), 0 2px 8px rgba(0,0,0,0.35);
  padding: 4px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.92);
  outline: none;
}

.desktop-ctx-menu__heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  padding: 6px 14px 3px;
  user-select: none;
}

.desktop-ctx-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: 5px;
  color: rgba(255,255,255,0.90);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  outline: none;
}
.desktop-ctx-menu__item:hover,
.desktop-ctx-menu__item:focus-visible {
  background: rgba(255,255,255,0.10);
}
.desktop-ctx-menu__item:active { background: rgba(255,255,255,0.17); }

.desktop-ctx-menu__check {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ospress-accent-light, #60cdff);
}
.desktop-ctx-menu__item.is-checked .desktop-ctx-menu__check::before { content: '\2713'; }

.desktop-ctx-menu__sep {
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 3px 6px;
}

/* Icon slot — replaces the check-mark slot for action menus */
.desktop-ctx-menu__check svg {
  display: block;
  opacity: 0.75;
}

/* Label text inside action items */
.desktop-ctx-menu__label {
  flex: 1;
}

/* Danger item (e.g. Delete) */
.desktop-ctx-menu__item.is-danger       { color: #ff7b72; }
.desktop-ctx-menu__item.is-danger:hover,
.desktop-ctx-menu__item.is-danger:focus-visible { background: rgba(255,80,60,0.18); color: #ff9991; }

/* ── Share section ──────────────────────────────────────────── */
.desktop-ctx-menu__share-section {
  padding: 2px 0;
}

.desktop-ctx-menu__share-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 6px;
}

.desktop-ctx-menu__share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.80);
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.desktop-ctx-menu__share-btn:hover {
  background: var(--share-color, rgba(255,255,255,0.15));
  border-color: transparent;
  color: #fff;
}

div#desktop-grid{
  margin-top: 0.5rem;
  margin-bottom: 3rem;
}

/* ============================================================
   Desktop — List View
   ============================================================ */

.desktop__grid.view-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-content: start;
  gap: 0;
  padding: 0 4px 4px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}


/* ── Row item ─────────────────────────────────────────────── */

.desktop__grid.view-list .desktop-icon {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  height: 32px;
  padding: 2px 10px 2px 6px;
  gap: 8px;
  border-radius: 4px;
  background: transparent;
  cursor: default;
  transition: background 120ms ease;
}

.desktop__grid.view-list .desktop-icon:hover {
  background: rgba(255 255 255 / 0.08);
}

.desktop__grid.view-list .desktop-icon.selected {
  background: rgba(0 103 192 / 0.22);
}


/* ── Icon graphic slot — stacking context for centering ───── */

.desktop__grid.view-list .desktop-icon__graphic {
  position: relative;          /* anchor for __count badge */
  flex-shrink: 0;
  width: 32px;                 /* larger folder */
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ── Folder SVG — the base layer ──────────────────────────── */

.desktop__grid.view-list .desktop-icon__folder-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}


/* ── File-type icon or thumbnail — centered over the folder ── */

.desktop__grid.view-list .desktop-icon__file-svg,
.desktop__grid.view-list .desktop-icon__thumb {
  position: relative;          /* sits above folder-svg in stacking order */
  z-index: 1;
  width: 14px;                 /* small enough to read inside the folder */
  height: 14px;
  margin-top: 3px;             /* nudge into the folder body, below the tab */
  pointer-events: none;
}

.desktop__grid.view-list .desktop-icon__thumb {
  border-radius: 2px;
  object-fit: cover;
}


/* ── Badge (e.g. shortcut arrow, file-type label) ─────────── */

.desktop__grid.view-list .desktop-icon__badge {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  position: absolute;
  top:0;
  left: -5px;
  padding: 0;
  min-width: unset;
  height: unset;
  background: none;
  border-radius: 0;
}


/* ── Notification count — top-right corner of graphic slot ── */

.desktop__grid.view-list .desktop-icon__count {
  position: absolute;
  right: 87%;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;          /* pill for 2-digit numbers */

  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: #e0362a;
  box-shadow: 0 0 0 1.5px rgba(0 0 0 / 0.35);  /* lifts badge off folder */
  pointer-events: none;
}


/* ── Label ────────────────────────────────────────────────── */

.desktop__grid.view-list .desktop-icon__label {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255 255 255 / 0.9);
  text-shadow: none;
}

/* ── Profile Layout ──────────────────────────────────────── */
.profile {
  overflow-y: auto;
  height: 100%;
  background: var(--win-surf-solid);
  color: var(--win-text);
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
}

.profile__header {
  display: flex;
  gap: 20px;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--win-border);
  background: var(--win-titlebar);
}

.profile__avatar-wrap { flex-shrink: 0; }

.profile__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 2px solid var(--ospress-accent);
}

.profile__name  { font-size: 22px; font-weight: 700; margin: 0 0 4px; color: var(--win-text); }
.profile__role  { font-size: 12px; background: rgba(0,103,192,0.13); color: var(--ospress-accent); font-weight: 600; padding: 2px 10px; border-radius: 20px; display: inline-block; }
.profile__bio   { font-size: 13px; color: var(--win-text-muted); margin-top: 8px; line-height: 1.5; }

.profile__stats {
  display: flex;
  gap: 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--win-border);
}

.profile__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile__stat-value { font-size: 20px; font-weight: 700; color: var(--ospress-accent); }
.profile__stat-label { font-size: 11px; color: var(--win-text-muted); }
.profile__stat-link  { font-size: 13px; color: var(--ospress-accent); text-decoration: none; }
.profile__stat-link:hover { text-decoration: underline; }

.profile__posts { padding: 16px 20px; }
.profile__posts-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--win-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}

/* ── 404 Error ───────────────────────────────────────────── */
.error-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  height: 100%;
  gap: 14px;
  background: var(--win-surf-solid);
  color: var(--win-text);
}

.error-404__icon   { color: #ffc107; opacity: 0.85; }
.error-404__title  { font-size: 22px; font-weight: 700; margin: 0; color: var(--win-text); }
.error-404__message { font-size: 14px; color: var(--win-text-muted); max-width: 400px; }

.error-404__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.error-404__search { margin-top: 8px; }
.error-404__search p { font-size: 13px; color: var(--win-text-muted); margin-bottom: 8px; }

/* ── Comments (inside document panel) ───────────────────── */
.comments-area { font-size: 13px; }

.comment-list,
.comment-list .children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment-body   { margin-bottom: 14px; }
.comment-author { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author img { border-radius: 50%; width: 28px; height: 28px; }
.fn  { font-weight: 600; font-size: 12px; color: var(--win-text); }
.comment-metadata { font-size: 11px; color: var(--win-text-muted); }
.comment-content { font-size: 12px; line-height: 1.5; color: var(--win-text); }

.comment-respond .comment-reply-title { font-size: 13px; font-weight: 600; }

.comment-form label   { display: block; font-size: 12px; margin-bottom: 3px; color: var(--win-text-muted); }
.comment-form input,
.comment-form textarea {
  width: 100%;
  background: var(--win-input-bg);
  border: 1px solid var(--win-border);
  border-radius: 4px;
  color: var(--win-text);
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  margin-bottom: 8px;
}
.comment-form textarea { resize: vertical; min-height: 80px; }
.comment-form .submit {
  background: var(--ospress-accent);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.comment-form .submit:hover { background: var(--ospress-accent-hover); }

/* ── Widget host container on non-front pages ────────────── */
/* Makes the recent-posts widget fixed-position on all pages   */
.desktop--widget-host {
  position: fixed;
  z-index: 80;
  bottom: calc(var(--taskbar-h, 40px) + 8px);
  right: 0;
  width: 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}
.desktop--widget-host .desktop-widget {
  /* Each widget controls its own position via widgets.css per-widget rules.
     We only re-enable pointer events here (the host itself is pointer-events:none). */
  pointer-events: all;
}
/* On mobile the widget gets position:fixed via responsive.css — no need to hide the host */

/* ── Pane Resize Handle ───────────────────────────────────── */
.pane-resizer {
  width: 4px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
  /* Large hit area via pseudo */
}
.pane-resizer::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -4px; right: -4px;
}
.pane-resizer:hover,
.pane-resizer.is-dragging {
  background: var(--ospress-accent);
  opacity: 0.6;
}

/* ── Doc Sidebar (right pane in document-explorer & archive) ─ */

/* document-explorer: body is flex row — primary + sidebar */
.document-explorer__body {
  flex-direction: row !important;
  align-items: stretch;
  overflow: hidden; /* children scroll independently */
}

.doc-primary {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain; /* prevent scroll chaining to parent containers */
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  display: flex;
  flex-direction: column;
}

/* explorer__main is now also a flex row — primary content + sidebar */
.explorer__main {
  flex-direction: row;
  align-items: stretch;
  overflow: hidden;
}

.explorer__main-primary {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.doc-sidebar {
  width: 35%;
  flex-shrink: 0;
  border-left: 1px solid var(--win-border);
  background: var(--win-toolbar);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--win-scrollbar) transparent;
  padding: 12px 0 16px;
}

.doc-sidebar__section {
  margin-bottom: 8px;
}

.doc-sidebar__heading {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--win-text-muted);
  margin: 0;
  padding: 4px 12px 6px;
}

.doc-sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-sidebar__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 5px;
  margin: 1px 4px;
  /* when rendered as <a> tag */
  text-decoration: none;
  color: inherit;
}
.doc-sidebar__item:hover { background: var(--win-hover); }
.doc-sidebar__item:focus { outline: 2px solid var(--ospress-accent); outline-offset: -2px; }

.doc-sidebar__thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
}
.doc-sidebar__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.doc-sidebar__thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--win-hover);
  border-radius: 4px;
}

.doc-sidebar__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-sidebar__item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--win-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.doc-sidebar__item-date {
  font-size: 10px;
  color: var(--win-text-muted);
}

/* ── Narrow-window sidebar stacking (container query) ───────
   When the window is not maximised the .explorer__layout shrinks.
   Below 700 px the sidebar drops below the primary pane.         */
@container (max-width: 700px) {
  /* Both layouts: stack the sidebar below primary content */
  .document-explorer__body,
  .explorer__main {
    flex-direction: column !important;
    overflow-y: auto;
  }

  .doc-primary {
    overflow-y: visible; /* parent handles scroll when column */
  }

  .explorer__main-primary {
    overflow: visible;
  }

  .doc-sidebar {
    width: 100% !important;
    min-width: unset !important;
    max-width: unset !important;
    flex: 0 0 auto !important;
    border-left: none;
    border-top: 1px solid var(--win-border);
    overflow-y: visible;
  }

  /* Hide the sidebar resize handle — not useful when stacked */
  .pane-resizer[data-resize="sidebar"] {
    display: none !important;
  }
}

/* ── Ad Slots ────────────────────────────────────────────── */
.ospress-ad {
  padding: 10px 0;
  text-align: center;
}

.ospress-ad--sidebar_top {
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--win-border);
  margin-bottom: 4px;
}

.ospress-ad--before_content,
.ospress-ad--after_content {
  padding: 12px 24px;
}

.ospress-ad--archive_top {
  padding: 8px 12px 4px;
  width: 100%;
}

.ospress-ad--archive_between,
.ospress-ad--archive_between_2 {
  grid-column: 1 / -1; /* span full grid row in file grid */
  padding: 4px 0;
}

/* In list-view mode, all archive ad slots must span the full grid row */
.explorer__content.view-list .ospress-ad {
  grid-column: 1 / -1;
}

.ospress-ad ins,
.ospress-ad iframe,
.ospress-ad img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* ── Desktop-behind layer (visible on all non-front pages) ── */
.desktop--bg {
  position: fixed;
  inset: 0;
  bottom: var(--taskbar-h, 40px);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-size: cover;
  background-position: center;
}

/* When no window is focused, desktop is interactive */
.desktop--bg.is-interactive {
  pointer-events: all;
}

/* Keep the desktop icons within the bg layer interactive */
.desktop--bg .desktop-icon {
  pointer-events: all;
}

/* ── Dynamic window loading states ──────────────────────── */
.os-window__body--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 200px;
}

.os-window__spinner {
  animation: ospress-spin 0.8s linear infinite;
  transform-origin: center;
}

@keyframes ospress-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.os-window__load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--win-text-muted);
  font-size: 13px;
  text-align: center;
}
.os-window__load-error a {
  color: var(--ospress-accent);
  text-decoration: none;
}
.os-window__load-error a:hover { text-decoration: underline; }

/* Customizations */
.comment-form a{
    color: var(--ospress-accent);
    text-decoration: none;
}
