
/* Fork: the Discord-style app rail and the per-app nav column (src/js/fork/,
   .claude/plans/fork-layer.md §5). Everything here is scoped to classes the
   fork layer adds, so the classic layout is untouched. Switched in
   Settings → Appearance → Layout. Built from upstream's tokens (highlight
   colour, backgrounds, weights) so it follows the Appearance settings. */

:root {
  --fork-rail-width: 72px;
  --fork-rail-background: var(--background-color-secondary);
  --fork-rail-button-size: 48px;
  --fork-private-color: light-dark(#8a4ff0, #a77bff);
}

.fork-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: var(--fork-rail-width);
  padding-block: 12px;
  background: var(--fork-rail-background);
}

.fork-rail--fixed {
  display: none;
}

@media (min-width: 800px) {
  .fork-rail--fixed {
    display: flex;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--sidebar-z-index);
  }

  .fork-rail-layout {
    padding-left: var(--fork-rail-width);
  }

  .fork-rail--drawer {
    display: none;
  }
}

/* Phone: the rail sits on the left edge inside the drawer, as Discord mobile */
@media (max-width: 799px) {
  .sidebar:has(> .sidebar-content > .fork-rail--drawer) {
    width: calc(var(--sidebar-max-width) + var(--fork-rail-width));
    max-width: 92%;
  }

  .sidebar > .sidebar-content:has(> .fork-rail--drawer) {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    padding-left: var(--fork-rail-width);
  }

  .fork-rail--drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .fork-rail-tip {
    display: none;
  }
}

.fork-rail-item {
  position: relative;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
}

/* The pill on the left edge: a dot on hover, a bar for the active app */
.fork-rail-item::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: var(--text-color);
  transform: translateY(-50%) scaleY(0);
  transition:
    transform 0.15s ease,
    height 0.15s ease;
}

.fork-rail-item:hover::before {
  height: 20px;
  transform: translateY(-50%) scaleY(1);
}

.fork-rail-item.active::before {
  height: 40px;
  transform: translateY(-50%) scaleY(1);
}

/* Unread notifications on the Bluesky icon */
.fork-rail-button {
  position: relative;
}

.fork-rail-badge {
  top: -4px;
  right: -6px;
}

button.fork-rail-button {
  padding: 0;
  border: none;
  font: inherit;
  cursor: pointer;
}

.fork-rail-button.fork-rail-compose,
.fork-rail-item:hover .fork-rail-button.fork-rail-compose {
  background: var(--primary-button-color);
  color: var(--primary-button-text-color);
}

.fork-rail-button.fork-rail-compose app-icon {
  width: 22px;
  height: 22px;
}

/* "Hide the menu": only the rail is left on desktop */
@media (min-width: 800px) {
  .fork-nav-collapsed .view-column-left {
    display: none;
  }
}

/* "Hide apps": the rail is replaced by a tab on the left edge */
.fork-rail-show-tab {
  display: none;
}

@media (min-width: 800px) {
  .fork-rail-layout.fork-rail-hidden {
    padding-left: 0;
  }

  .fork-rail-show-tab {
    display: flex;
    position: fixed;
    top: 50%;
    left: 0;
    z-index: var(--sidebar-z-index);
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--post-border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    background: var(--fork-rail-background);
    color: var(--text-color-secondary);
    cursor: pointer;
    transform: translateY(-50%);
  }

  .fork-rail-show-tab:hover {
    width: 22px;
    background: var(--post-hover-color);
  }

  .fork-rail-show-tab:focus-visible {
    outline: 2px solid var(--highlight-color);
    outline-offset: 2px;
  }

  .fork-rail-show-tab app-icon {
    width: 16px;
    height: 16px;
  }
}

/* All signed-in accounts (fork/railAccounts.js), Discord server-list style */
fork-rail-accounts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

button.fork-rail-avatar {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.fork-rail-account .avatar-image-frame {
  transition: border-radius 0.15s ease;
}

.fork-rail-account:not(.active) .fork-rail-avatar {
  opacity: 0.85;
}

.fork-rail-account:hover .fork-rail-avatar {
  opacity: 1;
}

.fork-rail-account.active .avatar-image-frame {
  box-shadow: 0 0 0 2px var(--highlight-color);
}

.fork-rail-account--reauth .fork-rail-avatar {
  filter: grayscale(1);
  opacity: 0.5;
}

.fork-rail-account--pending .fork-rail-avatar {
  opacity: 0.4;
}

/* Lock badge on the private-data account */
.fork-rail-lock {
  position: absolute;
  right: 12px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fork-rail-background);
  color: var(--fork-private-color);
  pointer-events: none;
}

.fork-rail-lock app-icon {
  width: 12px;
  height: 12px;
}

.fork-rail-button {
  display: grid;
  place-items: center;
  width: var(--fork-rail-button-size);
  height: var(--fork-rail-button-size);
  border-radius: calc(var(--fork-rail-button-size) / 2);
  background: var(--background-color);
  color: var(--text-color-secondary);
  text-decoration: none;
  transition:
    border-radius 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.fork-rail-button app-icon {
  width: 26px;
  height: 26px;
}

.fork-rail-item:hover .fork-rail-button {
  border-radius: 16px;
  background: var(--post-hover-color);
  color: var(--text-color);
}

.fork-rail-item.active .fork-rail-button {
  border-radius: 16px;
  background: var(--highlight-color);
  color: var(--primary-button-text-color);
}

.fork-rail-item:hover .fork-rail-button--plain {
  background: var(--secondary-button-color);
  color: var(--text-color);
}

.fork-rail-button:focus-visible,
.fork-rail-avatar:focus-visible {
  outline: 2px solid var(--highlight-color);
  outline-offset: 2px;
}

.fork-rail-tip {
  position: absolute;
  top: 50%;
  left: calc(100% - 4px);
  z-index: 1;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--text-color);
  color: var(--background-color);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(4px, -50%);
  transition:
    opacity 0.1s ease,
    transform 0.1s ease;
}

.fork-rail-item:hover .fork-rail-tip {
  opacity: 1;
  transform: translate(10px, -50%);
}

.fork-rail-spacer {
  flex: 1;
  min-height: 8px;
}

.fork-rail-sep {
  flex-shrink: 0;
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: var(--post-border-color);
}

.fork-rail-avatar {
  display: block;
  line-height: 0;
}

.fork-rail-avatar.long-press-enabled {
  -webkit-touch-callout: none;
  user-select: none;
}

.fork-rail-avatar .avatar-image-frame {
  width: 40px;
  height: 40px;
}

/* Nav column of a fork app (same .sidebar-nav classes as upstream) */
/* The app's name above its nav, quiet like the sidebar's handle line */
.fork-nav-header {
  padding: 20px 20px 8px 28px;
}

.fork-nav-title {
  margin: 0;
  color: var(--text-color-muted);
  font-size: 15px;
  font-weight: 400;
}

@media (min-width: 800px) and (max-width: 1199px) {
  .fork-nav-header {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fork-rail-item::before,
  .fork-rail-button,
  .fork-rail-tip {
    transition: none;
  }
}

.fork-private-account select {
  max-width: 100%;
}

