:root {
  --bg-dimness: 0;
  --bg-vignette: 0.2;
  --grid-columns: 5;
  --card-size: 120px;
  --transition-fast: 0.15s;
  --accent: #ffd36b;
  --accent-soft: #ffe9a8;
  --danger: #ff6b6b;
  --surface: rgba(20, 20, 24, 0.9);
  --surface-soft: rgba(30, 30, 36, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-main: #f5f5f7;
  --text-muted: #a0a0b0;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.45);
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --header-height: 56px;
  --settings-width: 320px;

  --name-col: 1fr; 
  --link-col: 1fr;

}

/* .app-root layout */

.app-root {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* Background layer */


.background-hidden {
  display: none;
}

/* Header */

.bookmarkContainerWrapper{
  padding-top: 3rem;
}

.app-header {
  height: var(--header-height);
  padding: 8px 16px 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* border-bottom: 1px solid var(--border-subtle); */
  /* box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); */
  z-index: 10;
}

.app-title {
  font-weight: 600;
  letter-spacing: 0.03em;
  /* font-size: 15px; */
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-title span {
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* font-size: 12px; */
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}

.icon-btn.danger {
  background: linear-gradient(135deg, #ff7b7b, #ff4a4a);
  color: #2b0000;
  border-color: rgba(0, 0, 0, 0.2);
}

.icon-btn.toggled {
  background: var(--accent-soft);
  color: #2b1a00;
  border-color: rgba(0, 0, 0, 0.2);
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  background: rgba(40, 40, 52, 0.95);
}

.icon-btn.danger:hover {
  background: linear-gradient(135deg, #ff8f8f, #ff5f5f);
}

.icon-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.settings-wrapper {
  position: relative;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: var(--settings-width);
  max-width: min(90vw, 360px);
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 10px 12px 12px;
  display: none;
  z-index: 20;
}

.settings-dropdown.open {
  display: block;
}

.settings-section {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section-title {
  /* font-size: 11px; */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* gap: 2px; */
  margin-bottom: 6px;
  /* font-size: 13px; */
}

.settings-row:last-child {
  margin-bottom: 0;
}

.toggle {
  position: relative;
  width: 38px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggle.on {
  background: #ffcf6b;
}

.toggle.on .toggle-thumb {
  transform: translateX(18px);
}

.settings-slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.settings-slider-row label {
  /* font-size: 12px; */
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.settings-slider-row input[type="range"] {
  width: 100%;
}

.settings-buttons-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.settings-buttons-row button {
  flex: 1;
  min-width: 0;
  /* font-size: 11px; */
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.settings-buttons-row button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.settings-note {
  /* font-size: 11px; */
  color: var(--text-muted);
  margin-top: 4px;
}

.settings-grid-input {
  width: 60px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  /* font-size: 12px; */
  text-align: center;
}

/* Search */

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 16, 0.9);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  padding: 2px 10px 2px 8px;
  min-width: 200px;
  max-width: 320px;
}

.search-wrapper svg {

  fill: var(--text-muted);
  margin-right: 6px;
  flex-shrink: 0;
}

.search-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  /* font-size: 13px; */
  padding: 4px 10px;
  width: 100%;
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* Main layout */

.app-main {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 10px 16px 666px 12px;
  /* gap: 12px; */
  overflow: hidden;
}

.toc-panel {
  width: 180px;
  max-width: 220px;
  min-width: 140px;
  background: rgba(10, 10, 16, 0.9);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  /* font-size: 13px; */
}

.toc-title {
  /* font-size: 11px; */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.toc-item {
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid transparent;
}

.toc-item span:first-of-type {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
}

.toc-item.active {
  background: rgba(255, 211, 107, 0.12);
  border-color: rgba(255, 211, 107, 0.7);
  color: var(--accent);
}

.toc-empty {
  /* font-size: 12px; */
  color: var(--text-muted);
  font-style: italic;
}

/* TOC hide + center content */

.toc-hidden .toc-panel, .toc-hidden .toc-resize-handle {
  display: none;
}

.toc-hidden .content-panel {
  margin-left: auto;
  margin-right: auto;
  max-width: 900px;
}

.content-panel {
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.folders-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.folder {
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  /* overflow: hidden; */
  overflow: visible;
}

.folder-header {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: linear-gradient(
    to right,
    rgba(255, 211, 107, 0.08),
    rgba(255, 211, 107, 0.02)
  );
}

.folder-header-left {
  /* display: flex; */
  /* align-items: center; */
  /* gap: 6px; */
  min-width: 0;
}

.folder-header-title {
  /* font-size: 13px; */
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-header-count {
  /* font-size: 11px; */
  color: var(--text-muted);
}

.folder-header-toggle {
  /* font-size: 11px; */
  color: var(--text-muted);
}

.folder-body {
  padding: 8px;
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
  max-height: 9999px;
  opacity: 1;
  transition: max-height 5.35s ease, opacity 5.35s ease;
}

.folder.collapsed .folder-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  padding: 0;
}




.folder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  /* font-size: 11px; */
  color: var(--text-muted);
}

.folder-toolbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.edit-indicator {
  /* font-size: 11px; */
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 211, 107, 0.12);
  color: var(--accent);
  border: 1px solid rgba(255, 211, 107, 0.5);
}

.layout-indicator {
  /* font-size: 11px; */
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}



/* Grid layout */

.bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--card-size));
  justify-content: center;
  gap: 10px;
}

.bookmark-card {
  position: relative;
  flex: 0;
  min-width: 0;
  height: var(--card-size);
  border-radius: 10px;
  background: radial-gradient(
      circle at top,
      rgba(255, 255, 255, 0.06),
      transparent 60%
    ),
    rgba(58, 58, 66, 0.95);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  /* padding: 6px; */
  display: flex;
  flex-direction: column;
  cursor: default;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast);
  overflow: hidden;
}

.bookmark-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 211, 107, 0.6);
  background: radial-gradient(
      circle at top,
      rgba(255, 211, 107, 0.18),
      transparent 60%
    ),
    rgba(58, 58, 66, 0.98);
}

/* neutral base; actual layout uses .bookmark-card-grid */

.bookmark-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

/* NEW: 3‑column grid for quicklink cards */

.bookmark-card-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto; /* controls, icon, name */
  gap: 4px;
  align-items: center;
  height: 100%;
}

