/* ClimateContour Collapsible Sidebar v1.4.1 — Blocksy */
@media (min-width: 1000px) {
  /* Only the article contributes to the layout's vertical size. The aside
     is anchored to the article's full height without taking up a grid row. */
  .ccsb-layout[data-sidebar="right"] {
    position: relative !important;
  }
  .ccsb-layout[data-sidebar="right"] > #sidebar {
    box-sizing: border-box;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    min-width: 0;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    z-index: 30;
    align-self: auto !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .ccsb-layout[data-sidebar="right"] > #sidebar::before,
  .ccsb-layout[data-sidebar="right"] > #sidebar::after {
    display: none !important;
  }

  /* The translucent panel is visible only inside the content's height and
     its overflowing widgets scroll independently of the document. */
  .ccsb-layout[data-sidebar="right"] > #sidebar > .ccsb-panel {
    box-sizing: border-box;
    position: sticky !important;
    top: var(--ccsb-overlay-top, 88px) !important;
    display: block;
    width: 100%;
    height: max-content;
    max-height: min(100%, calc(100vh - var(--ccsb-overlay-top, 88px) - 16px));
    max-height: min(100%, calc(100dvh - var(--ccsb-overlay-top, 88px) - 16px));
    min-height: 0;
    padding: 16px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(145, 162, 183, 0.32);
    border-radius: 16px;
    background: rgba(250, 252, 255, 0.76);
    box-shadow: 0 14px 42px rgba(23, 45, 74, 0.12);
    -webkit-backdrop-filter: blur(15px) saturate(125%);
    backdrop-filter: blur(15px) saturate(125%);
  }
  .ccsb-layout .ccsb-toolbar {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
    min-height: 38px;
    margin-bottom: 14px;
  }
  .ccsb-layout .ccsb-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(123, 145, 169, 0.35);
    border-radius: 12px;
    color: #344c68;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 6px rgba(40, 60, 82, 0.06);
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
  }
  .ccsb-layout .ccsb-toggle svg {
    width: 19px;
    height: 19px;
    pointer-events: none;
  }
  .ccsb-layout .ccsb-toggle:hover {
    background: rgba(227, 237, 249, 0.94);
    border-color: rgba(102, 131, 164, 0.6);
  }
  .ccsb-layout .ccsb-toggle:focus-visible {
    outline: 2px solid #286db7;
    outline-offset: 2px;
  }

  /* Static pages: the sidebar overlays the article and never reserves width. */
  .ccsb-layout.ccsb-page[data-sidebar="right"] {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: none !important;
    column-gap: 0 !important;
  }
  .ccsb-layout.ccsb-page[data-sidebar="right"] > :not(#sidebar) {
    grid-area: 1 / 1 !important;
    min-width: 0;
  }
  .ccsb-layout.ccsb-page[data-sidebar="right"] > #sidebar {
    width: min(340px, calc(100% - 24px)) !important;
  }

  /* Posts: preserve Blocksy's right-hand column but never let its widgets
     enlarge the article or push the page footer down. */
  .ccsb-layout.ccsb-post[data-sidebar="right"] > #sidebar {
    width: var(--ccsb-post-column-width, 27%) !important;
  }
  .ccsb-layout.ccsb-post.ccsb-is-collapsed[data-sidebar="right"] {
    --sidebar-width: 54px !important;
    --sidebar-gap: 14px !important;
    grid-template-columns: minmax(0, 1fr) 54px !important;
    column-gap: 14px !important;
  }
  .ccsb-layout.ccsb-post.ccsb-is-collapsed > #sidebar {
    width: 54px !important;
  }

  /* Minimized state: preserve a small reopening control only. */
  .ccsb-layout.ccsb-page.ccsb-is-collapsed > #sidebar {
    width: 54px !important;
  }
  .ccsb-layout.ccsb-is-collapsed > #sidebar > .ccsb-panel {
    width: 54px !important;
    height: 54px !important;
    max-height: min(54px, 100%) !important;
    padding: 7px !important;
    overflow: hidden !important;
  }
  .ccsb-layout.ccsb-is-collapsed .ccsb-panel > :not(.ccsb-toolbar) {
    display: none !important;
  }
  .ccsb-layout.ccsb-is-collapsed .ccsb-toolbar {
    min-height: 38px !important;
    margin: 0 !important;
    justify-content: center !important;
  }
}

/* Smaller screens: Blocksy manages the normal non-overlay sidebar. */
@media (max-width: 999.98px) {
  .ccsb-layout .ccsb-toolbar { display: none !important; }
  .ccsb-layout > #sidebar > .ccsb-panel { display: contents; }
}
@media (prefers-reduced-motion: reduce) {
  .ccsb-layout .ccsb-toggle { transition: none !important; }
}
