/* Layout */
.c2-sidetabs {
  --c2-left: 30%;
  --c2-right: 70%;
  --c2-inactive-width: 95%;   /* width of inactive tab box */
  display: grid;
  grid-template-columns: var(--c2-left) var(--c2-right);
  column-gap: 0;              /* no column gap — active tab will "touch" the pane */
  align-items: stretch;
}

/* Left side list */
.c2-sidetabs__nav {
  list-style: none;
  margin: 0;
  padding: 0;                 /* no padding: we control gap via inner box width */
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: sticky;
  top: 2rem;
}

/* Button is just the interactive shell */
.c2-sidetabs__tab {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

/* The visual "tab" */
.c2-sidetabs__tabbox {
  font-size: var(--c2-summary-font-size, inherit);
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid #000;
  background: transparent;
  color: inherit;
  border-radius: .35rem;
  font: inherit;
  line-height: inherit;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.c2-sidetabs__tab:hover .c2-sidetabs__tabbox {
  background: color-mix(in srgb, #000 6%, transparent);
}

.c2-sidetabs__tab.is-active {
    width: 100%;;
}

.c2-sidetabs__tab {
    width: var(--c2-inactive-width);
}

/* Active: fill the whole left column so it visually connects to the pane */
.c2-sidetabs__tab.is-active .c2-sidetabs__tabbox {
    width: 100%;
  background: #000;
  color: #fff;
  border-color: #000;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* Focus ring for keyboard users */
.c2-sidetabs__tab:focus-visible .c2-sidetabs__tabbox {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Right pane — black bg, white text */
.c2-sidetabs__panes {
  align-self: stretch;   /* fill the grid row height */
  min-height: 100%;      /* ensure background reaches full column height */
  background: #000;
  border-radius: 0 .35rem .35rem 0;
}
.c2-sidetabs__pane { display: none; color: #fff; padding: 1rem; }
.c2-sidetabs__pane.is-active { display: block; }

.c2-sidetabs__pane.is-active p {
    margin: 0;
}

/* Ensure inner elements are readable on black */
.c2-sidetabs__pane :is(h1,h2,h3,h4,h5,h6) { color: #fff; }
.c2-sidetabs__pane a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.55); }
.c2-sidetabs__pane hr { border-color: rgba(255,255,255,.25); }
.c2-sidetabs__pane :is(code, pre) { background: rgba(255,255,255,.08); color: #fff; }

/* Responsive: stack on small screens */
@media (max-width: 768px) {
  .c2-sidetabs { grid-template-columns: 1fr; }
  .c2-sidetabs__nav { position: static; flex-direction: row; flex-wrap: wrap; gap: .5rem; }
  .c2-sidetabs__tabbox { width: auto; border-radius: .35rem; } /* no "bridge" in stacked layout */
  .c2-sidetabs__panes { border-radius: .35rem; }
}

/* Single core/details still no-op */
.wp-block-details.is-style-c2-side-tabs { /* no-op */ }

@keyframes c2fade { from { opacity: 0; transform: translateY(2px);} to { opacity: 1; transform: translateY(0);} }

/* Remove focus border on the tabs */
.c2-sidetabs__tab:focus,
.c2-sidetabs__tab:focus-visible {
  outline: none;
}

.c2-sidetabs__tab:focus .c2-sidetabs__tabbox,
.c2-sidetabs__tab:focus-visible .c2-sidetabs__tabbox {
  outline: none;
}

/* --- keep left column from bleeding into the right --- */
.c2-sidetabs__nav {
  padding: 0 !important;      /* ensure no right padding from earlier iterations */
}

/* li should never push past its column */
.c2-sidetabs__nav > li {
  display: block;
  margin: 0;
  padding: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* button must not use old negative margins or extra z-index */
.c2-sidetabs__tab {
  margin: 0 !important;
  z-index: auto !important;
}

/* kill any old bridging rules (if they remain in your sheet) */
.c2-sidetabs__tab.is-active { margin-right: 0 !important; }
.c2-sidetabs__tab.is-active::after { content: none !important; }

/* inner visual box still controls the visual gap (90% inactive, 100% active) */
.c2-sidetabs__tab.is-active .c2-sidetabs__tabbox { width: 100%; }