/* Pin: row 1, col 1 */

.bookmark-card-grid .bookmark-pin-btn {
  grid-column: 1;
  grid-row: 1;
}

.bookmark-pin-btn.pinned svg,
.folder-pin-btn.pinned svg{
  fill: var(--accent);
}

/* Select: row 1, col 1 but second line visually */

.bookmark-card-grid .bookmark-select-checkbox {
  grid-column: 1;
  grid-row: 2;
  align-self: flex-start;
}

/* Icon: row 2, center column, vertically centered */

.bookmark-card-grid .bookmark-icon-grid {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -40px;
}

/* Xmark: row 1, col 3 */

.bookmark-card-grid .bookmark-delete-btn {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

/* Edit: row 2, col 3 */

.bookmark-card-grid .bookmark-edit-btn {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: flex-start;
}

/* Name: bottom row, full width */

.bookmark-card-grid .bookmark-name-grid {
  grid-column: 1 / 4;
  grid-row: 3;
  text-align: center;
  /* margin-top: 2px; */
}

/* Icon box */

.bookmark-card-middle {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bookmark-icon {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bookmark-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* changed from cover to avoid cropping */
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.bookmark-icon-fallback {
  /* width: 24px; */
  /* height: 24px; */
  /* fill: var(--accent); */
}

.bookmark-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* gap: 4px; */
  /* font-size: 12px; */
}

.bookmark-card-bottom-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.bookmark-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.bookmark-card-bottom-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bookmark-draggable-area-grid {
  cursor: grab;
}

.bookmark-draggable-area-grid:active {
  cursor: grabbing;
}

.bookmark-plus-card {
  display: flex;
  align-items: center;
  justify-content: center;
  /* font-size: 12px; */
  color: var(--text-muted);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
}

.bookmark-plus-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 211, 107, 0.06);
}

/* List layout */

.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bookmark-row {
  display: grid; 
  grid-template-columns: auto auto auto var(--name-col, 1fr) 4px var(--link-col, 1fr) auto auto;
  align-items: center;
  gap: 4px;
  /* padding: 0 3px; */
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(18, 18, 26, 0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  /* font-size: 12px; */
  cursor: default;

  grid-auto-flow: column; 
  white-space: nowrap; 
  overflow: hidden;

  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}

.bookmark-row:hover {
  background: rgba(24, 24, 34, 0.98);
  border-color: rgba(255, 211, 107, 0.6);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.6);
}

