/* The shared frame: left rail, top bar, main area. */

/* ------------------------------------------------------------------ frame */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  width: 96px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  background: var(--bg-solid);
  z-index: 30;
}

.rail .logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--ink-text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
  margin-bottom: 6px;
}

.rail a,
.rail button.tile {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  position: relative;
}

.rail a:hover {
  box-shadow: 0 0 0 1px var(--hover-ring);
}

.rail a.on {
  background: var(--ink);
  color: var(--ink-text);
  border-color: transparent;
}

/* The theme switch is a bare icon: same 48px hit area as the tiles, but no
   card, border or ring. It brightens on hover instead. */
.rail button.tile {
  background: transparent;
  border: 0;
  color: var(--muted);
}

.rail button.tile:hover,
.rail button.tile:active {
  box-shadow: none;
  border: 0;
  background: transparent;
  color: var(--text);
}

/* The tile has no card behind it, so the colour change is its focus signal. */
.rail button.tile:focus-visible {
  color: var(--text);
}

.rail .spacer {
  margin-top: auto;
}

.rail [data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: var(--ink-text);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}

.rail [data-tip]::after {
  left: 58px;
}

/* The tooltip is the only place the rail names its icons, so it shows for the
   keyboard too - otherwise tabbing the rail is six unnamed squares. */
.rail [data-tip]:hover::after,
.rail [data-tip]:focus-visible::after {
  opacity: 1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 96px;
  right: 0;
  height: 68px;
  background: var(--bg-solid);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  z-index: 20;
}

.topbar .right {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar .knock {
  position: absolute;
  left: 0;
  bottom: -28px;
  width: 28px;
  height: 28px;
  background: radial-gradient(circle at 100% 100%,transparent 28px,var(--bg-solid) 29px);
  pointer-events: none;
}

/* Avatar: a ringed button (card, hairline) around the ink circle with initials. */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}

.avatar span {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ink-text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .02em;
}

/* Split "add" button: the main action and, behind a hairline, the arrow that
   opens the menu with the other object types. */
.addsplit,
.profile {
  position: relative;
}

.addpill {
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ink-text);
  overflow: hidden;
}

.addpill .addmain {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 18px;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.addpill .addmore {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 14px 0 8px;
  color: inherit;
  border-left: 1px solid color-mix(in srgb,var(--ink-text) 22%,transparent);
}

.addpill .addmain:hover,
.addpill .addmore:hover {
  background: var(--ink-hover);
  box-shadow: none;
}

/* Drop-down menus under the top bar (add menu, profile menu). */
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 268px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 18px 44px rgba(0,0,0,.16);
}

.menu form {
  display: contents;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  text-align: left;
  background: transparent;
}

.menu-item:hover {
  background: var(--hover);
  color: var(--text);
  box-shadow: none;
}

.menu-item .ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--card2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.menu-item b {
  display: block;
  font-size: 14px;
  font-weight: 500;
}

.menu-item small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.menu-profile {
  min-width: 260px;
}

.menu-head {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.menu-head b {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.menu-head small {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.menu-item.slim {
  gap: 10px;
}

.menu-item.slim svg {
  color: var(--muted);
}

.menu-item.sep {
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  margin-top: 4px;
  padding-top: 12px;
}

.iconbtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}

main {
  margin: 68px 0 0 96px;
  padding: 28px 28px 56px;
  background: var(--panel);
  border-radius: 28px 0 0 0;
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

@media (max-width:900px) {
  .rail {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    padding: 8px 6px;
    background: var(--card);
    border-top: 1px solid var(--line);
    z-index: 40;
  }
  .rail .logo,
  .rail [data-tip]::after {
    display: none;
  }
  .rail .spacer {
    margin-top: 0;
  }
  .topbar {
    left: 0;
    padding: 0 16px;
    /* One track: the right-hand cluster is all there is on a phone, and the
       two empty 1fr tracks were pushing it off the edge. */
    grid-template-columns: minmax(0,1fr);
  }
  .topbar .right {
    grid-column: 1;
    min-width: 0;
  }
  .addpill {
    min-width: 0;
    max-width: 100%;
  }
  .addpill .addmain {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-flex;
  }
  .topbar .knock {
    display: none;
  }
  main {
    margin: 68px 0 0 0;
    padding: 16px 16px 88px;
    border-radius: 0;
  }
}

/* The row wraps and the tile keeps its square: without flex:none the 48px
   tile was squeezed into a tall thin ellipse and "Премахни снимката" was
   pushed out of the card on a phone. */
.avatar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.avatar-tile {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--ink-text);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .02em;
}

.avatar-row .name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.avatar-row .actions {
  justify-content: flex-start;
}
