/* ===================================================================
   Version History & Changes sidebar.

   Standing beside the reading column on wide screens, and rendered as a top
   card on narrow screens. Uses `.card` (primitives.css) for its resting,
   in-flow surface -- unlike the popovers above it, which float. The section
   page's "Document Info" tab strips that card back off: it's a pane of its
   own there already, not something sitting loose atop other content. ===== */

.sidebar-left {
  display: block;
  margin: 1.2rem 0 var(--space-10);
  padding: var(--space-7) var(--space-8);
  font-family: var(--sans);
  font-size: var(--text-xs);
  line-height: 1.35;
}

#doc-panel-info .sidebar-left {
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (min-width: 76rem) {
  .sidebar-left {
    position: sticky;
    top: var(--chrome-h);
    max-height: calc(100vh - var(--chrome-h) - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    z-index: 30;
    margin: 0;
    padding: 0 4px var(--space-8) 0;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  /* `1 / -1` spans both of the section page's rows; on the diff page's
     one-row grid the last line is just row 1's own. */
  .doc > .sidebar-left,
  #doc-panel-info {
    grid-column: 1;
    grid-row: 1 / -1;
  }
}

.sidebar-section {
  margin-bottom: 1.1rem;
}
.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-3xs);
}

.sidebar-meta-item {
  margin-bottom: var(--space-4);
}
.sidebar-meta-item:last-child {
  margin-bottom: 0;
}
.sidebar-meta-label {
  display: block;
  font-size: var(--text-3xs);
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sidebar-meta-value {
  display: block;
  font-size: var(--text-sm);
  font-weight: 550;
  color: var(--ink);
}
.sidebar-citation {
  color: var(--accent);
  font-family: var(--sans);
  font-weight: 650;
}
.sidebar-status {
  color: var(--note);
  font-style: italic;
}
.sidebar-meta-link {
  color: var(--accent);
  text-decoration: none;
}
.sidebar-meta-link:hover {
  text-decoration: underline;
}

.sidebar-citation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: .1rem 0;
}

.sidebar-citation-text {
  font-family: var(--sans);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}

.sidebar-copy-btn {
  background: transparent;
  border: none;
  padding: 2px;
  margin: 0 2px 0 0;
  cursor: pointer;
  font: inherit;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.sidebar-meta-sub {
  display: block;
  font-family: var(--sans);
  font-size: var(--text-2xs);
  font-weight: 400;
  color: var(--faint);
  line-height: 1.35;
  margin-top: .05rem;
}

.sidebar-rp-sub[title] {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: var(--rule);
  text-underline-offset: 2px;
}
.sidebar-rp-sub[title]:hover {
  color: var(--muted);
  text-decoration-color: var(--muted);
}

.sidebar-prior-amendments {
  margin-top: .15rem;
}
.sidebar-prior-link {
  display: inline-block;
  background: transparent;
  border: none;
  padding: 0;
  font-family: var(--sans);
  font-size: var(--text-2xs);
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.sidebar-prior-link:hover {
  text-decoration-style: solid;
}

/* Mobile-only tabs switching the reading column and the sidebar's card
   between two views instead of stacking one atop the other, so the statute
   text is what a reader lands on. Above the sidebar's own breakpoint both
   panels show at once, as before, and the tabs disappear. */
.doc-tabs {
  display: flex;
  gap: var(--space-6);
  margin: 0 0 var(--space-8);
  border-bottom: 1px solid var(--rule);
}

.doc-tab {
  padding: var(--space-5) var(--space-2);
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  font-family: var(--sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--faint);
  cursor: pointer;
}
.doc-tab:hover {
  color: var(--ink);
}
.doc-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.doc-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Stage clips, track slides -- see doc_tabs_controller.js. */
@media not (min-width: 76rem) {
  .doc-stage {
    overflow: hidden;
  }
  .doc-tabtrack {
    display: flex;
    align-items: flex-start;
    transition: transform .3s ease-in-out;
  }
  .doc-tabtrack:has(#doc-panel-info) {
    width: 200%;
  }
  .doc-tabtrack:has(#doc-panel-info) > .doc-tabpanel {
    flex: 0 0 50%;
    width: 50%;
    min-width: 0;
    box-sizing: border-box;
  }
  .doc-tabtrack.showing-info {
    transform: translateX(-50%);
  }
  @media (prefers-reduced-motion: reduce) {
    .doc-tabtrack {
      transition: none;
    }
  }
}

@media (min-width: 76rem) {
  .doc-tabs {
    display: none;
  }
  /* Unboxes both panels back to being `.doc`'s own grid children. */
  .doc-stage,
  .doc-tabtrack {
    display: contents;
  }
}