.bookmark-row .bookmark-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}

.bookmark-row .bookmark-icon-fallback {
  width: 34px;
  height: 34px;
}

.bookmark-row-name,
.bookmark-row-link {
  white-space: nowrap;
  text-overflow: ellipsis;
  direction: ltr;        /* normal */
  /* scrollbar-width: none; */
  /* -ms-overflow-style: none; */
}


.bookmark-row-name-inner,
.bookmark-row-link-inner {
  /* overflow: hidden; */
  direction: rtl;        /* flip text direction */
  text-align: left;      /* keep visual alignment normal */
  display: inline-block;
}



.bookmark-row-link {
  /* cursor: pointer; */
  color: var(--text-muted);
  /* font-size: 11px; */
}

.bookmark-row-draggable-name,
.bookmark-row-draggable-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  cursor: grab;
}

.bookmark-row-draggable-name:active,
.bookmark-row-draggable-link:active {
  cursor: grabbing;
}


.bookmark-row:hover .bookmark-row-hover-underline {
  text-decoration: underline;
}

.bookmark-row-plus {
  display: flex;
  /* display: grid; */
  /* grid-template-columns: 1fr; */
  /* align-items: center; */
  justify-content: center;
  /* text-align: center; */
  padding: 5px;
  /* height: 39px; */
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 16, 0.8);
  /* color: var(--text-muted); */
  cursor: pointer;
  /* font-size: 12px; */
}

.bookmark-row-plus:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 211, 107, 0.06);
}


.bookmark-card {
  position: relative;
  overflow: hidden;
}

.bookmark-card-grid {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  height: 100%;
  width: 100%;
}

/* LEFT COLUMN */
.bookmark-controls-left {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}

/* RIGHT COLUMN */
.bookmark-controls-right {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}

/* Show controls when card is hovered (existing behavior) */
.bookmark-card:hover .bookmark-controls-left,
.bookmark-card:hover .bookmark-controls-right {
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

/* ALSO show left controls if this card has a pinned pin */
.bookmark-card:has(.bookmark-pin-btn.pinned) .bookmark-controls-left {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.2);
}

/* When ANY bookmark is selected → show ALL bookmark controls (except folder ones) */
.has-selection .bookmark-controls-left{
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.2);
}



/* Default pin (can still be faded by your existing rules) */
.bookmark-pin-btn {
  transition: opacity 0.15s ease-out;
}

/* When pinned → always visible */
.bookmark-pin-btn.pinned {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Default: hidden unless hover */
.bookmark-select-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}

/* Normal hover behavior */
.bookmark-card:hover .bookmark-select-checkbox {
  opacity: 1;
  pointer-events: auto;
}

