/* Tab rail tucked behind the right edge of the card's back. It peeks out and
   slides into full view when the mouse comes near or on keyboard focus. */
#container .back-tabs {
  position: absolute;
  left: var(--rail-left);
  top: var(--rail-top);
  z-index: -1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 37px;
  padding: 5px 5px 5px 0;
  background: var(--frame);
  border: 1px solid var(--rail-border);
  border-left: none;
  border-radius: 0 12px 12px 0;
}
#container .back-tabs[hidden],
#container .card-projects [role="tabpanel"][hidden] { display: none; }
/* Selected background, moved between the tabs by js/back-tabs.js. */
#container .back-tabs-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--tab-selected);
  transition: translate 320ms cubic-bezier(.22, .75, .22, 1), width 320ms cubic-bezier(.22, .75, .22, 1), height 320ms cubic-bezier(.22, .75, .22, 1);
}
#container .back-tabs button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  padding: 14px 0;
  border: none;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--muted);
  font: 400 14px/1 "Inter:Regular", sans-serif;
  white-space: nowrap;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  cursor: pointer;
  transition: color 140ms ease;
}
#container .back-tabs button:hover { color: var(--tab-hover-text); }
#container .back-tabs button[aria-selected="true"] { color: var(--text); }
#container .back-tabs button:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

/* Touch screens have no hover, so the rail stays in view there. */
@media (hover: hover) and (pointer: fine) {
  #container .back-tabs {
    --peek: 12px;
    translate: calc(var(--peek) - 100%) 0;
    transition: translate 260ms cubic-bezier(.22, .75, .22, 1);
  }
  #container .back-tabs:is(:hover, .is-near, :has(:focus-visible)) { translate: 0 0; }
}
/* Appear only once the card has nearly finished flipping. */
@keyframes back-tabs-in {
  from { translate: -100% 0; visibility: hidden; }
  1% { visibility: visible; }
}
@media (prefers-reduced-motion: no-preference) {
  #container .back-tabs:not([hidden]) { animation: back-tabs-in 260ms 520ms ease-out backwards; }
}

/* Reaches past the rail's edge, which is easier to hit with a finger. */
@media (pointer: coarse) {
  #container .back-tabs button::after {
    content: '';
    position: absolute;
    inset: 0 -22px 0 0;
  }
}
@media (max-width: 600px) {
  #container .back-tabs { width: 29px; padding: 4px 4px 4px 0; border-radius: 0 10px 10px 0; }
  #container .back-tabs button { width: 24px; padding: 13px 0; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  #container .back-tabs,
  #container .back-tabs-indicator,
  #container .back-tabs button { transition: none; }
}