/* When ANY bookmark is selected → show ALL bookmark select boxes */
.has-selection .bookmark-select-checkbox {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Folder-level select boxes stay controlled separately */
.folder-select-checkbox {
  /* opacity: 0; */
  /* pointer-events: none !important; */
}



/* Modals */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(420px, 90vw);
  max-height: 90vh;
  background: rgba(14, 14, 20, 0.98);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.modal-title {
  /* font-size: 14px; */
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* font-size: 13px; */
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-field label {
  /* font-size: 12px; */
  color: var(--text-muted);
}

.modal-field input[type="text"],
.modal-field input[type="url"],
.modal-field input[type="file"],
.modal-field select {
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-main);
  padding: 6px 8px;
  width: 100%;
  /* font-size: 13px; */
  outline: none;
}

.modal-field input[type="text"]:focus,
.modal-field input[type="url"]:focus,
.modal-field select:focus {
  border-color: rgba(255, 211, 107, 0.8);
  box-shadow: 0 0 0 1px rgba(255, 211, 107, 0.4);
}

.modal-note {
  /* font-size: 11px; */
  color: var(--text-muted);
}

.btn {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  /* font-size: 12px; */
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  padding: 0.6rem;
  justify-content: center;
  gap: 4px;
}

.btn.primary {
  background: linear-gradient(135deg, #ffcf6b, #ff9f4a);
  color: #2b1a00;
  border-color: rgba(0, 0, 0, 0.2);
}

.btn.danger {
  background: linear-gradient(135deg, #ff7b7b, #ff4a4a);
  color: #2b0000;
  border-color: rgba(0, 0, 0, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Fixed warning */

.fixed-warning {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  /* font-size: 11px; */
  display: none;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}

.fixed-warning.show {
  display: block;
}

/* Scrollbars */

.folders-container::-webkit-scrollbar,
.toc-panel::-webkit-scrollbar {
  width: 6px;
}

.folders-container::-webkit-scrollbar-track,
.toc-panel::-webkit-scrollbar-track {
  background: transparent;
}

.folders-container::-webkit-scrollbar-thumb,
.toc-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

/* Responsive */

@media (max-width: 800px) {

  .toc-panel {
    width: 100%;
    max-width: none;
    order: 1;
  }

  .content-panel {
    order: 2;
  }
}

@media (max-width: 600px) {
  .header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .search-wrapper {
    min-width: 140px;
  }
}

/* SVG + expand buttons */

.bookmarkContainerWrapper svg {
  height: 25px;
  width: 25px;
  fill: var(--text-main);
}

.expand-btn {
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  /* padding: 0 10px; */
  display: inline-flex;
  align-items: center;
  align-content: center;
  justify-content: center;
  gap: 0;
  /* font-size: 12px; */
  white-space: nowrap;
  width: auto;
  overflow: hidden;
}

.expand-btn .icon {
  /* width: 20px; */
  /* height: 20px; */
  flex-shrink: 0;
}

.expand-btn .label {
  display: inline-block;
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  margin-right: 0;
  transform: translateX(-4px);
  transition: max-width 0.45s ease, opacity 0.4s ease, transform 0.4s ease,
    margin-right 0.4s ease;
}

.expand-btn:hover .label {
  max-width: 200px;
  opacity: 1;
  transform: translateX(0);
  margin-right: 6px;
}

.expand-btn.toggled {
  background: var(--accent-soft);
  color: #2b1a00;
  border-color: rgba(0, 0, 0, 0.2);
}

.expand-btn.toggled .label {
  max-width: 200px !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
  margin-right: 6px !important;
}

/* Folder delete + toggle */


.folder-pin-btn,
.folder-edit-btn,
.folder-select-checkbox {
  
  background: rgba(255, 255, 255, 0.1);
  border: none;

  /* background: transparent; */
  /* padding: 0; */
  margin: 0;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* opacity: 0; */
  pointer-events: none;
  transition: opacity 0.15s;
}

.folder-pin-btn,
.folder-edit-btn{
  padding: 0.6rem;
}

.folder-edit-btn{
  opacity: 0;

}

.folder-pin-btn:hover svg,
.folder-edit-btn:hover svg,
.folder-select-checkbox:hover svg {
  fill: var(--color-primary);
}

/* Hover visibility rules */

.bookmark-pin-btn,
.bookmark-delete-btn,
.bookmark-edit-btn,
.bookmark-select-checkbox {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.bookmark-pin-btn:hover svg,
.bookmark-delete-btn:hover svg,
.bookmark-edit-btn:hover svg,
.bookmark-select-checkbox:hover svg {
  /* border: 3px solid rgba(255, 255, 255, 0.3); */
  fill: var(--color-primary);
}

.bookmark-pin-btn,
.bookmark-delete-btn,
.bookmark-edit-btn{
  padding: 0.6rem;
}

.bookmark-pin-btn.pinned {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.bookmark-delete-btn svg{
  fill: var(--danger);
}

/* Remove native checkbox look */
.bookmark-select-checkbox input[type="checkbox"],
.folder-select-checkbox input[type="checkbox"]{
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  width: 30px;
  height: 30px;
  cursor: pointer;

  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;

  background: transparent; /* <-- transparent interior */
  display: flex;
  align-items: center;
  align-self: center;
  justify-items: center;
  justify-content: center;

  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.folder-select-checkbox {
  padding: 0.3rem;
}

/* Hover effect */
.bookmark-select-checkbox input[type="checkbox"]:hover {
  border-color: rgba(255, 255, 255, 0.9);
}

/* Checked state: add your own checkmark */
.bookmark-select-checkbox input[type="checkbox"]:checked {
  background: rgba(255, 255, 255, 0.15); /* still transparent-ish */
  border-color: #4da3ff;
}

/* Checkmark using CSS only */
.bookmark-select-checkbox input[type="checkbox"]:checked::after {
  content: "";
  width: 12px;
  height: 12px;
  border-right: 3px solid #4da3ff;
  border-bottom: 3px solid #4da3ff;
  transform: rotate(45deg);
  margin-top: -2px;
}


.bookmark-card:hover .bookmark-pin-btn,
.bookmark-card:hover .bookmark-delete-btn,
.bookmark-card:hover .bookmark-edit-btn,
.bookmark-card:hover .bookmark-select-checkbox,
.bookmark-row:hover .bookmark-pin-btn,
.bookmark-row:hover .bookmark-delete-btn,
.bookmark-row:hover .bookmark-edit-btn,
.bookmark-row:hover .bookmark-select-checkbox {
  opacity: 1;
  pointer-events: auto;
}

/* select-mode keeps checkboxes visible */

.select-mode .bookmark-select-checkbox {
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Hide edit/delete in list unless hovered */

.bookmark-row .bookmark-edit-btn,
.bookmark-row .bookmark-delete-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.bookmark-row:hover .bookmark-edit-btn,
.bookmark-row:hover .bookmark-delete-btn {
  opacity: 1;
  pointer-events: auto;
}


/* Background preview grid */


.appScreenGrid #uploadedBgList{
  display: flex;

}

/* list view: pin + select always visible */
.bookmarks-list .bookmark-pin-btn,
.bookmarks-list .bookmark-select-checkbox {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#uploadedBgList {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* --- Uploaded background preview fixes --- */
/* --- FIX: Uploaded background preview visibility --- */

/* Ensure preview container has enough contrast */
.bg-preview {
    background: rgba(0,0,0,0.35) !important;
    border: 1px solid rgba(255,255,255,0.18) !important;
    padding: 6px !important;
}

/* Ensure image is always visible and not dimmed by parent */
.bg-preview img {
    width: 100% !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 4px !important;
    display: block !important;
}

/* Title: brighter, readable, not overridden by earlier rules */
.bg-preview-title {
    /* font-size: 13px !important; */
    font-weight: 600 !important;
    color: #f5f5f5 !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.75) !important;
    margin-top: 6px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
}

/* Delete button: stronger contrast, always visible */
.bg-preview .btn {
    background: rgba(0,0,0,0.65) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    padding: 4px 6px !important;
    border-radius: 4px !important;
    color: #fff !important;
}

/* Flex row for title + delete button */
.bg-preview > div:last-child {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 6px !important;
}


.selected-folder {
  outline: 2px solid #4da3ff;
  border-radius: 4px;
}

/* .bg-preview {
  width: 100px;
  display: flex;
  flex-direction: column;

} */

.bg-preview-thumb {
  width: 100%;
  height: 60px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.bg-preview-title {
  /* font-size: 12px; */
  text-align: center;
  opacity: 0.8;
} 


.toc-list {
  overflow-x: auto;
  overflow-y: auto;
  white-space: nowrap;
}

.toc-item {
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.app-main {
  display: flex;
  height: 100%;
}

.toc-panel {
  position: relative;
  width: var(--toc-width, 260px);
  min-width: 150px;
  max-width: 600px;
  overflow-x: auto;
  overflow-y: auto;
}

.toc-resize-handle {
  width: 12px;
  cursor: ew-resize;
  /* background: rgba(255,255,255,0.1); */
}

.folder-header.dragging-folder {
  opacity: 0.4;
}

.folder-drop-target {
  outline: 2px dashed var(--accent);
}


/* ===========================
   GLOBAL / UTILITY
   =========================== */

/* Selection mode body state */
body.select-mode .bookmark-select-checkbox input[type="checkbox"] {
  /* slightly emphasize checkboxes when in selection mode */
  outline: 1px solid rgba(255, 255, 255, 0.25);
}

/* When there is any selection, allow styling hooks */
:root.has-selection {
  --selection-accent: #4da3ff;
}

/* ===========================
   BACKGROUND BEHAVIOUR
   =========================== */

:root {
  --bg-blur: 40px;
  --bg-opacity: 1;
  --bg-zoom: 1;
  --bg-flatness: 0;
  --bg-saturation: 1;
  --bg-hue: 0;
  --u: 20px;
  /* --gp: 50% / calc(var(--u) * 12) calc(var(--u) * 12.8); */
}

.background-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -2;
}

/* Layer 1: blurred image */
.background-blur {
  position: fixed;
  inset: 0;
  background: var(--bg-css);
  background-image: var(--bg-image);
  background-size: var(--bg-size, cover);

  background-position: center;
  filter:
    blur(calc(var(--bg-blur) * var(--bg-flatness)))
    brightness(calc(1 + (var(--bg-opacity) - 1) * var(--bg-flatness)))
    saturate(calc(1 + (var(--bg-saturation) - 1) * var(--bg-flatness)));

  z-index: -3;
}

/* Layer 2: flat background (independent) */
.background-flat {
  position: fixed;
  inset: 0;
  background: hsl(var(--bg-hue), 100%, calc(50% + (var(--bg-saturation) - 1) * 20%));
  pointer-events: none; 
  will-change: opacity;
  display: var(--bg-flatness-display, none);
  opacity: var(--bg-flatness);
  filter:
    brightness(var(--bg-opacity))
    saturate(var(--bg-saturation));
  z-index: -2;

}

/* Layer 3: sharp image */
.background-sharp {
  position: fixed;
  inset: 0;
  
  background-image: var(--bg-image);
  background: var(--bg-css);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(var(--bg-zoom));
  z-index: -1;
}


/* Dim + vignette driven by JS variables already */
.background-dim {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
      circle at center,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, var(--bg-vignette)) 60%,
      rgba(0, 0, 0, var(--bg-vignette)) 100%
    ),
    rgba(0, 0, 0, var(--bg-dimness));
  pointer-events: none;
}


/* ===========================
   GRID COLUMNS (BOOKMARKS)
   =========================== */


/* Ensure cards don’t stretch weirdly */
.bookmark-card {
  min-width: 0;
}

/* Plus card should align with grid cells */
.bookmark-plus-card {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===========================
   FOLDER CONTAINER + SLIDE ANIMATION
   =========================== */


/* Collapsed state: slide up */
.folder.collapsed .folder-body {
  max-height: 0;
  opacity: 0;
}

/* Optional: rotate minus icon when collapsed */
.folder-toggle-btn svg {
  transition: transform 0.18s ease-out;
}

.folder.collapsed .folder-toggle-btn svg {
  transform: rotate(90deg);
}

/* Folder header counts (bookmarks + subfolders) */
.folder-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-header-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-header-count {
  /* font-size: 11px; */
  opacity: 0.8;
  white-space: nowrap;
}

/* Extended count line: “27 Bookmarks  7 Folders” */
.folder-header-count span {
  margin-right: 6px;
}

.folder-header-left,
.folder-header-right {
  min-width: 0;
}

.folder-header-left {
  flex: 1 1 auto;
}

.folder-header-count {
  display: inline-block;
  max-width: 100%;
}

/* When container shrinks, hide folder count first */
@media (max-width: 900px) {
  .folder-header-count .folder-count-label {
    display: none;
  }
}

/* When very tight, show only bookmarks number */
@media (max-width: 700px) {
  .folder-header-count {
    font-size: 10px;
  }
}

/* ===========================
   TOC PANEL / TREE
   =========================== */

.toc-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* TOC header with isolate toggle */
.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
}

/* TOC list as tree */
.toc-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 0 6px;
}

/* Each TOC item: folder row */
.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  /* font-size: 12px; */
  cursor: pointer;
  user-select: none;
  gap: 6px;
  border-radius: 4px;
}

.toc-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Left side: name with depth prefix */
.toc-item span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right side: counts */
.toc-item span:last-child {
  flex: 0 0 auto;
  /* font-size: 11px; */
  opacity: 0.75;
  white-space: nowrap;
}

/* When we want to hide folder count first in TOC */
.toc-item .toc-count-bookmarks {
  margin-right: 4px;
}

.toc-item .toc-count-folders {
  opacity: 0.7;
}

/* Very narrow TOC: only show bookmarks count */
@media (max-width: 900px) {
  .toc-item .toc-count-folders {
    display: none;
  }
}

/* Extremely narrow: show only number */
@media (max-width: 700px) {
  .toc-item span:last-child {
    font-size: 10px;
  }
}

/* TOC isolate button label is handled in JS; style as small button */
.toc-header .btn.small {
  padding: 2px 6px;
  /* font-size: 11px; */
}

/* Dragging folders into TOC */
.toc-item.folder-drop-target {
  background: rgba(77, 163, 255, 0.18);
  outline: 1px dashed rgba(77, 163, 255, 0.7);
}

/* ===========================
   BOOKMARK MODAL: TYPE TOGGLE
   =========================== */

/* Hide/show fields based on type via classes JS adds to body or modal */
.modal-body .bookmark-only-field {
  display: block;
  width: 100%;
}

.modal-body .folder-only-field {
  display: none;
}

/* When modal is in “folder” mode, JS can add .mode-folder to backdrop or modal */
#bookmarkModalBackdrop.mode-folder .bookmark-only-field {
  display: none;
}

#bookmarkModalBackdrop.mode-folder .folder-only-field {
  display: block;
}

/* Default text for folder name input can be styled */
#bookmarkFolderNameInput::placeholder {
  opacity: 0.7;
}

/* ===========================
   BOOKMARK ROW / GRID SELECTION
   =========================== */

.bookmark-select-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Highlight selected rows/cards */
.bookmark-row.selected,
.bookmark-card.selected {
  background: rgba(77, 163, 255, 0.12);
  outline: 1px solid rgba(77, 163, 255, 0.6);
}

/* When dragging with Ctrl (copy), give subtle hint */
.bookmark-card.dragging,
.bookmark-row.dragging {
  opacity: 0.6;
}

/* ===========================
   FOLDER DRAG & DROP (TOC + MAIN)
   =========================== */

.folder-drop-target {
  outline: 1px dashed rgba(77, 163, 255, 0.7);
  background: rgba(77, 163, 255, 0.12);
}

/* ===========================
   RESIZABLE NAME/LINK DIVIDER
   =========================== */

.bookmark-row-divider {
  /* width: 2px; */
  cursor: col-resize;
  margin-right: 34px;
  flex: 0 0 auto;
  align-self: stretch;
  background: transparent;
  position: relative;
}

.bookmark-row-divider::before {
  content: "";
  position: absolute;
  /* top: 4px; */
  /* bottom: 4px; */
  width: 15px;
  background: rgba(255, 255, 255, 0.12);
  inset: 0;
  /* border-radius: 999px; */
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.bookmark-row-divider:hover::before {
  opacity: 1;
}

/* ===========================
   FIXED WARNING
   =========================== */

.fixed-warning {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  /* font-size: 11px; */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  z-index: 9999;
}

.fixed-warning.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ===========================
   MISC SMALL TWEAKS
   =========================== */

/* Make sure modals can host the new fields cleanly */
.modal-field {
  margin-bottom: 8px;
}

/* Ensure grid/list containers don’t wrap weirdly inside folder body */

/* Slightly tighter toolbar area if you add controls later */
.folder-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 8px 0;
  gap: 6px;
}

body.resizing-toc .toc-resize-handle {
  background: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   FOLDER SYSTEM — CLEAN, CONSOLIDATED, ANIMATION‑SAFE VERSION
   ============================================================ */

/* Folder container */
.folder {
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  /* background: linear-gradient(
    to right,
    rgba(255, 211, 107, 0.08),
    rgba(255, 211, 107, 0.02)
  ); */
  overflow: visible; /* must be visible for animation */
  display: flex;
  flex-direction: column;
}

.folder-header-left {
  display: flex;
  /* justify-content: center; */
  min-width: 0;
}

.folder-header-title {
  /* font-size: 13px; */
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-header-count {
  /* font-size: 11px; */
  color: var(--text-muted);
  white-space: nowrap;
  opacity: 0.8;
}

.folder-header-count span {
  margin-right: 6px;
}

/* Toggle + delete buttons */
.folder-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.folder-toggle-btn,
.folder-delete-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  padding: 0.6rem;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.folder-delete-btn svg {
  fill: var(--danger);
}

.folder-delete-btn:hover svg {
  fill: var(--color-primary);
}

.folder-toggle-btn svg {

  transition: transform 0.18s ease-out;
}

.folder.collapsed .folder-toggle-btn svg {
  transform: rotate(90deg);
}

/* ============================================================
   FOLDER BODY — THE ANIMATING PART
   ============================================================ */

.folder-body {
  overflow: hidden;                 /* required for sliding */
  max-height: 9999px;               /* required for auto-height animation */
  opacity: 1;
  padding: 8px;
  border-top: 1px solid var(--border-subtle);

  /* Only animate what we need */
  transition:
    max-height 0.25s ease-out,
    opacity 0.20s ease-out,
    padding 0.20s ease-out;
}

/* Collapsed state */
.folder.collapsed .folder-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
}

/* ============================================================
   FOLDER TOOLBAR
   ============================================================ */

.folder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  /* font-size: 11px; */
  color: var(--text-muted);
  padding-bottom: 6px;
}

/* ============================================================
   CONTENT INSIDE FOLDER BODY
   ============================================================ */

.folder-body .bookmarks-grid,
.folder-body .bookmarks-list {
  width: 100%;
  min-height: 1px; /* ensures grid height is measurable for animation */
}

/* ============================================================
   RESPONSIVE BEHAVIOR
   ============================================================ */

@media (max-width: 900px) {
  .folder-header-count .folder-count-label {
    display: none;
  }
}

@media (max-width: 700px) {
  .folder-header-count {
    font-size: 10px;
  }
}

/* Default: favourite mode */
#bookmarkModalBackdrop .bookmark-only-field {
  display: block;
}

#bookmarkModalBackdrop .folder-only-field {
  display: none;
}

/* Folder mode */
#bookmarkModalBackdrop.mode-folder .bookmark-only-field {
  display: none;
}

#bookmarkModalBackdrop.mode-folder .folder-only-field {
  display: block;
}


.folder-pin-btn.pinned {
  opacity: 1;
  pointer-events: auto;
}

.folder:hover .folder-pin-btn,
.folder:hover .folder-edit-btn,
.folder:hover .folder-select-checkbox {
  opacity: 1;
  pointer-events: auto;
}

/* select-mode keeps folder checkboxes visible */
.select-mode .folder-select-checkbox {
  opacity: 1;
  pointer-events: auto;
}

.toc-item.isolated {
  background: rgba(255, 255, 0, 0.15);
  border-left: 3px solid gold;
}

:root {
  /* Shared image / preset */
  --bg-image: none;          /* url("...") set by JS */
  --bg-css: transparent;     /* fallback / pattern if needed */

  /* A: background effects */
  --bg-blur: 40px;           /* A: blur strength */
  --bg-opacity: 1;           /* A: 1 = fully visible, 0 = fully transparent */
  --bg-saturation: 1;        /* A: 1 = normal, 0 = grey, >1 = more color */
  --bg-hue: 0deg;            /* A: hue rotation */
  --bg-flatness: 0;          /* 0 = show image, 1 = fully flat color */

  /* B: main image */
  --bg-zoom: 1;              /* B: scale factor */

  /* Dim / vignette */
  --bg-dimness: 0;           /* 0–1 */
  --bg-vignette: 0;          /* 0–1 */
}

/* Base layer style */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

/* ===========================
   A: full-screen background
   =========================== */

.bg-A {
  z-index: -4;
  background-image: var(--bg-image), var(--bg-css);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  /* A is affected by blur, hue, saturation, opacity */
  filter:
    blur(var(--bg-blur))
    hue-rotate(var(--bg-hue))
    saturate(var(--bg-saturation));
  opacity: var(--bg-opacity);

  /* When flatness goes to 1, we fade this out via JS or CSS if desired */
  transition:
    filter 0.02s ease-out,
    opacity 0.02s ease-out,
    transform 0.12s ease-out;

}

/* ===========================
   A-flat: flat color override
   =========================== */

.bg-A-flat {
  z-index: -3;

  /* Flat color: hue + fixed saturation/lightness */
  background: hsl(var(--bg-hue), 100%, 50%);

  /* Flatness controls visibility of this layer:
     0 = hidden, 1 = fully visible */
  opacity: var(--bg-flatness);

  /* Also affected by saturation + opacity */
  filter:
    brightness(var(--bg-opacity))
    saturate(var(--bg-saturation));

  /* If you want transparency to turn it black instead of fade out:
     you can mix bg-opacity into the color via JS instead of opacity. */

  transition:
    filter 0.12s ease-out,
    opacity 0.12s ease-out,
    transform 0.12s ease-out;

}

/* ===========================
   B: main image (sharp)
   =========================== */

.bg-B {
  z-index: -2;
  background: var(--bg-css);
  background-image: var(--bg-image);
  background-size: contain;      /* only size/zoom */
  background-position: center;
  background-repeat: no-repeat;

  /* Only zoom affects B */
  transform: scale(var(--bg-zoom));
  filter: none;                  /* no blur, hue, opacity, saturation */
  opacity: 1;

  transition:
    transform 0.2s linear;
}

/* ===========================
   Dim + vignette
   =========================== */

.bg-dim {
  z-index: -1;
  background:
    radial-gradient(
      circle at center,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, var(--bg-vignette)) 60%,
      rgba(0, 0, 0, var(--bg-vignette)) 100%
    ),
    rgba(0, 0, 0, var(--bg-dimness));
}

